Commit graph

208 commits

Author SHA1 Message Date
InKryption
e183711e5e glfw: Make enum value name the same format as other enum value names 2021-11-15 15:37:07 -07:00
InKryption
d91d9311ed glfw: Publicize Window.CursorPos, Window.Size, Window.Pos, and Window.FrameSize 2021-11-15 15:37:07 -07:00
InKryption
9bb3803657 glfw: make comments into doc comments 2021-11-15 15:37:07 -07:00
InKryption
82c5079d1d glfw: Update tests in all other files to reflect changes made to glfw.init 2021-11-10 11:42:24 -07:00
InKryption
025b91ecb0 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
f340d04eca 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
b87ef62856 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
b96fd437a3 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
30abe0c960 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
2f84bac544 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
27097fee9c 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
2f9772d36c 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
79fa9f2929 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
93200dbe00 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
be9bbe8f21 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
9adc84f638 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
5b4743215d 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
21fe561393 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
1158c52f0c 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
1c8bb772c0 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
d951a47348 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
fc6ac619c3 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
4241da22ed 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
987d52e6f9 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
bb18c20e00 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
36bbd817af 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
7b5caa5d7c 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
2c03f286ee 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
64b50ebd56 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
9f40ee4441 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
18226db9fd 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
cc4595eb37 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
6aaf0b7a68 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
457c9394ab 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
91e80234bb glfw: correct clipboard test
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 08:55:26 -07:00
Stephen Gutekanst
01eca3baea 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
159bcb0255 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
d6fe083308 glfw: correct typo in constant name
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 22:12:56 -07:00
Stephen Gutekanst
2fcb17dc8e 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
39362c7cd0 glfw: add glfw.Window.getInputMode
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
34612df98b glfw: add glfw.Window.setInputMode
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
6120236d85 glfw: add glfw.Window.getKey
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
c5b3eed9e4 glfw: add glfw.Window.getMouseButton
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
63d68f8c19 glfw: add glfw.Window.getCursorPos
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
1000d55043 glfw: add glfw.Window.setCursorPos
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
96c2632764 glfw: add Window.setCursor
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
c3b7a80658 glfw: correct test order
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
8ff62d8cdf glfw: add glfw.Window.setKeyCallback
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
eb34abdb88 glfw: add glfw.Window.setCharCallback
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
0c31bb56ca glfw: add glfw.Window.setMouseButtonCallback
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00