Skip to content

Commit

Permalink
Fix various compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
simeks committed Jan 12, 2025
1 parent f3f35b3 commit 9b901c4
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/zglfw.zig
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,14 @@ pub fn createCursor(width: i32, height: i32, pixels: []const u8, xhot: i32, yhot
};
if (glfwCreateCursor(&image, xhot, yhot)) |ptr| return ptr;
try maybeError();
unreachable;
}
extern fn glfwCreateCursor(image: *const Image, xhot: c_int, yhot: c_int) ?*Cursor;

pub fn createStandardCursor(shape: Cursor.Shape) Error!*Cursor {
if (glfwCreateStandardCursor(shape)) |ptr| return ptr;
try maybeError();
unreachable;
}
extern fn glfwCreateStandardCursor(shape: Cursor.Shape) ?*Cursor;

Expand Down Expand Up @@ -544,9 +546,9 @@ pub const Monitor = opaque {
pub const getVideoMode = zglfw.getVideoMode;
pub const getVideoModes = zglfw.getVideoModes;

pub fn getPos(self: Monitor) []f32 {
var xpos: i32 = 0;
var ypos: i32 = 0;
pub fn getPos(self: *Monitor) [2]c_int {
var xpos: c_int = 0;
var ypos: c_int = 0;
getMonitorPos(self, &xpos, &ypos);
return .{ xpos, ypos };
}
Expand Down Expand Up @@ -581,6 +583,7 @@ pub fn getVideoMode(monitor: *Monitor) Error!*VideoMode {
return video_mode;
}
try maybeError();
unreachable;
}
extern fn glfwGetVideoMode(*Monitor) ?*VideoMode;

Expand Down Expand Up @@ -674,11 +677,11 @@ pub const Window = opaque {
pub const setAttribute = zglfw.setWindowAttribute;
pub const getUserPointer = zglfw.getWindowUserPointer;
pub const setUserPointer = zglfw.setWindowUserPointer;
pub const setFramebufferCallback = zglfw.setFramebufferCallback;
pub const setFramebufferCallback = zglfw.setFramebufferSizeCallback;
pub const setSizeCallback = zglfw.setWindowSizeCallback;
pub const setPosCallback = zglfw.setWindowPosCallback;
pub const setFocusCallback = zglfw.setWindowFocusCallback;
pub const setIconifyCallback = zglfw.setWindowIconifyCallback;
pub const setPosCallback = zglfw.setPosCallback;
pub const setFocusCallback = zglfw.setFocusCallback;
pub const setIconifyCallback = zglfw.setIconifyCallback;
pub const setContentScaleCallback = zglfw.setWindowContentScaleCallback;
pub const setCloseCallback = zglfw.setWindowCloseCallback;
pub const setKeyCallback = zglfw.setKeyCallback;
Expand Down Expand Up @@ -771,7 +774,7 @@ extern fn glfwGetWindowAttrib(window: *Window, attrib: Window.Attribute) c_int;
pub fn setWindowAttribute(
window: *Window,
comptime attrib: Window.Attribute,
value: Window.Attribute(attrib),
value: Window.Attribute.ValueType(attrib),
) void {
setWindowAttributeUntyped(window, cIntCast(attrib), value);
}
Expand Down Expand Up @@ -858,7 +861,7 @@ extern fn glfwSetWindowMonitor(
pub const showWindow = glfwShowWindow;
extern fn glfwShowWindow(*Window) void;

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

pub const getKey = glfwGetKey;
Expand Down Expand Up @@ -900,7 +903,7 @@ pub fn setWindowTitle(window: *Window, title: [:0]const u8) void {
extern fn glfwSetWindowTitle(*Window, title: [*:0]const u8) void;

pub fn setWindowIcon(window: *Window, images: []const Image) void {
glfwSetWindowIcon(window, images.items.len, images.ptr);
glfwSetWindowIcon(window, @intCast(images.len), images.ptr);
}
extern fn glfwSetWindowIcon(*Window, count: c_int, images: [*]const Image) void;

Expand Down

0 comments on commit 9b901c4

Please sign in to comment.