* vendor/cimgui

* Add a "dev mode" window which for now is just imgui demo
This commit is contained in:
Mitchell Hashimoto
2022-10-16 16:20:08 -07:00
committed by GitHub
parent ddfb1dec4b
commit f29393bca6
18 changed files with 423 additions and 3 deletions

38
src/DevMode.zig Normal file
View File

@@ -0,0 +1,38 @@
//! This file implements the "dev mode" interface for the terminal. This
//! includes state managements and rendering.
const DevMode = @This();
const imgui = @import("imgui");
/// If this is false, the rest of the terminal will be compiled without
/// dev mode support at all.
pub const enabled = true;
/// The global DevMode instance that can be used app-wide. Assume all functions
/// are NOT thread-safe unless otherwise noted.
pub var instance: DevMode = .{};
/// Whether to show the dev mode UI currently.
visible: bool = false,
/// Update the state associated with the dev mode. This should generally
/// only be called paired with a render since it otherwise wastes CPU
/// cycles.
pub fn update(self: DevMode) void {
_ = self;
imgui.ImplOpenGL3.newFrame();
imgui.ImplGlfw.newFrame();
imgui.newFrame();
// Just demo for now
imgui.showDemoWindow(null);
}
/// Render the scene and return the draw data. The caller must be imgui-aware
/// in order to render the draw data. This lets this file be renderer/backend
/// agnostic.
pub fn render(self: DevMode) !*imgui.DrawData {
_ = self;
imgui.render();
return try imgui.DrawData.get();
}