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

@ -3,8 +3,8 @@
.version = "0.2.0",
.dependencies = .{
.mach_ecs = .{
.url = "https://pkg.machengine.org/mach-ecs/9a1cef80e63b5a1c7b247b4310ec701a2b2bc301.tar.gz",
.hash = "12205e755f35ddb42a7e12e7152a387c9c0ec7b0f4bee9a5055f5cb00da4f3cb1e91",
.url = "https://pkg.machengine.org/mach-ecs/1dd04dd54df9609a6c3cf4aa631fd6f41799f091.tar.gz",
.hash = "122028c2e519d4da34f20b27edf56620bcf627c6bf8b2b5f85a9922c25fe775cc9ce",
},
.mach_earcut = .{
.url = "https://pkg.machengine.org/mach-earcut/12b86c8b4732300fb991efc07939482ebe808b93.tar.gz",

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;
}
};