Commit graph

252 commits

Author SHA1 Message Date
Stephen Gutekanst
1cc15e92a0 mach: add objc_message.zig dependency
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-20 12:03:17 -07:00
Stephen Gutekanst
192de6946e mach: improve compatibility with self-hosted compiler
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-20 12:02:01 -07:00
Stephen Gutekanst
72b081c97a mach: improve compatibility with self-hosted compiler
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-20 11:41:01 -07:00
Stephen Gutekanst
d03078fbd6 mach: fix conflicting symbol name (recent change in Zig)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-19 12:34:08 -07:00
Stephen Gutekanst
631d3eadbb {mach,gpu}: correct unused parameter
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-18 11:29:07 -07:00
Stephen Gutekanst
f5d34e1247 {mach,gpu}: fix accidental inclusion of objc/message.h on non-darwin platforms
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-18 11:22:51 -07:00
Stephen Gutekanst
eb0eceb707 mach: correct vsync mode setting
This correctly sets presentation modes for vsync, both at startup and at runtime via
a `setOptions` request.

Note: There may still be platforms where setting vsync is not enough, and a frame rate
limiter is needed to achieve proper synchronization. This is tracked in hexops/mach#444
and not fixed by this change.

Fixes hexops/mach#307

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-18 10:33:34 -07:00
Stephen Gutekanst
bac182f804 mach: update to latest mach/gpu API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-16 23:15:54 -07:00
Stephen Gutekanst
68d5f6fcb1 {mach,gpu}: add autorelease pool
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-16 17:05:15 -07:00
Stephen Gutekanst
78675470ae {mach,gpu}: rename GPU_BACKEND -> MACH_GPU_BACKEND
Per https://github.com/hexops/mach/issues/376#issuecomment-1170374460

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-12 14:54:09 -07:00
Ali Chraghi
9a79da0f69 mach: use optional specifier 2022-08-12 10:39:49 -07:00
Stephen Gutekanst
852d232335 mach: update callback context ordering
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-12 00:43:43 -07:00
Stephen Gutekanst
fa1ddc4f0d mach: correctly fire resize event on startup once again
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-12 00:43:43 -07:00
Stephen Gutekanst
5bd33af68f mach: update libmach to use new mach/gpu API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-12 00:43:43 -07:00
Stephen Gutekanst
2b354f9226 mach: add missing errdefer if GLFW window creation fails
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-12 00:43:43 -07:00
Stephen Gutekanst
85ddeeed5c mach: update to latest mach/gpu API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-12 00:43:43 -07:00
LeRoyce Pearson
f4611e1414
mach: add headless option (#450)
Co-authored-by: Stephen Gutekanst <stephen.gutekanst@gmail.com>
2022-08-06 19:38:04 -07:00
PiergiorgioZagaria
6eaacde444 gamemode: Add linux_gamemode_is_active field to Platform 2022-07-28 04:12:25 -07:00
PiergiorgioZagaria
d84a32363c gamemode: add check for GAMEMODE env var equal false 2022-07-28 04:12:25 -07:00
PiergiorgioZagaria
76bf493a86 gamemode: Small fix for initLinuxGamemode() 2022-07-28 04:12:25 -07:00
PiergiorgioZagaria
80270a5cfc gamemode: Move gamemode init and deinit into their own functions 2022-07-28 04:12:25 -07:00
PiergiorgioZagaria
509ebd13ab mach: Initial commit for gamemode 2022-07-28 04:12:25 -07:00
Ali Chraghi
b500b04c41 all: build: install tests exe 2022-07-25 11:21:37 -07:00
Stephen Gutekanst
1356cdd838 all: zig fmt
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-07-22 19:43:41 -07:00
Zachary Huang
8f6273c0d0 libmach: fix small issues and naming conventions 2022-07-20 18:59:29 -07:00
Zachary Huang
5d86314fbb libmach: update API again, factors out init/update/deinit from native.zig main function 2022-07-20 18:59:29 -07:00
Zachary Huang
77aecbe806 libmach: update API, exposes init, update, and deinit functions 2022-07-19 09:32:52 -07:00
Zachary Huang
9ece370059 libmach: initial API bindings for mach core 2022-07-14 22:44:44 -07:00
iddev5
dd0a6064fb mach: Cast window positions (i64) to i32 on window resize 2022-07-09 15:07:55 -07:00
iddev5
34514699a1 mach: wasm: Use default log level 2022-07-06 05:55:04 -07:00
Stephen Gutekanst
6ec27861b4 mach: initial support for high-level ECS applications
Adds experimental support for high-level ECS-based applications
following hexops/mach#349

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-07-04 22:25:39 -07:00
Stephen Gutekanst
72ea652dca mach: require a 'pub const App' to be exposed
This requires apps expose a `pub const App` from their `main.zig`, effectively adopting
the high-level/low-level application API outlined in hexops/mach#349

If `pub const App` does not exist, a clear compiler error is produced:

```
./src/platform/common.zig:5:9: error: expected e.g. `pub const App = mach.App(modules, init)' (App definition missing in your main Zig file)
        @compileError("expected e.g. `pub const App = mach.App(modules, init)' (App definition missing in your main Zig file)");
        ^
./src/platform/native.zig:13:28: note: called from here
    common.checkApplication(app_pkg);
                           ^
./src/platform/native.zig:12:10: note: called from here
comptime {
         ^
./src/platform/native.zig:15:20: error: container '.app' has no member called 'App'
const App = app_pkg.App;
                   ^
```

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-07-04 21:32:38 -07:00
Stephen Gutekanst
e79c9e075a mach: rename mach.Engine -> mach.Core
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-07-04 20:14:27 -07:00
Ayush
858c14bbae
{mach,examples}: Fix memory leaks (#384) 2022-07-03 08:47:47 -07:00
dweiller
0893c14893 mach: native: deinit gpa for leak detection in debug builds 2022-07-01 16:48:35 -07:00
Jamie Brandon
5bb740f89e
mach: flesh out mach.Event (#377)
* Flesh out mach.Event
2022-07-01 16:47:06 -07:00
iddev5
f80161bc72 mach: Use math.inf instead of math.floatMax for indefinite wait of events 2022-06-25 08:26:13 -07:00
Ali Chraghi
ff69efea52 mach: check application signature 2022-06-25 08:25:28 -07:00
Ali Chraghi
c831840094 wasm: Arrange key codes in numberical order of value 2022-06-25 08:25:28 -07:00
dweiller
1b32552e73 mach: re-export log_level and scope_levels from App 2022-06-24 12:58:07 -07:00
iddev5
71b25dc2a6 mach: ResourceManager: implement auto convertion of files into assets based on given info 2022-06-24 10:07:16 -07:00
iddev5
b0a00c5581 mach: ResourceManager: implement storage and unload of resources 2022-06-24 10:07:16 -07:00
iddev5
e58fd44ec0 mach: Implement basic resource loading system
Curently no real management has been implemented. It just loads the
resource from the list of paths present and provides the raw data from
it.
2022-06-24 10:07:16 -07:00
iddev5
6ed04c1e65 mach: Implement basic URI parser for resource system 2022-06-24 10:07:16 -07:00
David Vanderson
43bff35d2c
mach: mouse cursor support (#352)
adds mouse cursor support for standard cursors

Co-authored-by: Stephen Gutekanst <stephen.gutekanst@gmail.com>
2022-06-15 21:53:55 -07:00
iddev5
47286508e3 mach: wasm: Implement fullscreen support for browser platform 2022-06-11 16:00:02 -07:00
iddev5
3dc131d4fa mach: Implement fullscreen window support for native platforms (glfw)
This feature remembers the last position of window before turning to
fullscreen.
2022-06-11 16:00:02 -07:00
Stephen Gutekanst
c5432a9353 mach: zig fmt
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-06-10 16:56:40 -07:00
David Vanderson
ade26b24b1 ditch setTimeout 2022-06-10 12:57:31 -07:00
David Vanderson
4eb872944a wait event stuff for wasm backend 2022-06-10 12:57:31 -07:00