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