X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fapp.cc;h=46b0152aa84b9883885b3f9c9b083cd618c1af19;hp=03561049230e59a38537fd8a25fd51ce517e29ad;hb=e12a327cc0b4f1e59f4a66a80b170ec41ce97be6;hpb=d29eba477666f0753170d9ad549a4715ce071d04 diff --git a/src/app.cc b/src/app.cc index 0356104..46b0152 100644 --- a/src/app.cc +++ b/src/app.cc @@ -71,8 +71,6 @@ static bool show_blobs; static Renderer *rend; -static bool show_debug_gui; - bool app_init(int argc, char **argv) { @@ -347,11 +345,9 @@ void app_display() float dt = (float)(time_msec - prev_msec) / 1000.0f; prev_msec = time_msec; - if(show_debug_gui) { + if(debug_gui) { ImGui::GetIOPtr()->DeltaTime = dt; ImGui::NewFrame(); - - ImGui::ShowTestWindow(); } if(opt.vr) { @@ -378,7 +374,7 @@ void app_display() draw_vrhands(); } - if(show_debug_gui) { + if(debug_gui) { ImGui::Render(); } } @@ -408,7 +404,7 @@ void app_display() glUseProgram(0); } - if(show_debug_gui) { + if(debug_gui) { ImGui::Render(); } app_swap_buffers(); @@ -500,9 +496,9 @@ void app_keyboard(int key, bool pressed) { unsigned int mod = app_get_modifiers(); - if(!debug_gui_key(key, pressed, mod)) { - // the debug gui indicated that we should ignore the event - return; + if(debug_gui && !(pressed && (key == '`' || key == 27))) { + debug_gui_key(key, pressed, mod); + return; // ignore all keystrokes when GUI is visible } if(pressed) { @@ -518,12 +514,12 @@ void app_keyboard(int key, bool pressed) } break; - case '\t': - show_debug_gui = !show_debug_gui; - show_message("debug gui %s", show_debug_gui ? "enabled" : "disabled"); + case '`': + debug_gui = !debug_gui; + show_message("debug gui %s", debug_gui ? "enabled" : "disabled"); break; - case '`': + case 'm': app_toggle_grab_mouse(); show_message("mouse %s", app_is_mouse_grabbed() ? "grabbed" : "released"); break; @@ -592,9 +588,9 @@ void app_keyboard(int key, bool pressed) void app_mouse_button(int bn, bool pressed, int x, int y) { - if(!debug_gui_mbutton(bn, pressed, x, y)) { - // the debug GUI indicated we should ignore the event - return; + if(debug_gui) { + debug_gui_mbutton(bn, pressed, x, y); + return; // ignore mouse events while GUI is visible } prev_mx = x; @@ -620,9 +616,9 @@ static void mouse_zoom(float dx, float dy) void app_mouse_motion(int x, int y) { - if(!debug_gui_mmotion(x, y)) { - // the debug GUI indicated we should ignore the event - return; + if(debug_gui) { + debug_gui_mmotion(x, y); + return; // ignore mouse events while GUI is visible } int dx = x - prev_mx; @@ -649,6 +645,13 @@ void app_mouse_delta(int dx, int dy) } } +void app_mouse_wheel(int dir) +{ + if(debug_gui) { + debug_gui_wheel(dir); + } +} + void app_gamepad_axis(int axis, float val) { switch(axis) {