Commit graph

10 commits

Author SHA1 Message Date
Stephen Gutekanst
a7e7dc800d mach: expose window size (pixel units, vs. framebuffer subpixel units)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2022-05-22 09:12:48 -07:00
iddev5
7bd841a638 mach: free EventNode(s) after poping from queue 2022-05-20 09:14:32 -07:00
iddev5
f1e7c10fbb mach: remove Action enum and all references to it 2022-05-20 09:14:32 -07:00
iddev5
7486b0ebea mach: Implement key input handling as event loop
This commit changes the former callback based design to handle key input
(GLFW-like) to an event loop based design (SDL-like). This uses a
TailQueue to store the events from inside of standard glfw callbacks.
This Queue is then popped while polling, thereby emulating event loop.

Removes from Engine the function: ``setKeyCallback`` and adds the
function: ``pollEvent`` which may return an event or null.

This change was done for two reasons:
1) Removing dependence of Engine on App. This was a circular dependency
   and a genuine bad design.
2) Solve the recent regression due to the same which was (i) preventing
   using types declared in Engine.zig and (ii) preventing usage of
   multiple source files in an application.

Currently only key press and release events are implemented as these are
the ones currently used in examples.
2022-05-20 09:14:32 -07:00
iddev5
3bb45c75a1 mach: introduce cross platform Timer abstraction
This Timer uses std.time.Timer as backing timer in native platforms, and
will use custom timers for special platforms (wasm, android?, ios?).

Unlike std.time.Timer, its primary API is focused on floats. Also meant
to provides some convenient functions alongside base ones.

Follows std.time.Timer API, but methods by default return f32 i.e
non-precise variant with precise variants available returning u64.
2022-05-17 23:56:41 -07:00
iddev5
657091ed65 mach: Reorganised native backend files, moved structs and fixed circular
dependency
2022-05-15 10:36:08 -07:00
iddev5
8b46f46cf8 mach: Create binding methods for all glfw methods in use and update
examples
2022-05-13 16:17:18 -07:00
iddev5
5396769227 mach: implement all glfw -> mach key mappings 2022-05-09 08:08:01 -07:00
iddev5
71b7473ee7 mach: implement key press/release callback 2022-05-09 08:08:01 -07:00
iddev5
8904536632 mach: comptime interface-like implementation of engine cores 2022-05-01 17:07:29 -07:00