mach: use type safe module wrapper/helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
0bae4b00bd
commit
f41b1b4f7b
1 changed files with 4 additions and 3 deletions
|
|
@ -31,8 +31,9 @@ pub fn App(comptime modules: anytype) type {
|
||||||
.core = app.core,
|
.core = app.core,
|
||||||
.engine = try ecs.World(modules).init(allocator),
|
.engine = try ecs.World(modules).init(allocator),
|
||||||
};
|
};
|
||||||
app.engine.set(.mach, .core, &app.core);
|
var mach = app.engine.mod(.mach);
|
||||||
app.engine.set(.mach, .device, app.core.device());
|
mach.setState(.core, &app.core);
|
||||||
|
mach.setState(.device, app.core.device());
|
||||||
try app.engine.send(.init);
|
try app.engine.send(.init);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,7 +45,7 @@ pub fn App(comptime modules: anytype) type {
|
||||||
|
|
||||||
pub fn update(app: *@This()) !bool {
|
pub fn update(app: *@This()) !bool {
|
||||||
try app.engine.send(.tick);
|
try app.engine.send(.tick);
|
||||||
return app.engine.get(.mach, .exit);
|
return app.engine.mod(.mach).getState(.exit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue