X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fdbg_gui.cc;h=a968b29fa45f34a67c6e4354978294800107c1fc;hp=c0c798423d02897923a0c5a15eaf4573f0da561b;hb=512acaa2427ffa2ff19079f999bc2fcd7cd33925;hpb=d29eba477666f0753170d9ad549a4715ce071d04 diff --git a/src/dbg_gui.cc b/src/dbg_gui.cc index c0c7984..a968b29 100644 --- a/src/dbg_gui.cc +++ b/src/dbg_gui.cc @@ -1,3 +1,4 @@ +#include #include "dbg_gui.h" #include "imgui/imgui.h" #include "app.h" @@ -16,6 +17,26 @@ bool init_debug_gui() io->DisplaySize.y = win_height; io->RenderDrawListsFn = render_func; + io->KeyMap[ImGuiKey_Tab] = '\t'; + io->KeyMap[ImGuiKey_LeftArrow] = KEY_LEFT; + io->KeyMap[ImGuiKey_RightArrow] = KEY_RIGHT; + io->KeyMap[ImGuiKey_UpArrow] = KEY_UP; + io->KeyMap[ImGuiKey_DownArrow] = KEY_DOWN; + io->KeyMap[ImGuiKey_PageUp] = KEY_PGUP; + io->KeyMap[ImGuiKey_PageDown] = KEY_PGDOWN; + io->KeyMap[ImGuiKey_Home] = KEY_HOME; + io->KeyMap[ImGuiKey_End] = KEY_END; + io->KeyMap[ImGuiKey_Delete] = KEY_DEL; + io->KeyMap[ImGuiKey_Backspace] = '\b'; + io->KeyMap[ImGuiKey_Enter] = '\n'; + io->KeyMap[ImGuiKey_Escape] = 27; + io->KeyMap[ImGuiKey_A] = 'a'; + io->KeyMap[ImGuiKey_C] = 'c'; + io->KeyMap[ImGuiKey_V] = 'v'; + io->KeyMap[ImGuiKey_X] = 'x'; + io->KeyMap[ImGuiKey_Y] = 'y'; + io->KeyMap[ImGuiKey_Z] = 'z'; + unsigned char *pixels; int width, height; io->Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); @@ -42,32 +63,37 @@ void debug_gui_reshape(int x, int y) io->DisplaySize.y = y; } -bool debug_gui_key(int key, bool press, unsigned int modstate) +void debug_gui_key(int key, bool press, unsigned int modstate) { - io->KeysDown[key] = press; + if(key < 512) { + io->KeysDown[key] = press; + } io->KeyShift = (modstate & MOD_SHIFT) != 0; io->KeyCtrl = (modstate & MOD_CTRL) != 0; io->KeyAlt = (modstate & MOD_ALT) != 0; io->KeySuper = false; - return true; // TODO + if(press && key < 256 && isprint(key)) { + io->AddInputCharacter(key); + } } -bool debug_gui_mbutton(int bn, bool press, int x, int y) +void debug_gui_mbutton(int bn, bool press, int x, int y) { io->MouseDown[bn] = press; io->MousePos.x = x; io->MousePos.y = y; - - return true; // TODO } -bool debug_gui_mmotion(int x, int y) +void debug_gui_mmotion(int x, int y) { io->MousePos.x = x; io->MousePos.y = y; +} - return true; // TODO +void debug_gui_wheel(int dir) +{ + io->MouseWheel = dir; } static void render_func(ImDrawData *ddat)