Commit graph

74 commits

Author SHA1 Message Date
Stephen Gutekanst
0645429df9 all: move standalone libraries to libs/ subdirectory
The root dir of our repository has grown quite a lot the past few months.

I'd like to make it more clear where the bulk of the engine lives (`src/`) and
also make it more clear which Mach libraries are consumable as standalone projects.

As for the name of this directory, `libs` was my first choice but there's a bit of
a convention of that being external libraries in Zig projects _today_, while these
are libraries maintained as part of Mach in this repository - not external ones.

We will name this directory `libs`, and if we have a need for external libraries
we will use `external` or `deps` for that directory name. I considered other names
such as `components`, `systems`, `modules` (which are bad as they overlap with
major ECS / engine concepts), and it seems likely the official Zig package manager
will break the convention of using a `libs` dir anyway.

Performed via:

```sh
mkdir libs/
git mv freetype libs/
git mv basisu libs/
git mv gamemode libs/
git mv glfw libs/
git mv gpu libs/
git mv gpu-dawn libs/
git mv sysaudio libs/
git mv sysjs libs/
git mv ecs libs/
```

git-subtree-dir: glfw
git-subtree-mainline: 0d5b853443
git-subtree-split: 572d1144f11b353abdb64fff828b25a4f0fbb7ca

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

git mv ecs libs/

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-26 15:12:04 -07:00
Stephen Gutekanst
9cffe5ac8b glfw: add assumeInitialized for external GLFW initialization
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-07-30 10:18:47 -07:00
alichraghi
48a4b9a7a6 glfw: use refAllDeclsRecursive to find mistakes 2022-07-20 18:55:59 -07:00
PiergiorgioZagaria
0e8b53d840 glfw: allow to choose platform in InitHints 2022-06-29 20:54:04 -07:00
PiergiorgioZagaria
7bb877bd55
glfw: support compiling with stage2 (-fno-stage1) (#365) 2022-06-24 10:12:45 -07:00
Caleb Gingles
e87d278f45
glfw: make MouseButton directly accessible, to match GLFW callback signature (#353) 2022-06-14 20:03:26 -07:00
Stephen Gutekanst
5b4b31de13 glfw: update core APIs to glfw@master
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-06-11 17:39:25 -07:00
Stephen Gutekanst
d61362d8fb glfw: expose Native BackendOptions
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-02-26 23:34:17 -07:00
Lee Cannon
2e9347399d glfw: dont use @errSetCast 2022-02-08 19:58:52 -07:00
Lee Cannon
3e79a12f3d glfw: dont call getError unless we need to 2022-02-08 19:57:20 -07:00
Ali Chraghi
494eb81b56
glfw: expose glfwSetErrorCallback for retrieving optional error descriptions 2021-12-25 11:32:12 -07:00
iddev5
4f35c578a0 glfw: Add ziggified API of glfw3native.h 2021-12-23 00:57:29 -07:00
InKryption
b8c913cd6c glfw: remove TODOs 2021-12-08 19:30:01 -08:00
InKryption
3648d6b9c4
glfw: Denormalize errors (#115)
Closes hexops/mach#96

Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
2021-12-06 21:52:15 -07:00
InKryption
1d648c2256 glfw: Eliminate Error.InvalidValue 2021-11-26 20:50:38 -07:00
InKryption
fb0c695bd1 glfw: Eliminate InvalidEnum 2021-11-24 05:14:48 -07:00
InKryption
88e0d37325 glfw: enum-ify 'Joystick.jid', set 'InvalidEnum' as unreachable, and run zig fmt 2021-11-22 12:59:11 -07:00
InKryption
d9e2505b59 glfw: amend and update various TODOs pertaining to force-init changes 2021-11-22 12:59:11 -07:00
InKryption
ef7ada052c glfw: Revert error denormalization 2021-11-22 12:59:11 -07:00
InKryption
44fee8f1f1 glfw: force init error type work around 2021-11-22 12:59:11 -07:00
InKryption
c6310dc377 glfw: force init in main.zig 2021-11-22 12:59:11 -07:00
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
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
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
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
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
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
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
3e466da662 glfw: add glfw.key.getName
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-23 19:33:33 -07:00
Stephen Gutekanst
9d95c18d4c glfw: add glfw.rawMouseMotionSupported
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-22 00:35:34 -07:00
Stephen Gutekanst
7d9b626b11 glfw: move remaining input TODOs to final locations
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-22 00:35:34 -07:00
Stephen Gutekanst
06fefd4026 glfw: rename joystick -> Joystick; add Joystick.getGamepadState
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-22 00:35:34 -07:00
Stephen Gutekanst
fcbfe70c66 glfw: add glfw.postEmptyEvent
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-16 18:39:57 -07:00
Stephen Gutekanst
6a124e35f9 glfw: add glfw.waitEvents, glfw.waitEventsTimeout
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-16 18:39:57 -07:00
Stephen Gutekanst
522f26e15f glfw: add glfw.pollEvents
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-16 18:39:57 -07:00
Stephen Gutekanst
41c2ef44c1 glfw: add TODOs for tracking 100% GLFW API coverage
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-16 18:39:57 -07:00
Stephen Gutekanst
4f1c6d1b58 glfw: add Image type
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-20 21:00:05 -07:00
Stephen Gutekanst
a9446f4ed6 glfw: add Window.shouldClose
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-18 21:57:46 -07:00
Stephen Gutekanst
badc8939b5 glfw: add Window.destroy
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-18 21:45:25 -07:00
Stephen Gutekanst
04a213b411 glfw: cleanup two tests
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-18 21:37:05 -07:00
Stephen Gutekanst
c2af312200 glfw: use Window.create in basic test
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-18 21:36:14 -07:00
Stephen Gutekanst
441d8d7928 glfw: add Window.defaultHints
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-18 17:47:07 -07:00
Stephen Gutekanst
b5d1ebd1cd glfw: window open test is optional (cannot open windows on CI)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-18 15:38:53 -07:00
Stephen Gutekanst
ceabcec7a3 glfw: add GammaRamp type
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-17 21:29:51 -07:00
Stephen Gutekanst
72f09b4f32 glfw: fix and test VideoMode getters
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-17 20:56:48 -07:00
Stephen Gutekanst
5238e52d76 glfw: add Monitor.setGamma; return concrete Error types
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-17 20:50:41 -07:00
Stephen Gutekanst
b76e8d02f2 glfw: deduplicate @cImport for type equivalence
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-07-17 20:14:09 -07:00