Skip to content

Commit 3967de6

Browse files
committed
minimal_zgui_glfw_gl fixes
1 parent 91ed8a3 commit 3967de6

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

samples/minimal_zgui_glfw_gl/src/minimal_zgui_glfw_gl.zig

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ pub fn main() !void {
3636

3737
try gl.loadCoreProfile(glfw.getProcAddress, gl_major, gl_minor);
3838

39-
const scale_factor = scale_factor: {
40-
const scale = window.getContentScale();
41-
break :scale_factor @max(scale[0], scale[1]);
42-
};
43-
4439
var gpa_state = std.heap.GeneralPurposeAllocator(.{}){};
4540
defer _ = gpa_state.deinit();
4641
const gpa = gpa_state.allocator();
@@ -50,19 +45,19 @@ pub fn main() !void {
5045

5146
_ = zgui.io.addFontFromFile(
5247
content_dir ++ "Roboto-Medium.ttf",
53-
std.math.floor(16.0 * scale_factor),
48+
std.math.floor(16.0),
5449
);
5550

5651
zgui.backend.init(window);
5752
defer zgui.backend.deinit();
5853

59-
zgui.getStyle().scaleAllSizes(scale_factor);
60-
6154
while (!window.shouldClose() and window.getKey(.escape) != .press) {
6255
glfw.pollEvents();
6356

6457
gl.clearBufferfv(gl.COLOR, 0, &[_]f32{ 0, 0, 0, 1.0 });
6558

59+
zgui.backend.newFrame();
60+
6661
// Set the starting window position and size to custom values
6762
zgui.setNextWindowPos(.{ .x = 20.0, .y = 20.0, .cond = .first_use_ever });
6863
zgui.setNextWindowSize(.{ .w = -1.0, .h = -1.0, .cond = .first_use_ever });
@@ -74,6 +69,8 @@ pub fn main() !void {
7469
}
7570
zgui.end();
7671

72+
zgui.backend.draw();
73+
7774
window.swapBuffers();
7875
}
7976
}

0 commit comments

Comments
 (0)