46 lines
1.1 KiB
Zig
46 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: 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.
|
|
|
|
// idea - use a structure like std.Build.Step where the polymorphic part is a
|
|
// component of the larger structure.
|
|
|
|
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,
|
|
});
|
|
}
|