const std = @import("std"); const CLI = @import("./cli.zig"); const Platform = @import("./platform.zig"); const log = std.log.scoped(.app); const App = @This(); bg: Platform.Color, show_first_window: bool, check: bool, player_x: f32, pub fn init(self: *App, plt: Platform.Init) !?u8 { self.* = App{ .bg = .black, .player_x = 0, .show_first_window = true, .check = false, }; _ = plt; // autofix return null; } pub fn frame(self: *App, plt: *Platform.Frame) !void { const gfx = plt.gfx; gfx.drawRectangle(.init(self.player_x + 100, 100), .init(100, 100), .rgb(200, 0, 0)); if (plt.imgui) |imgui| { if (imgui.beginWindow(.{ .name = "Hello", .size = .init(400, 200), .open = &self.show_first_window })) { defer imgui.endWindow(); imgui.text("Hello", .{}); if (imgui.button("foo")) { std.debug.print("pressed\n", .{}); } if (imgui.slider(.{ .label = "player x", .value = &self.player_x, .min = 0, .max = 100 })) { std.debug.print("player x changed\n", .{}); } if (imgui.checkbox("Hello", &self.check)) { std.debug.print("checkbox changed\n", .{}); } imgui.separator(); if (imgui.colorEdit(.{ .label = "Color", .value = &self.bg, })) { std.debug.print("color changed\n", .{}); } } } gfx.clear_color = self.bg; } pub fn deinit(self: *App) void { _ = self; // autofix }