Commit graph

18 commits

Author SHA1 Message Date
Stephen Gutekanst
22edd4fb9d glfw: 100% usable via package manager
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-07-07 15:55:24 -07:00
thedoctorquantum
364a66ef2a glfw: Fixed all uses of the alignCast builtin 2023-06-29 18:57:01 -07:00
Stephen Gutekanst
4bc32adeb8 all: update to latest Zig APIs (zig fmt)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-29 09:54:32 -07:00
Stephen Gutekanst
29964c99bb update to latest Zig (zig fmt)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-25 00:01:55 -07:00
xdBronch
dcba9c7bb2 glfw: set raw_mouse_motion to true if cursor is disabled 2023-06-03 11:35:19 -07:00
Stephen Gutekanst
4c22106ecb glfw: fix setIcon pointer constness
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-06-02 02:02:24 -07:00
Casey Banner
5aecbb0ee6
glfw: update to new for loop syntax (#711) 2023-03-01 18:32:21 -07:00
Lue
eed2be4591 glfw: refactor getError and related functions
`getError()` now returns a struct `Error` containing `error_code` and
`description`. Rationale: retrieving the error code with the previous
implementation of `getError()` caused `getErrorString()` to return
null (the reverse is also true). The new implementation allows both
values to be retrieved at once.

The previous `getError()` function has been renamed to
`getErrorCode()` to reflect the fact that it returns a simple Zig
error rather than the `Error` struct. The error set returned by
`getErrorCode()` is now named `ErrorCode` rather than `Error`.

The behavior of the `getError()` family of functions clearing the
stored error is unchanged. However, since all code that used
`defer glfw.getError() catch {}` to explicitly clear errors had to be
refactored, a new `glfw.clearError()` function that returns void is
now available to make this operation more explicit.

Additionally, `mustGetError()` is now `mustGetErrorCode()`, and new
functions `mustGetError()` and `mustGetErrorString()` have been added
which wrap `getError()` and `getErrorString()` but panic if no error
is actually available.

Tests and API documentation had to be refactored across all of
`mach/glfw`. This commit also takes the opportunity to skip tests
involving window creation on CI so that other tests may still execute
normally.
2023-01-10 20:52:41 -07:00
Stephen Gutekanst
abb1077052 glfw: rework error handling system to prevent footguns
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-08 18:21:11 -07:00
Ali Chraghi
69cbe954ac glfw: undo setSizeLimits workaround 2022-12-28 11:47:51 -07:00
Ali Chraghi
03431acf4a glfw: accept null cursor in Window.setCursor 2022-12-28 11:47:51 -07:00
Keith Chambers
c9793a4666
glfw: update to zig 0.11.0-dev.811 (#640) 2022-12-15 16:47:19 -07:00
Stephen Gutekanst
661ac75a31 glfw: zig fmt (true and false no longer reserved names)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-24 09:55:07 -07:00
Stephen Gutekanst
d694b8031a glfw: ensure Window.from handle is untyped
Since users of the library do not have access to the `@cImport` struct (and we
do not want to expose that), the user may pass only an untyped `*anyopaque` pointer
which we'll internally cast to `*c.GLFWwindow`.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-06 15:02:57 -07:00
Stephen Gutekanst
03590dede5 glfw: workaround self-hosted compiler bug
Helps hexops/mach#581

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-15 00:57:35 -07:00
Ali Chraghi
82e10f4f28
all: build: thisDir improvements (#570)
* build:all: thisDir improvements

more performant output, usage code reducement and compileError for wrong usage

* glfw: update deprecated code
2022-09-29 08:41:46 -07:00
Ali Chraghi
f1c74aabe2 glfw: don't reset hints after window creation
Closes #201
2022-09-17 07:03:04 -07:00
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
Renamed from glfw/src/Window.zig (Browse further)