module: object recycling

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-09-30 01:21:31 -07:00 committed by Emi Gutekanst
parent 8054d03b4d
commit 9d134dc72d
15 changed files with 396 additions and 90 deletions

View file

@ -233,12 +233,12 @@ pub fn init(core: *Core) !void {
try core.input.start();
}
pub fn tick(core: *Core, core_mod: mach.Functions(Core)) void {
pub fn tick(core: *Core, core_mod: mach.Mod(Core)) void {
core_mod.run(core.on_tick.?);
core_mod.call(.presentFrame);
}
pub fn main(core: *Core, core_mod: mach.Functions(Core)) !void {
pub fn main(core: *Core, core_mod: mach.Mod(Core)) !void {
if (core.on_tick == null) @panic("core.on_tick callback must be set");
if (core.on_exit == null) @panic("core.on_exit callback must be set");
@ -277,7 +277,7 @@ pub fn main(core: *Core, core_mod: mach.Functions(Core)) !void {
}
}
fn platform_update_callback(core: *Core, core_mod: mach.Functions(Core)) !bool {
fn platform_update_callback(core: *Core, core_mod: mach.Mod(Core)) !bool {
core_mod.run(core.on_tick.?);
core_mod.call(.presentFrame);
@ -563,7 +563,7 @@ pub fn mousePosition(core: *@This()) Position {
// return core.platform.nativeWindowWin32();
// }
pub fn presentFrame(core: *Core, core_mod: mach.Functions(Core)) !void {
pub fn presentFrame(core: *Core, core_mod: mach.Mod(Core)) !void {
// TODO(object)(window-title)
// // Update windows title
// var num_windows: usize = 0;