main update to new runtime API

This commit is contained in:
Mitchell Hashimoto
2023-02-22 21:11:59 -08:00
parent 2adb0c9234
commit 2dda1d65a4

View File

@ -90,33 +90,19 @@ pub fn main() !void {
try config.finalize(); try config.finalize();
std.log.debug("config={}", .{config}); std.log.debug("config={}", .{config});
if (true) { // Create our app state
// Create our app state var app = try App.create(alloc, &config);
var app = try App.create(alloc, &config);
defer app.destroy();
// Create our runtime app
var app_runtime = try apprt.App.init(app, .{});
defer app_runtime.terminate();
// Create an initial window
_ = try app_runtime.newWindow();
// Run the GUI event loop
try app_runtime.run();
return;
}
// Run our app with a single initial window to start.
var app = try App.create(alloc, .{}, &config);
defer app.destroy(); defer app.destroy();
if (build_config.app_runtime == .gtk) {
try app.runtime.newWindow(); // Create our runtime app
while (true) try app.runtime.wait(); var app_runtime = try apprt.App.init(app, .{});
return; defer app_runtime.terminate();
}
_ = try app.newWindow(.{}); // Create an initial window
try app.run(); _ = try app_runtime.newWindow();
// Run the GUI event loop
try app_runtime.run();
} }
// Required by tracy/tracy.zig to enable/disable tracy support. // Required by tracy/tracy.zig to enable/disable tracy support.