Skip to content
Merged
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
14 changes: 14 additions & 0 deletions src/zglfw.zig
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ pub const Monitor = opaque {
pub const getName = zglfw.getMonitorName;
pub const getVideoMode = zglfw.getVideoMode;
pub const getVideoModes = zglfw.getVideoModes;
pub const getPhysicalSize = zglfw.getMonitorPhysicalSize;

pub fn getPos(self: *Monitor) [2]c_int {
var xpos: c_int = 0;
Expand All @@ -566,6 +567,15 @@ pub fn getMonitors() []*Monitor {
}
extern fn glfwGetMonitors(count: *c_int) ?[*]*Monitor;

pub fn getMonitorPhysicalSize(monitor: *Monitor) Error![2]i32 {
var width_mm: c_int = undefined;
var height_mm: c_int = undefined;
glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm);
try maybeError();
return .{ width_mm, height_mm };
}
extern fn glfwGetMonitorPhysicalSize(*Monitor, width_mm: ?*c_int, height_mm: ?*c_int) void;

pub const getMonitorPos = glfwGetMonitorPos;
extern fn glfwGetMonitorPos(*Monitor, xpos: ?*c_int, ypos: ?*c_int) void;

Expand Down Expand Up @@ -691,6 +701,7 @@ pub const Window = opaque {
pub const setScrollCallback = zglfw.setScrollCallback;
pub const setCursorPosCallback = zglfw.setCursorPosCallback;
pub const setCursorEnterCallback = zglfw.setCursorEnterCallback;
pub const getMonitor = zglfw.getWindowMonitor;
pub const setMonitor = zglfw.setWindowMonitor;
pub const show = zglfw.showWindow;
pub const focus = zglfw.focusWindow;
Expand Down Expand Up @@ -853,6 +864,9 @@ pub const MouseButtonFn = *const fn (
mods: Mods,
) callconv(.C) void;

pub const getWindowMonitor = glfwGetWindowMonitor;
extern fn glfwGetWindowMonitor(window: *Window) ?*Monitor;

pub const setCursorPosCallback = glfwSetCursorPosCallback;
extern fn glfwSetCursorPosCallback(window: *Window, callback: ?CursorPosFn) ?CursorPosFn;
pub const CursorPosFn = *const fn (
Expand Down
Loading