Commit graph

452 commits

Author SHA1 Message Date
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
2b4b06cf7b glfw: workaround framework dependency inclusion bug for now
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 12:31:28 -07:00
Stephen Gutekanst
3856c1c95e CI: update to latest Zig nightly 1444+e2a2e6c14
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 12:31:28 -07:00
Stephen Gutekanst
1fa2c51e52 glfw: CI: update to latest Zig nightly 1444+e2a2e6c14
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 12:31:28 -07:00
Stephen Gutekanst
3d38f56af6
glfw: do not set sysroot (prevents linking libs not in our system SDKs) (#47)
* glfw: do not set sysroot (prevents linking libs not in our system SDKs)

Fixes hexops/mach#40

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 21:14:13 -07:00
Stephen Gutekanst
8466a5ff08
CI: add build matrix for projects (#46)
* CI: add build matrix for projects

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 18:32:57 -07:00
Stephen Gutekanst
a0677ea6a5 glfw: add intermediate static lib
Previously, @Avokadoen and @mattnite ran into issues including the GLFW library
in other projects, e.g. https://github.com/Avokadoen/zig_vulkan/issues/17

In #24 we removed the intermediate static library, which solved the issue. The
problem is that when the function is invoked in the directory of the project
including GLFW, then our code:

```
const lib = b.addStaticLibrary("glfw", "src/main.zig");
```

Would refer to the project's `src/main.zig` -- not the GLFW library `main.zig`.

Although removing the intermediate lib worked around the issue, it created a
new one - slower compilation: hexops/mach#31

This fixes the issue by ensuring that the path we pass to `addStaticLibrary` is
in fact absolute, not relative.

Fixes hexops/mach#31

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 13:55:52 -07:00
Stephen Gutekanst
668499b10a glfw: build: eliminate duplicative arena allocator
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 13:42:20 -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
4850648a2e README: correct CI status badge
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 08:54:44 -07:00
Stephen Gutekanst
67be18a470 glfw: correct CI status badge in README
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 08:53:59 -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
Stephen Gutekanst
833f615dc9 glfw: cleanup CI pipeline
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 08:46:14 -07:00
Stephen Gutekanst
15a3315fc8 glfw: cleanup README, explain how to use Vulkan/OpenGL with it
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 07:47:05 -07:00
Stephen Gutekanst
c0fd37a919
Merge pull request #43 from hexops/sg/pull-glfw
sync sub repositories
2021-10-24 07:31:18 -07:00
Stephen Gutekanst
dd43b1468b Merge commit '3d19b4993c' into main 2021-10-24 07:20:06 -07:00
Stephen Gutekanst
02654a51c7
move GLFW into sub-repository, use git subtree to sync (#42)
* README: move GLFW into sub-repository, describe git subtree usage

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>

* dev: add subrepo sync scripts

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 07:19:38 -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
3d19b4993c
glfw: README: cleanup 2021-10-24 05:50:56 -07:00
Stephen Gutekanst
63f29665ff glfw: update README
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 05:48:08 -07:00
Stephen Gutekanst
d0cf9fccf2 glfw: cleanup vulkan_headers
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 05:20:30 -07:00
Stephen Gutekanst
453b763ebd glfw: mv glfw/* .
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 05:20:27 -07:00
Stephen Gutekanst
3d71f9959f glfw: split into its own repo
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 05:20:27 -07:00
Stephen Gutekanst
ce747b7fdc glfw: rm -rf webgpu/
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-24 05:20:24 -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