Skip to content
48 changes: 48 additions & 0 deletions src/zglfw.zig
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ extern fn glfwWaitEvents() void;
pub const waitEventsTimeout = glfwWaitEventsTimeout;
extern fn glfwWaitEventsTimeout(timeout: f64) void;

/// `pub fn postEmptyEvent() void`
pub const postEmptyEvent = glfwPostEmptyEvent;
extern fn glfwPostEmptyEvent() void;

pub fn isVulkanSupported() bool {
return glfwVulkanSupported() == TRUE;
}
Expand Down Expand Up @@ -722,11 +726,19 @@ pub const Window = opaque {
pub const setCursorEnterCallback = zglfw.setCursorEnterCallback;
pub const getMonitor = zglfw.getWindowMonitor;
pub const setMonitor = zglfw.setWindowMonitor;
pub const iconify = zglfw.iconifyWindow;
pub const restore = zglfw.restoreWindow;
pub const maximize = zglfw.maximizeWindow;
pub const show = zglfw.showWindow;
pub const hide = zglfw.hideWindow;
pub const focus = zglfw.focusWindow;
pub const requestAttention = zglfw.requestWindowAttention;
pub const getKey = zglfw.getKey;
pub const getMouseButton = zglfw.getMouseButton;
pub const setSizeLimits = zglfw.setWindowSizeLimits;
pub const setAspectRatio = zglfw.setWindowAspectRatio;
pub const getOpacity = zglfw.getWindowOpacity;
pub const setOpacity = zglfw.setWindowOpacity;
pub const setSize = zglfw.setWindowSize;
pub const setPos = zglfw.setWindowPos;
pub const setTitle = zglfw.setWindowTitle;
Expand Down Expand Up @@ -755,6 +767,15 @@ pub const Window = opaque {
return .{ xscale, yscale };
}

pub fn getFrameSize(self: *Window) [4]c_int {
var left: c_int = 0.0;
var top: c_int = 0.0;
var right: c_int = 0.0;
var bottom: c_int = 0.0;
Comment on lines +771 to +774
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integer variables are being initialized with floating-point literal 0.0. Use 0 instead of 0.0 for c_int variables.

Copilot uses AI. Check for mistakes.
zglfw.getWindowFrameSize(self, &left, &top, &right, &bottom);
return .{ left, top, right, bottom };
}

pub fn getFramebufferSize(self: *Window) [2]c_int {
var width: c_int = 0.0;
var height: c_int = 0.0;
Comment on lines 780 to 781
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integer variables are being initialized with floating-point literal 0.0. Use 0 instead of 0.0 for c_int variables.

Copilot uses AI. Check for mistakes.
Expand Down Expand Up @@ -921,12 +942,27 @@ extern fn glfwSetWindowMonitor(
refreshRate: c_int,
) void;

pub const iconifyWindow = glfwIconifyWindow;
extern fn glfwIconifyWindow(*Window) void;

pub const restoreWindow = glfwRestoreWindow;
extern fn glfwRestoreWindow(*Window) void;

pub const maximizeWindow = glfwMaximizeWindow;
extern fn glfwMaximizeWindow(*Window) void;

pub const showWindow = glfwShowWindow;
extern fn glfwShowWindow(*Window) void;

pub const hideWindow = glfwHideWindow;
extern fn glfwHideWindow(*Window) void;

pub const focusWindow = glfwFocusWindow;
extern fn glfwFocusWindow(*Window) void;

pub const requestWindowAttention = glfwRequestWindowAttention;
extern fn glfwRequestWindowAttention(*Window) void;

pub const getKey = glfwGetKey;
extern fn glfwGetKey(*Window, key: Key) Action;

Expand All @@ -942,9 +978,21 @@ extern fn glfwSetCursorPos(*Window, xpos: f64, ypos: f64) void;
pub const setWindowSizeLimits = glfwSetWindowSizeLimits;
extern fn glfwSetWindowSizeLimits(*Window, min_w: c_int, min_h: c_int, max_w: c_int, max_h: c_int) void;

pub const setWindowAspectRatio = glfwSetWindowAspectRatio;
extern fn glfwSetWindowAspectRatio(*Window, numer: c_int, denom: c_int) void;

pub const getWindowContentScale = glfwGetWindowContentScale;
extern fn glfwGetWindowContentScale(*Window, xscale: ?*f32, yscale: ?*f32) void;

pub const getWindowFrameSize = glfwGetWindowFrameSize;
extern fn glfwGetWindowFrameSize(*Window, left: ?*c_int, top: ?*c_int, right: ?*c_int, bottom: ?*c_int) void;

pub const getWindowOpacity = glfwGetWindowOpacity;
extern fn glfwGetWindowOpacity(*Window) f32;

pub const setWindowOpacity = glfwSetWindowOpacity;
extern fn glfwSetWindowOpacity(*Window, opacity: f32) void;

pub const getFramebufferSize = glfwGetFramebufferSize;
extern fn glfwGetFramebufferSize(*Window, width: ?*c_int, height: ?*c_int) void;

Expand Down
Loading