Commit graph

26 commits

Author SHA1 Message Date
Martin Wickham
78dfa2df6b mach: add setCursorMode (desktop only for now) 2022-10-14 09:23:49 -07:00
Ali Chraghi
2811904eac mach: check Platform functions declaration & add deinit for wasm 2022-09-19 20:11:55 -07:00
Ali Chraghi
15dfb2867a all: rename setShouldClose to close
Closes #550
2022-09-18 09:50:15 -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
70f4514c66 sysaudio: fix compile for web 2022-09-09 22:39:35 -07:00
Stephen Gutekanst
78485e49f5 mach: wasm: add stub GPUInterface
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-09-09 22:06:27 -07:00
Stephen Gutekanst
28fb75c7eb mach: simplify sign function & improve self-hosted compiler support
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-08-28 23:37:56 -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
iddev5
34514699a1 mach: wasm: Use default log level 2022-07-06 05:55:04 -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
Jamie Brandon
5bb740f89e
mach: flesh out mach.Event (#377)
* Flesh out mach.Event
2022-07-01 16:47:06 -07:00
dweiller
1b32552e73 mach: re-export log_level and scope_levels from App 2022-06-24 12:58:07 -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
David Vanderson
4eb872944a wait event stuff for wasm backend 2022-06-10 12:57:31 -07:00
iddev5
772a821ce1 mach: wasm: Implement setShouldClose for wasm 2022-06-08 07:31:53 -07:00
iddev5
40c0659cc9 mach: App.update will now return !void instead of !bool
In order to close the application, there is already
Engine.setShouldClose() which would roughly do the same thing.
2022-06-08 07:31:53 -07:00
iddev5
db377459c4 mach: Listen to resize event for canvas and thus store window and
framebuffer size
2022-06-06 00:37:38 -07:00
iddev5
99dc10e58a mach: wasm: Implement mouse press, release, motion and scroll events 2022-06-05 13:34:24 -07:00
iddev5
176554fe4d mach: Make size limits part of runtime options (mach.Options)
Removed method Engine.setSizeLimits and added two new fields to
mach.Options called ``size_min`` and ``size_max`` which does the same
thing.
2022-06-01 23:45:56 -07:00
iddev5
ed0e6f5c61 mach: Added runtime application options
Reused mach.Options for run time options. It is set with
Engine.setOptions function. ``pub const options`` on top level App has
no effect and will be ignored completely.

Added a blank struct StartupOptions which would be used for startup time
options in future. Currently they aren't used for anything.
2022-06-01 23:45:56 -07:00
iddev5
50fe649ab1 mach: merge and remove the extra layer of indirection caused by Core and
GpuDriver

Core and GpuDriver both are merged into one type called Platform. Also
previously the fields and methods which were called as
``engine.core.field`` will now be ``engine.field`` i.e an extra layer is
removed.
2022-06-01 23:45:56 -07:00
David Vanderson
3961073084
{mach,examples}: followups to getWindowSize / getFramebufferSize (#322)
* followup to window size saving, getWindowSize and getFramebufferSize no longer return errors
* updated the examples
2022-05-31 11:39:53 -07:00
iddev5
ff126c0054 mach/platform: check for App functions in all platforms 2022-05-30 10:22:42 -07:00
iddev5
21c49ff9be mach: Move all platform specific files to platform/ directory 2022-05-30 10:22:42 -07:00
Renamed from src/wasm.zig (Browse further)