Content-Length: 364611 | pFad | http://github.com/zig-gamedev/zig-gamedev/pull/755/files

A4 update zgui (dpi scaling fixes) by hazeycode · Pull Request #755 · zig-gamedev/zig-gamedev · GitHub
Skip to content

update zgui (dpi scaling fixes) #755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
},

.zgui = .{
.url = "https://github.com/zig-gamedev/zgui/archive/ec1372b6ca7ca0cfd187fc93c5d64878271ba608.tar.gz",
.hash = "zgui-0.6.0-dev--L6sZIWbaADnz0Nsywh4rzg-H2ZqWn6m_1mNWjaKLlBQ",
.url = "https://github.com/zig-gamedev/zgui/archive/920f489c5b822588eb9309a46e910cfb3f95f405.tar.gz",
.hash = "zgui-0.6.0-dev--L6sZH-maACBEWPkZHpd7BBQJSVKxzhv7P9Vu7c5lzFw",
},

.zjobs = .{
Expand Down
17 changes: 4 additions & 13 deletions samples/triangle_wgpu/src/triangle_wgpu.zig
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,8 @@ fn deinit(allocator: std.mem.Allocator, demo: *DemoState) void {
}

fn update(demo: *DemoState) void {
zgui.backend.newFrame(
demo.gctx.swapchain_descriptor.width,
demo.gctx.swapchain_descriptor.height,
);
_ = demo;
zgui.backend.newFrame();
zgui.showDemoWindow(null);
}

Expand Down Expand Up @@ -345,15 +343,10 @@ pub fn main() !void {
var demo = try init(allocator, window);
defer deinit(allocator, &demo);

const scale_factor = scale_factor: {
const scale = window.getContentScale();
break :scale_factor @max(scale[0], scale[1]);
};

zgui.init(allocator);
defer zgui.deinit();

_ = zgui.io.addFontFromFile(content_dir ++ "Roboto-Medium.ttf", math.floor(16.0 * scale_factor));
_ = zgui.io.addFontFromFile(content_dir ++ "Roboto-Medium.ttf", math.floor(16.0));

zgui.backend.init(
window,
Expand All @@ -363,10 +356,8 @@ pub fn main() !void {
);
defer zgui.backend.deinit();

zgui.getStyle().scaleAllSizes(scale_factor);

while (!window.shouldClose() and window.getKey(.escape) != .press) {
zglfw.pollEvents();
zglfw.pollEvents();
update(&demo);
draw(&demo);
}
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/zig-gamedev/zig-gamedev/pull/755/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy