examples/core: building without ECS
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
2a13c07d9e
commit
0e12857154
35 changed files with 1365 additions and 4176 deletions
|
|
@ -1,25 +1,23 @@
|
|||
const std = @import("std");
|
||||
const mach = @import("mach");
|
||||
|
||||
// The global list of Mach modules our application may use.
|
||||
pub const modules = .{
|
||||
// The set of Mach modules our application may use.
|
||||
const Modules = mach.Modules(.{
|
||||
mach.Core,
|
||||
mach.gfx.sprite_modules,
|
||||
@import("App.zig"),
|
||||
@import("Glyphs.zig"),
|
||||
};
|
||||
});
|
||||
|
||||
// TODO: move this to a mach "entrypoint" zig module which handles nuances like WASM requires.
|
||||
pub fn main() !void {
|
||||
const allocator = std.heap.c_allocator;
|
||||
|
||||
// Initialize module system
|
||||
try mach.mods.init(allocator);
|
||||
// The set of Mach modules our application may use.
|
||||
var mods = Modules.init(allocator);
|
||||
// TODO: enable mods.deinit(allocator); for allocator leak detection
|
||||
// defer mods.deinit(allocator);
|
||||
|
||||
// Schedule .app.start to run.
|
||||
mach.mods.schedule(.app, .start);
|
||||
|
||||
// Dispatch systems forever or until there are none left to dispatch. If your app uses mach.Core
|
||||
// then this will block forever and never return.
|
||||
try mach.mods.dispatch(.{});
|
||||
const app = mods.get(.app);
|
||||
app.run(.main);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue