-
Notifications
You must be signed in to change notification settings - Fork 31
Add missing Window bindings #38
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
762ccb8
Added binding for `glfwSetWindowAspectRatio`
Fincap d0d9ea2
Added binding for `glfwGetWindowFrameSize`
Fincap 97634e1
Added binding for `glfwGetWindowOpacity`
Fincap 317d928
Added binding for `glfwSetWindowOpacity`
Fincap 67dfcfd
Added binding for `glfwIconifyWindow`
Fincap 98d587f
Added binding for `glfwRestoreWindow`
Fincap 1d22f30
Added binding for `glfwMaximizeWindow`
Fincap d3a43bd
Added binding for `glfwHideWindow`
Fincap 1666f6e
Added binding for `glfwRequestWindowAttention`
Fincap 8f87f18
Added binding for `glfwPostEmptyEvent`
Fincap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
| } | ||
|
|
@@ -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; | ||
|
|
@@ -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; | ||
| 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
|
||
|
|
@@ -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; | ||
|
|
||
|
|
@@ -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; | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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. Use0instead of0.0for c_int variables.