+#include <ctype.h>
#include "dbg_gui.h"
#include "imgui/imgui.h"
#include "app.h"
static void render_func(ImDrawData *ddat);
+bool debug_gui, parent_expanded;
+SceneNode *dbg_sel_node;
+
static ImGuiIO *io;
static Texture *tex;
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);
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)
glTexCoordPointer(2, GL_FLOAT, sizeof *vbuf, &vbuf[0].uv);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof *vbuf, &vbuf[0].col);
- glDrawElements(GL_TRIANGLES, cmd->ElemCount, GL_UNSIGNED_SHORT, ibuf);
+ if(glcaps.draw_range) {
+ int max_vidx = cmdlist->VtxBuffer.Size - 1;
+ glDrawRangeElements(GL_TRIANGLES, 0, max_vidx, cmd->ElemCount, GL_UNSIGNED_SHORT, ibuf);
+ } else {
+ glDrawElements(GL_TRIANGLES, cmd->ElemCount, GL_UNSIGNED_SHORT, ibuf);
+ }
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);