This commit is contained in:
Peter Li 2025-04-19 18:05:16 -07:00
parent 6387fdaf16
commit 9d3190f78d
2 changed files with 38 additions and 0 deletions

View File

@ -1,6 +1,7 @@
const std = @import("std");
pub const core = @import("core");
pub const cimgui = @import("cimgui");
const rend = @import("rend");
pub const Module: core.ModuleDescription = .{
.name = "imgui",

View File

@ -0,0 +1,37 @@
pub const ImguiImpl = struct {
allocator: std.mem.Allocator,
device: *gpu.GPUDevice,
// renderer plugin
pub fn create(device: *gpu.GPUDevice, allocator: std.mem.Allocator, settings: struct {}) !*@This() {
const self = try allocator.create(@This());
self.* = .{
.allocator = allocator,
.device = device,
};
_ = settings;
return self;
}
pub fn preTick(_: *@This(), _: f64) core.EngineDataEventError!void {
c.ImGui_ImplGlfw_NewFrame();
c.cImGui_vk_NewFrame();
c.igNewFrame();
}
// renderer plugin
pub fn destroy(p: *anyopaque) void {
const self: *@This() = @ptrCast(@alignCast(p));
self.allocator.destroy(self);
}
};
const c = @import("cimgui").c;
const ig = @import("cimgui").cimgui;
const sdl3 = @import("sdl3");
const gpu = sdl3.gpu;
const rend = @import("rend");
const std = @import("std");
const core = @import("core");