mach: handle exit via module globals
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
f153133c30
commit
85ffb37156
1 changed files with 3 additions and 4 deletions
|
|
@ -11,6 +11,7 @@ pub const module = ecs.Module(.{
|
||||||
.globals = struct {
|
.globals = struct {
|
||||||
core: *Core,
|
core: *Core,
|
||||||
device: *gpu.Device,
|
device: *gpu.Device,
|
||||||
|
exit: bool,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -36,16 +37,14 @@ pub fn App(comptime modules: anytype) type {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(app: *@This()) void {
|
pub fn deinit(app: *@This()) void {
|
||||||
const core = app.engine.get(.mach, .core);
|
app.core.deinit();
|
||||||
core.deinit();
|
|
||||||
allocator.destroy(core);
|
|
||||||
app.engine.deinit();
|
app.engine.deinit();
|
||||||
_ = gpa.deinit();
|
_ = gpa.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(app: *@This()) !bool {
|
pub fn update(app: *@This()) !bool {
|
||||||
try app.engine.send(.tick);
|
try app.engine.send(.tick);
|
||||||
return false;
|
return app.engine.get(.mach, .exit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue