Commit graph

669 commits

Author SHA1 Message Date
Stephen Gutekanst
353cf6144b mach: update to latest ECS module layout
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
85ffb37156 mach: handle exit via module globals
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
f153133c30 {mach,ecs}: pass World to ECS event handlers
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
15e6f81df8 mach: prepare to handle ECS init via modules
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
2879ad58b0 ecs: replace world.tick() with generic world.send(.tick) message passing
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-03-27 09:29:47 -07:00
Stephen Gutekanst
3ff4bcc2a3 mach: finish splitting Core and Engine
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-24 18:14:52 -07:00
Stephen Gutekanst
9bbada90b2 {mach,core}: move core sources to libs/core
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-24 18:14:52 -07:00
Ali Chraghi
192cacb85d mach: put logFn function to std_options 2023-01-20 14:53:22 -07:00
Stephen Gutekanst
0eaa56b4ad mach: platform/libmach: update to latest mach/core API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-17 09:49:40 -07:00
Stephen Gutekanst
a15b9bb5f6 mach: platform/wasm: correct return signature
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-17 09:49:40 -07:00
Stephen Gutekanst
8082228186 mach: eliminate heap allocation of Core
Prior to this change `mach.Core.init` would heap allocate the structure, returning `*Core`:

```zig
app.core = try mach.Core.init(allocator, .{});
```

This was obviously not ideal, but wasn't possible to eliminate before due to how Core was
entangled with the platform abstraction. Now that it has been removed, we can reduce Core
initialization to take a `*Core` to initialize. In practice this means initialization looks
something like this:

```zig
try mach.Core.init(&app.core, alloctor, .{});
```

Or more simply:

```zig
try app.core.init(allocator, .{});
```

And we eliminate the `*Core` allocation entirely in most cases.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-17 09:49:40 -07:00
Ali Chraghi
2fd8e876fd mach: re-create swapchain on vsync mode change 2023-01-15 09:45:17 -07:00
Ali Chraghi
10d5f344e3 {glfw,mach}: remove dead code 2023-01-15 08:31:26 -07:00
Ali Chraghi
a52c6e5f5c gpu: update interface to latest webgpu headers 2023-01-14 12:12:00 -07:00
Ali Chraghi
a97a33334c {mach, gpu-dawn}: don't hardcode linux window manager to X11 2023-01-12 10:51:16 -07:00
Ali Chraghi
1d7cd4be80 mach: fundamental changes
- Core doesn't depend to `App` anymore
 - `setOptions` has replaced with some new functions (`setTitle`,
   `setSize`, etc)
   - and more
2023-01-12 01:54:48 -07:00
Lue
91a53807ab mach: fix outdated reference to glfw.Error 2023-01-10 20:52:41 -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
2cd4ce12f2 mach: update to latest GLFW error handling approach
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-01-08 18:21:11 -07:00
Ali Chraghi
b8deaf8010 mach: add borderless_window option 2022-12-28 11:47:51 -07:00
Ali Chraghi
c26592ea89 mach: render during resize 2022-12-28 11:47:51 -07:00
Beau McCartney
7d04252126
mach: remove compiler error for missing field in app (upstream issue fixed) (#647)
* platform: allow fieldless App
* platform: remove unused field

Co-authored-by: Beau McCartney <beau@beaumccartney.xyz>
2022-12-25 13:37:23 -07:00
citruslee
0e67b92676
mach: fix compiler error about missing field_type (#644) 2022-12-22 11:50:26 -07:00
Ali Chraghi
457986bb33 mach: fix compilation on latest zig 2022-12-18 18:02:31 -07:00
BratishkaErik
b1191cbeb5
{mach,gpu}: more undef/nul -> undefined/null renames (#638)
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2022-12-14 18:20:11 -07:00
Eric Joldasov
e832784e6b mach: use null and undefined in enums
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2022-12-14 02:18:21 -07:00
Keith Chambers
c151222011
mach: VertexWriter fixes (#633)
* mach: VertexWriter fixes
* mach: Reference decls in gfx
* remove comptime block from refAllDecls as is redundant
2022-11-30 09:27:00 -07:00
Keith Chambers
f331597bc2
mach: gfx: Add VertexWriter (#630) 2022-11-28 22:29:50 -07:00
dasimmet
caafb26fe4
mach: add option to set the monitor index on fullscreen (#611)
* add option to set the monitor index on fullscreen
* make monitor index optional

Co-authored-by: Tobias Simetsreiter <tobias.simetsreiter@meliot.de>
2022-11-14 15:46:42 -07:00
Stephen Gutekanst
212c902747 mach: test ResourceManager
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-05 14:12:56 -07:00
Stephen Gutekanst
030cbf71a1 mach: resource: update function pointer declarations
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-11-05 13:32:18 -07:00
Stephen Gutekanst
6a45971c6f trimesh2d: remove in favor of mach/earcut library
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-31 12:12:01 -07:00
Stephen Gutekanst
96c2e35ab3 all: integrate earcut library
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-31 12:12:01 -07:00
Ali Chraghi
a27121c00a mach: implement setCursorMode for wasm 2022-10-21 07:43:34 -07:00
Stephen Gutekanst
af357c0a8a mach: expose trimesh2d package
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-19 07:30:11 -07:00
Stephen Gutekanst
e0e0a6d0bb mach: update wasm root.panic signature for latest Zig version
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-14 17:58:34 -07:00
Martin Wickham
78dfa2df6b mach: add setCursorMode (desktop only for now) 2022-10-14 09:23:49 -07:00
Stephen Gutekanst
c94dee263b mach: correct WebGPU C ABI export
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-11 01:06:59 +02:00
Ali Chraghi
58f7121a3d all: prefix environment variables with MACH_ 2022-10-11 00:59:23 +02:00
Stephen Gutekanst
4e47477e9a mach: export WebGPU C ABI compatibility
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-10-11 00:55:46 +02:00
Dustin Taylor
cc301493ca mach: 0 size swapchain noop fix 2022-09-25 10:01:03 -07:00
Stephen Gutekanst
8026526b99 mach: add TODO about self-hosted unused variables 2022-09-20 02:30:45 -07:00
Ali Chraghi
9f6c4bf7b1 build: fix compilation errors
this should make linux CI green
2022-09-20 02:30:45 -07:00
Ali Chraghi
2811904eac mach: check Platform functions declaration & add deinit for wasm 2022-09-19 20:11:55 -07:00
Stephen Gutekanst
12c8d9ae8a mach: correct Wayland comment
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-09-19 06:57:16 -07:00
Ali Chraghi
15dfb2867a all: rename setShouldClose to close
Closes #550
2022-09-18 09:50:15 -07:00
Stephen Gutekanst
412df4490c mach: fmt
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-09-17 08:50:25 -07:00
Ali Chraghi
6043c7eae6
mach: add is_app option to disable gamemode in desktop applications; use parseIp4 (#544)
* mach: add `is_app` option to disable gamemode in desktop applications
* use parseIp4 instead of resolveIp (which throws a compile error in windows)
2022-09-16 23:32:27 -07:00
LeRoyce Pearson
47d1544b64
{mach,sysjs}: put WASM imports into their own namespaces (#537) 2022-09-16 16:56:22 -07:00
Louis Pearson
6183e39593
mach: add {s} formatter to mouse cursor debug print (#539)
* Fix setMouseCursor compile error
2022-09-16 16:42:19 -07:00