Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various compile errors #13

Merged
merged 2 commits into from
Jan 17, 2025
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
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,7 +677,7 @@ 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;
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 All @@ -796,15 +799,15 @@ pub const setWindowSizeCallback = glfwSetWindowSizeCallback;
extern fn glfwSetWindowSizeCallback(*Window, ?WindowSizeFn) ?WindowSizeFn;
pub const WindowSizeFn = *const fn (*Window, width: c_int, height: c_int) callconv(.C) void;

pub const setPosCallback = glfwSetWindowPosCallback;
pub const setWindowPosCallback = glfwSetWindowPosCallback;
extern fn glfwSetWindowPosCallback(*Window, ?WindowPosFn) ?WindowPosFn;
pub const WindowPosFn = *const fn (*Window, x: c_int, y: c_int) callconv(.C) void;

pub const setFocusCallback = glfwSetWindowFocusCallback;
pub const setWindowFocusCallback = glfwSetWindowFocusCallback;
extern fn glfwSetWindowFocusCallback(*Window, ?WindowFocusFn) ?WindowFocusFn;
pub const WindowFocusFn = *const fn (*Window, focused: Bool) callconv(.C) void;

pub const setIconifyCallback = glfwSetWindowIconifyCallback;
pub const setWindowIconifyCallback = glfwSetWindowIconifyCallback;
extern fn glfwSetWindowIconifyCallback(*Window, ?IconifyFn) ?IconifyFn;
pub const IconifyFn = *const fn (*Window, iconified: Bool) callconv(.C) void;

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
Loading