Files
zig-experiments/src/main.zig
2024-07-09 16:09:22 -04:00

44 lines
1.1 KiB
Zig

const std = @import("std");
const nu = @import("nu.zig");
const App = @import("App.zig");
pub const nu_options: nu.Options = .{
.window = .{ .title = "Hello World" },
.render = .{
.app_name = "hello-world",
.frames_in_flight = 3,
},
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.detectLeaks();
const alloc = gpa.allocator();
// todo declare or infer module dependencies, topological sort for init order
// problem: how to specify runtime options, like Window title?
// problem: where should gpa go? probably some "Engine" structure in nu.zig
// don't necessarily need to declare topological sort - depth-first traversal
// of each module's dependencies without repeats would do.
try nu.Window.init(alloc);
defer nu.Window.deinit();
try nu.Render.init(alloc);
defer nu.Render.deinit();
try nu.ImGui.init();
defer nu.ImGui.deinit();
try App.init(alloc);
defer App.deinit();
try nu.run(nu.Window, .{
App,
nu.ImGui,
nu.Render,
});
}