Empty window

This commit is contained in:
2025-11-08 18:07:15 +01:00
parent 1a3d52079b
commit b1cf52b552

View File

@@ -5,4 +5,69 @@ const sapp = sokol.app;
const sglue = sokol.glue; const sglue = sokol.glue;
const simgui = sokol.imgui; const simgui = sokol.imgui;
pub fn main() void {} const imgui_pass_action = blk: {
var ret: sg.PassAction = .{};
ret.colors[0] = .{
.load_action = .CLEAR,
.clear_value = .{ .r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0 },
};
break :blk ret;
};
fn init() callconv(.c) void {
sg.setup(.{
.environment = sglue.environment(),
.logger = .{ .func = slog.func },
});
simgui.setup(.{
.logger = .{ .func = slog.func },
});
}
fn deinit() callconv(.c) void {
simgui.shutdown();
sg.shutdown();
}
fn frame() callconv(.c) void {
simgui.newFrame(.{
.width = sapp.width(),
.height = sapp.height(),
.delta_time = sapp.frameDuration(),
.dpi_scale = sapp.dpiScale(),
});
// --- IMGUI PASS ---
sg.beginPass(.{
.action = imgui_pass_action,
.swapchain = sglue.swapchain(),
});
simgui.render();
sg.endPass();
// ---
sg.commit();
}
fn event(ev: [*c]const sapp.Event) callconv(.c) void {
_ = simgui.handleEvent(ev.*);
}
pub fn main() void {
sapp.run(.{
.init_cb = &init,
.cleanup_cb = &deinit,
.frame_cb = &frame,
.event_cb = &event,
.window_title = "Voxel Game",
.width = 1280,
.height = 720,
.icon = .{ .sokol_default = true },
.logger = .{ .func = slog.func },
});
}