From 15e6f81df83233094dee0f09a272a07613e99d25 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 26 Mar 2023 11:17:25 -0700 Subject: [PATCH] mach: prepare to handle ECS init via modules Signed-off-by: Stephen Gutekanst --- src/engine.zig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/engine.zig b/src/engine.zig index ac159a81..8471883e 100644 --- a/src/engine.zig +++ b/src/engine.zig @@ -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 {