Skip to content

Commit ceecb8a

Browse files
author
Jonathan Cancelli
committed
Add setMonitorUserPointer and getMonitorUserPointer functions
1 parent 4309f3e commit ceecb8a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/zglfw.zig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,8 @@ pub const Monitor = opaque {
618618
pub const getVideoMode = zglfw.getVideoMode;
619619
pub const getVideoModes = zglfw.getVideoModes;
620620
pub const getPhysicalSize = zglfw.getMonitorPhysicalSize;
621+
pub const getUserPointer = zglfw.getMonitorUserPointer;
622+
pub const setUserPointer = zglfw.setMonitorUserPointer;
621623

622624
pub fn getPos(self: *Monitor) [2]c_int {
623625
var xpos: c_int = 0;
@@ -665,6 +667,16 @@ pub fn getMonitorName(monitor: *Monitor) Error![]const u8 {
665667
}
666668
extern fn glfwGetMonitorName(monitor: *Monitor) ?[*:0]const u8;
667669

670+
pub fn getMonitorUserPointer(monitor: *Monitor, comptime T: type) ?*T {
671+
return @ptrCast(@alignCast(glfwGetMonitorUserPointer(monitor)));
672+
}
673+
extern fn glfwGetMonitorUserPointer(monitor: *Monitor) callconv(.c) ?*anyopaque;
674+
675+
pub fn setMonitorUserPointer(monitor: *Monitor, pointer: ?*anyopaque) void {
676+
glfwSetMonitorUserPointer(monitor, pointer);
677+
}
678+
extern fn glfwSetMonitorUserPointer(monitor: *Monitor, pointer: ?*anyopaque) callconv(.c) void;
679+
668680
pub const MonitorFn = *const fn (monitor: *Monitor, event: Monitor.Event) callconv(.c) void;
669681
pub const setMonitorCallback = glfwSetMonitorCallback;
670682
extern fn glfwSetMonitorCallback(callback: ?MonitorFn) ?MonitorFn;

0 commit comments

Comments
 (0)