Silver
673ce14acf
glfw: remove [*c] pointers from api and return lengthed strings when possible
2021-11-16 07:12:02 -07:00
InKryption
28a0aebd95
glfw: window hints rework ( #71 )
...
* glfw: make comments into doc comments
* glfw: Publicize Window.CursorPos, Window.Size, Window.Pos, and Window.FrameSize
* glfw: Make enum value name the same format as other enum value names
* glfw: Window hints rework patch
* glfw: Relegate `Window.hint` to testing; move it down to just above the tests to reflect this, add doc comment line
* glfw: handle error `Error.InvalidEnum` explicitly, for clear error message in this unlikely edge case
* glfw: instate `Hint.context_no_error` as a hint, as it actually is specified to be a Window creation hint by the docs, and affirm removal of `Hint.context_revision`, which isn't.
The docs don't seem to specify a default value for `Hints.context_no_error` to take on, so we could set it based on `std.debug.runtime_safety` like this.
* glfw: default `context_no_error` to `false`, and added a note of caution about its usage as suggested.
* glfw: Inline enum values of `ClientApi`, `ContextCreationApi`, `ContextRobustness`, `ContextReleaseBehavior`, and `OpenGlProfile` from consts.zig, and remove the now unused constants (replaced by aformentioned enum values).
* glfw: Reference `Window.Hint` enum instead of `Window.Hints` struct to ensure fields are the same
* glfw: add comment explaining default values of `Window.Hints`
* glfw: change `OpenGlProfile` to `OpenGLProfile` based on established naming convention
* glfw: Update actual declaration of `OpenGLProfile`
* glfw: call `Window.defaultHints` after window creation, not before
* glfw: remove 'consts.zig', and move `dont_care` directly into 'main.zig'; fix anything referencing it.
* glfw: put `Window.defaultHints` into defer statement to handle cleanup in all paths
* glfw: move `Hint.focused` to match position of `Hints.focused`
* glfw: do 'zig fmt glfw/src'
* glfw: Cull `Window.Hint` comments, polish remaining; match order entirely according to current GLFW docs
* glfw: Change `Window.Hints.*Api` to `Window.Hints.*API`
Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2021-11-15 18:41:16 -07:00
InKryption
e486794be3
glfw: Make enum value name the same format as other enum value names
2021-11-15 15:37:07 -07:00
InKryption
eef166e90b
glfw: Publicize Window.CursorPos, Window.Size, Window.Pos, and Window.FrameSize
2021-11-15 15:37:07 -07:00
InKryption
2214e91ad5
glfw: make comments into doc comments
2021-11-15 15:37:07 -07:00
InKryption
f00367e696
glfw: Update tests in all other files to reflect changes made to glfw.init
2021-11-10 11:42:24 -07:00
InKryption
e9175fb9f1
glfw: change init function to accept hints as paramaters via new InitHints struct which has default field values reflecting the default values specified by GLFW current documentation, privatize hint-setting wrapper API, and update tests
2021-11-10 11:42:24 -07:00
Stephen Gutekanst
9bc9984930
glfw: hot patch undefined behavior in GLFW that went unnoticed 6+ years
...
Upstream pull request: https://github.com/glfw/glfw/pull/1986
Article: https://devlog.hexops.com/2021/perfecting-glfw-for-zig-and-finding-undefined-behavior
Fixes hexops/mach#20
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-31 11:50:09 -07:00
Stephen Gutekanst
c16d6bf615
glfw: improve ABI compatability with zig-vulkan library
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-31 01:00:02 -07:00
Stephen Gutekanst
7264741ede
glfw: make init hints a proper enum
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
f1644d2e59
glfw: make monitor/joystick events a proper enum
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
bec6f7a85b
glfw: add [set|get]InputModeRawMouseMotion variants
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
9d642c199f
glfw: add [set|get]InputModeLockKeyMods variants
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
02240a7f92
glfw: add [set|get]InputModeStickyMouseButtons variants
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
d222c44d8f
glfw: add setInputModeStickyKeys/getInputModeStickyKeys variants
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
d3307266aa
glfw: add setInputModeCursor/getInputModeCursor variants
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
7806709a90
glfw: make mouse buttons a proper enum
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
4d1b92666b
glfw: expose aliased gamepad axis/button constants
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
8c36ea36f8
glfw: identify remaining constants for enumification
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
82a4d02397
glfw: remove duplicated window hints (removed in 14964fa)
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
8df412ed90
glfw: make Window attributes a proper enum
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
65d8d2d10f
glfw: make Window hints a proper enum
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
2e6b73b388
glfw: make setKeyCallback use Key enum directly
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
f6f758859a
glfw: make setMouseButtonCallback use Mods bitmask directly
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
0beaedd263
glfw: add Hat.toInt / Hat.fromInt tests, fix bug
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
2897061ffd
glfw: make Hat.fromInt, Hat.toInt work on non-5-bit integers
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
7cc850982f
glfw: fix failing Mod bitmask tests, make fromInt/toInt work on non-6-bit integers
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
60eeae4904
glfw: make Window.setKeyCallback use Mods packed struct directly
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
ab01edee1c
glfw: glfw.mod.Mods -> glfw.Mods, etc. & fix test compilation
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
32fa90eca9
glfw: ziggify Joystick hat bitmasks
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
210e12a437
glfw: ziggify gamepad button enumerations
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
2154ee5aea
glfw: ziggify gamepad action enumerations
...
Helps hexops/mach#37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-30 20:06:03 -07:00
Stephen Gutekanst
8a14d56fc3
glfw: ziggify all Action enums
...
Make the GLFW action enumerations proper Zig enums so one can use `.Name` syntax, etc.
Helps #37
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 21:27:20 -07:00
Stephen Gutekanst
ed10bebf99
glfw: improve panic message for glfw.getInstanceProcAddress
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 17:13:21 -07:00
Stephen Gutekanst
ac4bfe5e0b
glfw: make glfw.getProcAddress conform to GLFW C ABI
...
Having `glfw.getProcAddress` conform to the GLFW C ABI is important as it is often
likely to be passed into libraries which expect exactly that ABI for OpenGL function
loading.
Fixes hexops/mach#52
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 17:13:21 -07:00
Stephen Gutekanst
8c31529f8a
glfw: make glfw.getInstanceProcAddress conform to GLFW C ABI
...
Having `glfw.getInstanceProcAddress` conform to the GLFW C ABI is important as it is often
likely to be passed into libraries which expect exactly that ABI, e.g. zig-vulkan.
Fixes hexops/mach#49
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 16:15:42 -07:00
Stephen Gutekanst
f911a0a22f
glfw: correct clipboard test
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 08:55:26 -07:00
Stephen Gutekanst
ebdf773c8e
glfw: make clipboard test fault-tolerent
...
Fixes #45
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 08:48:12 -07:00
Aksel Hjerpbakk
1a3f391891
glfw: enums ( #41 )
...
* move key values in an enum
* bitmask for key modifiers
* export Key type and move key fns
instead of exporting the key file, export Key enum.
functions related to the Key type are moved into the enum as well so that they get exported with the type
2021-10-24 06:23:20 -07:00
Stephen Gutekanst
388f3aa659
glfw: correct typo in constant name
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 22:12:56 -07:00
Stephen Gutekanst
d2d1f0b222
glfw: set input mode supported on all platforms in test
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
d23cd8e400
glfw: add glfw.Window.getInputMode
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
79a2784093
glfw: add glfw.Window.setInputMode
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
53519d94af
glfw: add glfw.Window.getKey
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
77e9396888
glfw: add glfw.Window.getMouseButton
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
9aaa8702a8
glfw: add glfw.Window.getCursorPos
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
493a444ae5
glfw: add glfw.Window.setCursorPos
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
d50d84f935
glfw: add Window.setCursor
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
bad1b9f246
glfw: correct test order
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
888cd5ade6
glfw: add glfw.Window.setKeyCallback
...
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00