update to latest mach-ecs API

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-08-21 22:12:02 -07:00
parent ad17aa940b
commit d01834a919
3 changed files with 9 additions and 11 deletions

View file

@ -26,7 +26,7 @@ fragment_shader_code: [:0]const u8,
last_mtime: i128,
pub fn init(eng: *mach.Engine) !void {
var editor = eng.mod(.editor).state();
const editor = &eng.mod.editor.state;
core.setTitle("Mach editor");
@ -84,7 +84,7 @@ pub fn init(eng: *mach.Engine) !void {
}
pub fn deinit(eng: *mach.Engine) !void {
var editor = eng.mod(.editor).state();
const editor = &eng.mod.editor.state;
defer _ = gpa.deinit();
editor.fragment_shader_file.close();
@ -95,7 +95,7 @@ pub fn deinit(eng: *mach.Engine) !void {
}
pub fn tick(eng: *mach.Engine) !void {
var editor = eng.mod(.editor).state();
const editor = &eng.mod.editor.state;
var iter = core.pollEvents();
while (iter.next()) |event| {

View file

@ -14,12 +14,10 @@ pub const Module = struct {
pub const name = .mach;
pub fn machInit(eng: *Engine) !void {
var mach = eng.mod(.mach);
core.allocator = allocator;
try core.init(.{});
mach.state().device = core.device;
mach.state().exit = false;
eng.mod.mach.state.device = core.device;
eng.mod.mach.state.exit = false;
try eng.send(.init);
}
@ -33,7 +31,7 @@ pub const Module = struct {
pub fn machExit(eng: *Engine) !void {
try eng.send(.exit);
var state = eng.mod(.mach).state();
var state = eng.mod.mach.state;
state.exit = true;
}
};
@ -52,7 +50,7 @@ pub const App = struct {
pub fn update(app: *@This()) !bool {
try app.engine.send(.tick);
return app.engine.mod(.mach).state().exit;
return app.engine.mod.mach.state.exit;
}
};