update to latest mach-ecs API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
ad17aa940b
commit
d01834a919
3 changed files with 9 additions and 11 deletions
|
|
@ -3,8 +3,8 @@
|
||||||
.version = "0.2.0",
|
.version = "0.2.0",
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.mach_ecs = .{
|
.mach_ecs = .{
|
||||||
.url = "https://pkg.machengine.org/mach-ecs/9a1cef80e63b5a1c7b247b4310ec701a2b2bc301.tar.gz",
|
.url = "https://pkg.machengine.org/mach-ecs/1dd04dd54df9609a6c3cf4aa631fd6f41799f091.tar.gz",
|
||||||
.hash = "12205e755f35ddb42a7e12e7152a387c9c0ec7b0f4bee9a5055f5cb00da4f3cb1e91",
|
.hash = "122028c2e519d4da34f20b27edf56620bcf627c6bf8b2b5f85a9922c25fe775cc9ce",
|
||||||
},
|
},
|
||||||
.mach_earcut = .{
|
.mach_earcut = .{
|
||||||
.url = "https://pkg.machengine.org/mach-earcut/12b86c8b4732300fb991efc07939482ebe808b93.tar.gz",
|
.url = "https://pkg.machengine.org/mach-earcut/12b86c8b4732300fb991efc07939482ebe808b93.tar.gz",
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ fragment_shader_code: [:0]const u8,
|
||||||
last_mtime: i128,
|
last_mtime: i128,
|
||||||
|
|
||||||
pub fn init(eng: *mach.Engine) !void {
|
pub fn init(eng: *mach.Engine) !void {
|
||||||
var editor = eng.mod(.editor).state();
|
const editor = &eng.mod.editor.state;
|
||||||
|
|
||||||
core.setTitle("Mach editor");
|
core.setTitle("Mach editor");
|
||||||
|
|
||||||
|
|
@ -84,7 +84,7 @@ pub fn init(eng: *mach.Engine) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(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();
|
defer _ = gpa.deinit();
|
||||||
|
|
||||||
editor.fragment_shader_file.close();
|
editor.fragment_shader_file.close();
|
||||||
|
|
@ -95,7 +95,7 @@ pub fn deinit(eng: *mach.Engine) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tick(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();
|
var iter = core.pollEvents();
|
||||||
while (iter.next()) |event| {
|
while (iter.next()) |event| {
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,10 @@ pub const Module = struct {
|
||||||
pub const name = .mach;
|
pub const name = .mach;
|
||||||
|
|
||||||
pub fn machInit(eng: *Engine) !void {
|
pub fn machInit(eng: *Engine) !void {
|
||||||
var mach = eng.mod(.mach);
|
|
||||||
|
|
||||||
core.allocator = allocator;
|
core.allocator = allocator;
|
||||||
try core.init(.{});
|
try core.init(.{});
|
||||||
mach.state().device = core.device;
|
eng.mod.mach.state.device = core.device;
|
||||||
mach.state().exit = false;
|
eng.mod.mach.state.exit = false;
|
||||||
|
|
||||||
try eng.send(.init);
|
try eng.send(.init);
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +31,7 @@ pub const Module = struct {
|
||||||
|
|
||||||
pub fn machExit(eng: *Engine) !void {
|
pub fn machExit(eng: *Engine) !void {
|
||||||
try eng.send(.exit);
|
try eng.send(.exit);
|
||||||
var state = eng.mod(.mach).state();
|
var state = eng.mod.mach.state;
|
||||||
state.exit = true;
|
state.exit = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -52,7 +50,7 @@ pub const App = struct {
|
||||||
|
|
||||||
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.mod(.mach).state().exit;
|
return app.engine.mod.mach.state.exit;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue