diff --git a/examples/advanced-gen-texture-light/main.zig b/examples/advanced-gen-texture-light/main.zig index 32d6661f..9aef7473 100755 --- a/examples/advanced-gen-texture-light/main.zig +++ b/examples/advanced-gen-texture-light/main.zig @@ -38,7 +38,7 @@ pub fn init(app: *App, engine: *mach.Engine) !void { const eye = vec3(5.0, 7.0, 5.0); const target = vec3(0.0, 0.0, 0.0); - const size = try engine.core.getFramebufferSize(); + const size = engine.core.getFramebufferSize(); const aspect_ratio = @intToFloat(f32, size.width) / @intToFloat(f32, size.height); app.queue = engine.gpu_driver.device.getQueue(); diff --git a/examples/gkurve/main.zig b/examples/gkurve/main.zig index 809f33d1..f404f4ed 100644 --- a/examples/gkurve/main.zig +++ b/examples/gkurve/main.zig @@ -99,7 +99,7 @@ pub fn init(app: *App, engine: *mach.Engine) !void { app.texture_atlas_data.data, ); - const wsize = try engine.core.getWindowSize(); + const wsize = engine.core.getWindowSize(); const window_width = @intToFloat(f32, wsize.width); const window_height = @intToFloat(f32, wsize.height); const triangle_scale = 250; @@ -324,7 +324,7 @@ pub fn getVertexUniformBufferObject(engine: *mach.Engine) !draw.VertexUniform { // On e.g. macOS, window size may be 640x480 while framebuffer size may be // 1280x960 (subpixels.) Doing this lets us use a pixel, not subpixel, // coordinate system. - const window_size = try engine.core.getWindowSize(); + const window_size = engine.core.getWindowSize(); const proj = zm.orthographicRh( @intToFloat(f32, window_size.width), @intToFloat(f32, window_size.height), diff --git a/src/Engine.zig b/src/Engine.zig index 516a4251..aa64c309 100644 --- a/src/Engine.zig +++ b/src/Engine.zig @@ -39,14 +39,14 @@ pub const Core = struct { // Returns the framebuffer size, in subpixel units. // // e.g. returns 1280x960 on macOS for a window that is 640x480 - pub fn getFramebufferSize(core: *Core) !structs.Size { + pub fn getFramebufferSize(core: *Core) structs.Size { return core.internal.getFramebufferSize(); } // Returns the widow size, in pixel units. // - // e.g. returns 1280x960 on macOS for a window that is 640x480 - pub fn getWindowSize(core: *Core) !structs.Size { + // e.g. returns 640x480 on macOS for a window that is 640x480 + pub fn getWindowSize(core: *Core) structs.Size { return core.internal.getWindowSize(); } diff --git a/src/platform/native.zig b/src/platform/native.zig index d3d3094d..bb194e82 100644 --- a/src/platform/native.zig +++ b/src/platform/native.zig @@ -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; diff --git a/src/platform/wasm.zig b/src/platform/wasm.zig index 35db409f..3aab40ab 100644 --- a/src/platform/wasm.zig +++ b/src/platform/wasm.zig @@ -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),