{mach,examples}: followups to getWindowSize / getFramebufferSize (#322)

* followup to window size saving, getWindowSize and getFramebufferSize no longer return errors
* updated the examples
This commit is contained in:
David Vanderson 2022-05-31 14:39:53 -04:00 committed by GitHub
parent 6bfb16554a
commit 3961073084
Failed to generate hash of commit
5 changed files with 10 additions and 10 deletions

View file

@ -349,7 +349,7 @@ pub const GpuDriver = struct {
},
};
var framebuffer_size = try engine.core.getFramebufferSize();
var framebuffer_size = engine.core.getFramebufferSize();
// If targeting OpenGL, we can't use the newer WGPUSurface API. Instead, we need to use the
// older Dawn-specific API. https://bugs.chromium.org/p/dawn/issues/detail?id=269&q=surface&can=2
@ -440,7 +440,7 @@ pub fn main() !void {
engine.delta_time_ns = engine.timer.lapPrecise();
engine.delta_time = @intToFloat(f32, engine.delta_time_ns) / @intToFloat(f32, std.time.ns_per_s);
var framebuffer_size = try engine.core.getFramebufferSize();
var framebuffer_size = engine.core.getFramebufferSize();
engine.gpu_driver.target_desc.width = framebuffer_size.width;
engine.gpu_driver.target_desc.height = framebuffer_size.height;

View file

@ -44,14 +44,14 @@ pub const Core = struct {
pub fn setShouldClose(_: *Core, _: bool) void {}
pub fn getFramebufferSize(core: *Core) !structs.Size {
pub fn getFramebufferSize(core: *Core) structs.Size {
return structs.Size{
.width = js.machCanvasGetFramebufferWidth(core.id),
.height = js.machCanvasGetFramebufferHeight(core.id),
};
}
pub fn getWindowSize(core: *Core) !structs.Size {
pub fn getWindowSize(core: *Core) structs.Size {
return structs.Size{
.width = js.machCanvasGetWindowWidth(core.id),
.height = js.machCanvasGetWindowHeight(core.id),