NYXEngine/src/plugins/world/root.zig

40 lines
1.1 KiB
Zig

//! ----------------------------------------------------
//! ----------------------------------------------------
//
// PRIVATE
//
const App = @import("app");
const World = @import("world");
/// ----------------------------------------------------
/// ----------------------------------------------------
pub const plugin: App.Plugin = .{
.name = "World",
.build = build,
};
/// ----------------------------------------------------
/// ----------------------------------------------------
fn build(
_: *App.Plugin,
app: *App,
) !void {
try app.schedules.add(App.stage.init, init);
try app.schedules.add(App.stage.deinit, deinit);
}
/// ----------------------------------------------------
/// ----------------------------------------------------
fn init(app: *App) !void {
try app.resources.set(World.init(app.alloc));
}
/// ----------------------------------------------------
/// ----------------------------------------------------
fn deinit(app: *App) !void {
// --- # ---
const world = try app.resources.require(World);
world.deinit();
}