diff --git a/src/Engine.zig b/src/Engine.zig index 29382109..11de2bde 100644 --- a/src/Engine.zig +++ b/src/Engine.zig @@ -34,10 +34,20 @@ pub const Core = struct { core.internal.setShouldClose(value); } + // 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 { 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 { + return core.internal.getWindowSize(); + } + pub fn setSizeLimits(core: *Core, min: structs.SizeOptional, max: structs.SizeOptional) !void { return core.internal.setSizeLimits(min, max); } diff --git a/src/native.zig b/src/native.zig index 42120e32..5ac5c8e1 100644 --- a/src/native.zig +++ b/src/native.zig @@ -93,6 +93,11 @@ pub const CoreGlfw = struct { return @bitCast(structs.Size, size); } + pub fn getWindowSize(self: *CoreGlfw) !structs.Size { + const size = try self.window.getSize(); + return @bitCast(structs.Size, size); + } + pub fn setSizeLimits(self: *CoreGlfw, min: structs.SizeOptional, max: structs.SizeOptional) !void { try self.window.setSizeLimits( @bitCast(glfw.Window.SizeOptional, min),