2026-07-28 20:57:38 +02:00
|
|
|
//! ----------------------------------------------------
|
|
|
|
|
//! ----------------------------------------------------
|
|
|
|
|
|
2026-07-28 22:40:06 +02:00
|
|
|
//
|
|
|
|
|
// LIBS
|
|
|
|
|
//
|
|
|
|
|
|
2026-07-28 20:57:38 +02:00
|
|
|
const std = @import("std");
|
|
|
|
|
const App = @import("app");
|
|
|
|
|
|
2026-07-28 22:40:06 +02:00
|
|
|
//
|
|
|
|
|
// PLUGINS
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
const template = @import("plugins/template/root.zig");
|
2026-07-28 22:37:53 +01:00
|
|
|
const common = @import("plugins/common/root.zig");
|
2026-07-28 22:40:06 +02:00
|
|
|
const platform = @import("plugins/platform/root.zig");
|
|
|
|
|
const device = @import("plugins/device/root.zig");
|
|
|
|
|
const window = @import("plugins/window/root.zig");
|
2026-07-28 22:37:53 +01:00
|
|
|
const cache = @import("plugins/cache/root.zig");
|
2026-07-28 23:30:07 +01:00
|
|
|
const input = @import("plugins/input/root.zig");
|
2026-07-28 22:37:53 +01:00
|
|
|
const renderer = @import("plugins/renderer/root.zig");
|
2026-07-28 22:40:06 +02:00
|
|
|
|
2026-07-28 20:57:38 +02:00
|
|
|
/// ----------------------------------------------------
|
|
|
|
|
/// ----------------------------------------------------
|
|
|
|
|
pub fn main(init: std.process.Init) !void {
|
|
|
|
|
// --- APP ---
|
|
|
|
|
var app: App = .init(init.gpa);
|
|
|
|
|
defer app.deinit();
|
2026-07-28 22:40:06 +02:00
|
|
|
|
|
|
|
|
// --- ADD PLUGINS ---
|
|
|
|
|
try app.plugins.addMany(&.{
|
|
|
|
|
platform.plugin,
|
|
|
|
|
device.plugin,
|
|
|
|
|
window.plugin,
|
2026-07-28 22:37:53 +01:00
|
|
|
cache.plugin,
|
2026-07-28 23:30:07 +01:00
|
|
|
input.plugin,
|
2026-07-28 22:37:53 +01:00
|
|
|
renderer.plugin,
|
2026-07-28 22:40:06 +02:00
|
|
|
});
|
|
|
|
|
try app.plugins.build(&app);
|
|
|
|
|
|
|
|
|
|
{ // DEBUG
|
|
|
|
|
std.debug.print("\x1b[33m┏━\x1b[0m PLUGINS\n", .{});
|
|
|
|
|
for (app.plugins.data.items) |plugin| {
|
|
|
|
|
std.debug.print("\x1b[33m┃\x1b[0m {s:<12} {s}\n", .{ plugin.name, plugin.description });
|
|
|
|
|
}
|
|
|
|
|
std.debug.print("\x1b[33m┗━\x1b[0m\n", .{});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- LIFETIME ---
|
|
|
|
|
try app.schedules.run(App.stage.init, &app);
|
|
|
|
|
defer app.schedules.runReversed(App.stage.deinit, &app) catch unreachable;
|
2026-07-28 23:30:07 +01:00
|
|
|
|
|
|
|
|
// --- MAIN LOOP ---
|
|
|
|
|
while (true) {
|
|
|
|
|
// --- # ---
|
|
|
|
|
if (app.events.consume(App.event.AppExit)) |_| break;
|
|
|
|
|
|
|
|
|
|
// --- # ---
|
|
|
|
|
try app.schedules.runMany(&.{
|
|
|
|
|
App.stage.begin_frame,
|
|
|
|
|
App.stage.inputs,
|
|
|
|
|
App.stage.fixed_update,
|
|
|
|
|
App.stage.update,
|
|
|
|
|
App.stage.draw,
|
|
|
|
|
App.stage.end_frame,
|
|
|
|
|
}, &app);
|
|
|
|
|
}
|
2026-07-28 20:57:38 +02:00
|
|
|
}
|