module: object recycling
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
8054d03b4d
commit
9d134dc72d
15 changed files with 396 additions and 90 deletions
|
|
@ -23,7 +23,7 @@ pub fn deinit(app: *App) void {
|
|||
pub fn init(
|
||||
app: *App,
|
||||
core: *mach.Core,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub fn main() !void {
|
|||
const allocator = std.heap.c_allocator;
|
||||
|
||||
// The set of Mach modules our application may use.
|
||||
var mods = Modules.init(allocator);
|
||||
var mods = try Modules.init(allocator);
|
||||
|
||||
// On some platforms, you can drive the mach.Core main loop yourself - but this isn't possible
|
||||
// on all platforms. If mach.Core.non_blocking is set to true, and the platform supports
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pipeline: *gpu.RenderPipeline,
|
|||
pub fn init(
|
||||
core: *mach.Core,
|
||||
app: *App,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pub fn main() !void {
|
|||
const allocator = std.heap.c_allocator;
|
||||
|
||||
// The set of Mach modules our application may use.
|
||||
var mods = Modules.init(allocator);
|
||||
var mods = try Modules.init(allocator);
|
||||
// TODO: enable mods.deinit(allocator); for allocator leak detection
|
||||
// defer mods.deinit(allocator);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ fn init(
|
|||
core: *mach.Core,
|
||||
renderer: *Renderer,
|
||||
app: *App,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ fn init(
|
|||
glyphs: *Glyphs.Mod,
|
||||
app: *App,
|
||||
core: *mach.Core,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ fn init(
|
|||
text: *gfx.Text.Mod,
|
||||
sprite_pipeline: *gfx.SpritePipeline.Mod,
|
||||
app: *App,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ fn init(
|
|||
core: *mach.Core,
|
||||
audio: *mach.Audio,
|
||||
app: *App,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ fn init(
|
|||
core: *mach.Core,
|
||||
audio: *mach.Audio,
|
||||
app: *App,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ fn init(
|
|||
sprite: *gfx.Sprite.Mod,
|
||||
sprite_pipeline: *gfx.SpritePipeline.Mod,
|
||||
app: *App,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ fn init(
|
|||
text_pipeline: *gfx.TextPipeline.Mod,
|
||||
text_style: *gfx.TextStyle.Mod,
|
||||
app: *App,
|
||||
app_mod: mach.Functions(App),
|
||||
app_mod: mach.Mod(App),
|
||||
) !void {
|
||||
core.on_tick = app_mod.id.tick;
|
||||
core.on_exit = app_mod.id.deinit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue