mach: prepare to handle ECS init via modules
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
2879ad58b0
commit
15e6f81df8
1 changed files with 2 additions and 6 deletions
|
|
@ -17,12 +17,8 @@ pub const module = ecs.Module(.{
|
|||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
const allocator = gpa.allocator();
|
||||
|
||||
pub fn App(
|
||||
comptime modules: anytype,
|
||||
comptime app_init: anytype, // fn (engine: *ecs.World(modules)) !void
|
||||
) type {
|
||||
pub fn App(comptime modules: anytype) type {
|
||||
// TODO: validate modules.mach is the expected type.
|
||||
// TODO: validate init has the right function signature
|
||||
|
||||
return struct {
|
||||
engine: ecs.World(modules),
|
||||
|
|
@ -36,7 +32,7 @@ pub fn App(
|
|||
};
|
||||
app.engine.set(.mach, .core, &app.core);
|
||||
app.engine.set(.mach, .device, app.core.device());
|
||||
try app_init(&app.engine);
|
||||
app.engine.send(.init);
|
||||
}
|
||||
|
||||
pub fn deinit(app: *@This()) void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue