2022-12-31 06:47:48 +00:00
|
|
|
const zgui = @import("gui.zig");
|
|
|
|
|
|
|
|
pub fn init(window: *anyopaque, glsl_version: []const u8) void {
|
|
|
|
if (!ImGui_ImplGlfw_InitForOpenGL(window, true)) unreachable;
|
|
|
|
if (!ImGui_ImplOpenGL3_Init(glsl_version.ptr)) unreachable;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn deinit() void {
|
|
|
|
ImGui_ImplOpenGL3_Shutdown();
|
|
|
|
ImGui_ImplGlfw_Shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn newFrame(width: f32, height: f32) void {
|
|
|
|
ImGui_ImplOpenGL3_NewFrame();
|
|
|
|
ImGui_ImplGlfw_NewFrame();
|
|
|
|
|
|
|
|
zgui.io.setDisplaySize(width, height);
|
|
|
|
zgui.io.setDisplayFramebufferScale(1.0, 1.0);
|
|
|
|
|
|
|
|
zgui.newFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn draw() void {
|
2023-01-01 06:22:39 +00:00
|
|
|
zgui.render();
|
2022-12-31 06:47:48 +00:00
|
|
|
ImGui_ImplOpenGL3_RenderDrawData(zgui.getDrawData());
|
|
|
|
}
|
|
|
|
|
|
|
|
extern fn ImGui_ImplGlfw_InitForOpenGL(window: *anyopaque, install_callbacks: bool) bool;
|
|
|
|
extern fn ImGui_ImplGlfw_Shutdown() void;
|
|
|
|
extern fn ImGui_ImplGlfw_NewFrame() void;
|
|
|
|
|
|
|
|
extern fn ImGui_ImplOpenGL3_Init(glsl_version: [*]const u8) bool;
|
|
|
|
extern fn ImGui_ImplOpenGL3_Shutdown() void;
|
|
|
|
extern fn ImGui_ImplOpenGL3_NewFrame() void;
|
|
|
|
extern fn ImGui_ImplOpenGL3_RenderDrawData(draw_data: *anyopaque) void; // ImDrawData
|