@@ -28,7 +28,9 @@ pub fn main() !void {
28
28
zgui .init (gpa );
29
29
defer zgui .deinit ();
30
30
31
- _ = zgui .io .addFontFromFile ("content/Roboto-Medium.ttf" , 16.0 );
31
+ // _ = zgui.io.addFontFromFile("content/Roboto-Medium.ttf", 26.0);
32
+ // _ = zgui.io.addFontFromFile("content/FiraCode-Medium.ttf", 26.0);
33
+ _ = zgui .io .addFontFromFile ("content/ProggyClean.ttf" , 26.0 );
32
34
33
35
zgui .backend .init (
34
36
window ,
@@ -40,13 +42,36 @@ pub fn main() !void {
40
42
while (! window .shouldClose ()) {
41
43
zglfw .pollEvents ();
42
44
45
+ zgui .backend .newFrame (
46
+ gctx .swapchain_descriptor .width ,
47
+ gctx .swapchain_descriptor .height ,
48
+ );
49
+
50
+ // Set the starting window position and size to custom values
51
+ zgui .setNextWindowPos (.{ .x = 20.0 , .y = 20.0 , .cond = .first_use_ever });
52
+ zgui .setNextWindowSize (.{ .w = -1.0 , .h = -1.0 , .cond = .first_use_ever });
53
+
54
+ if (zgui .begin ("Button list" , .{})) {
55
+ if (zgui .button ("Convert" , .{ .w = 200.0 })) {
56
+ std .debug .print ("Converting...\n " , .{});
57
+ }
58
+ }
59
+ zgui .end ();
60
+
43
61
const swapchain_texv = gctx .swapchain .getCurrentTextureView ();
44
62
defer swapchain_texv .release ();
45
63
46
64
const commands = commands : {
47
65
const encoder = gctx .device .createCommandEncoder (null );
48
66
defer encoder .release ();
49
67
68
+ // GUI pass
69
+ {
70
+ const pass = zgpu .beginRenderPassSimple (encoder , .load , swapchain_texv , null , null , null );
71
+ defer zgpu .endReleasePass (pass );
72
+ zgui .backend .draw (pass );
73
+ }
74
+
50
75
break :commands encoder .finish (null );
51
76
};
52
77
defer commands .release ();
0 commit comments