wip imgui
This commit is contained in:
parent
683756900c
commit
aefe5fa327
|
@ -13,6 +13,7 @@
|
|||
];
|
||||
buildInputs = [
|
||||
alsa-lib
|
||||
lldb
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXi
|
||||
|
|
23
src/main.zig
23
src/main.zig
|
@ -38,9 +38,24 @@ export fn frame() void {
|
|||
});
|
||||
|
||||
//=== UI CODE STARTS HERE
|
||||
ig.igSetNextWindowPos(.{ .x = 10, .y = 10 }, ig.ImGuiCond_Once, .{ .x = 0, .y = 0 });
|
||||
ig.igSetNextWindowSize(.{ .x = 400, .y = 100 }, ig.ImGuiCond_Once);
|
||||
_ = ig.igBegin("Hello Dear ImGui!", 0, ig.ImGuiWindowFlags_None);
|
||||
var menu_bar_size: ig.ImVec2 = undefined;
|
||||
if (ig.igBeginMainMenuBar()) {
|
||||
ig.igGetWindowSize(&menu_bar_size);
|
||||
defer ig.igEndMainMenuBar();
|
||||
if (ig.igBeginMenu("File", true)) {
|
||||
defer ig.igEndMenu();
|
||||
if (ig.igMenuItem_Bool("Open", "o", false, true)) {
|
||||
// Do something
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const io = ig.igGetIO();
|
||||
ig.igSetNextWindowPos(.{ .x = 0, .y = menu_bar_size.y }, ig.ImGuiCond_Always, .{ .x = 0, .y = 0 });
|
||||
var content_size: ig.ImVec2 = io.*.DisplaySize;
|
||||
content_size.y -= menu_bar_size.y;
|
||||
ig.igSetNextWindowSize(content_size, ig.ImGuiCond_Always);
|
||||
_ = ig.igBegin("Hello Dear ImGui!", 0, ig.ImGuiWindowFlags_NoMove | ig.ImGuiWindowFlags_NoResize | ig.ImGuiWindowFlags_NoTitleBar | ig.ImGuiWindowFlags_NoCollapse);
|
||||
_ = ig.igColorEdit3("Background", &state.pass_action.colors[0].clear_value.r, ig.ImGuiColorEditFlags_None);
|
||||
ig.igEnd();
|
||||
//=== UI CODE ENDS HERE
|
||||
|
@ -68,7 +83,7 @@ pub fn main() void {
|
|||
.frame_cb = frame,
|
||||
.cleanup_cb = cleanup,
|
||||
.event_cb = event,
|
||||
.window_title = "sokol-zig + Dear Imgui",
|
||||
.window_title = "Doggo",
|
||||
.width = 800,
|
||||
.height = 600,
|
||||
.icon = .{ .sokol_default = true },
|
||||
|
|
Loading…
Reference in a new issue