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.
Previously if user code called core.getWindowSize() (or
getFramebufferSize) during their update they could get sizes that did
not match engine.gpu_driver.target_desc because the window had changed
size.
Now core.getWindowSize() returns the last size we got from a glfw
callback instead of directly querying the window. So all sizes should
agree during a single frame.
This relies on glfw callbacks only happening when we call
glfw.pollEvents(). This isn't strictly true - a callback could happen
during any glfw call. Might have to revisit this later.
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.
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.