From 0b6e3cbe355356fcbd96cf8b8aeae3d663046dc4 Mon Sep 17 00:00:00 2001 From: thedmd Date: Wed, 2 May 2018 20:42:37 +0200 Subject: [PATCH] Add extra keys --- examples/imgui_impl_allegro5.cpp | 42 ++++++++++++++++++++++++ examples/imgui_impl_glfw.cpp | 42 ++++++++++++++++++++++++ examples/imgui_impl_glut.cpp | 42 ++++++++++++++++++++++++ examples/imgui_impl_marmalade.cpp | 40 +++++++++++++++++++++++ examples/imgui_impl_osx.mm | 42 ++++++++++++++++++++++++ examples/imgui_impl_sdl.cpp | 42 ++++++++++++++++++++++++ examples/imgui_impl_win32.cpp | 42 ++++++++++++++++++++++++ imgui.h | 54 +++++++++++++++++++++++++++---- 8 files changed, 340 insertions(+), 6 deletions(-) diff --git a/examples/imgui_impl_allegro5.cpp b/examples/imgui_impl_allegro5.cpp index 76f74a3fa22b..5b3522c6a10b 100644 --- a/examples/imgui_impl_allegro5.cpp +++ b/examples/imgui_impl_allegro5.cpp @@ -285,12 +285,54 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display) io.KeyMap[ImGuiKey_Enter] = ALLEGRO_KEY_ENTER; io.KeyMap[ImGuiKey_Escape] = ALLEGRO_KEY_ESCAPE; io.KeyMap[ImGuiKey_KeyPadEnter] = ALLEGRO_KEY_PAD_ENTER; + io.KeyMap[ImGuiKey_0] = ALLEGRO_KEY_0; + io.KeyMap[ImGuiKey_1] = ALLEGRO_KEY_1; + io.KeyMap[ImGuiKey_2] = ALLEGRO_KEY_2; + io.KeyMap[ImGuiKey_3] = ALLEGRO_KEY_3; + io.KeyMap[ImGuiKey_4] = ALLEGRO_KEY_4; + io.KeyMap[ImGuiKey_5] = ALLEGRO_KEY_5; + io.KeyMap[ImGuiKey_6] = ALLEGRO_KEY_6; + io.KeyMap[ImGuiKey_7] = ALLEGRO_KEY_7; + io.KeyMap[ImGuiKey_8] = ALLEGRO_KEY_8; + io.KeyMap[ImGuiKey_9] = ALLEGRO_KEY_9; io.KeyMap[ImGuiKey_A] = ALLEGRO_KEY_A; + io.KeyMap[ImGuiKey_B] = ALLEGRO_KEY_B; io.KeyMap[ImGuiKey_C] = ALLEGRO_KEY_C; + io.KeyMap[ImGuiKey_D] = ALLEGRO_KEY_D; + io.KeyMap[ImGuiKey_E] = ALLEGRO_KEY_E; + io.KeyMap[ImGuiKey_F] = ALLEGRO_KEY_F; + io.KeyMap[ImGuiKey_G] = ALLEGRO_KEY_G; + io.KeyMap[ImGuiKey_H] = ALLEGRO_KEY_H; + io.KeyMap[ImGuiKey_I] = ALLEGRO_KEY_I; + io.KeyMap[ImGuiKey_J] = ALLEGRO_KEY_J; + io.KeyMap[ImGuiKey_K] = ALLEGRO_KEY_K; + io.KeyMap[ImGuiKey_L] = ALLEGRO_KEY_L; + io.KeyMap[ImGuiKey_M] = ALLEGRO_KEY_M; + io.KeyMap[ImGuiKey_N] = ALLEGRO_KEY_N; + io.KeyMap[ImGuiKey_O] = ALLEGRO_KEY_O; + io.KeyMap[ImGuiKey_P] = ALLEGRO_KEY_P; + io.KeyMap[ImGuiKey_Q] = ALLEGRO_KEY_Q; + io.KeyMap[ImGuiKey_R] = ALLEGRO_KEY_R; + io.KeyMap[ImGuiKey_S] = ALLEGRO_KEY_S; + io.KeyMap[ImGuiKey_T] = ALLEGRO_KEY_T; + io.KeyMap[ImGuiKey_U] = ALLEGRO_KEY_U; io.KeyMap[ImGuiKey_V] = ALLEGRO_KEY_V; + io.KeyMap[ImGuiKey_W] = ALLEGRO_KEY_W; io.KeyMap[ImGuiKey_X] = ALLEGRO_KEY_X; io.KeyMap[ImGuiKey_Y] = ALLEGRO_KEY_Y; io.KeyMap[ImGuiKey_Z] = ALLEGRO_KEY_Z; + io.KeyMap[ImGuiKey_F1] = ALLEGRO_KEY_F1; + io.KeyMap[ImGuiKey_F2] = ALLEGRO_KEY_F2; + io.KeyMap[ImGuiKey_F3] = ALLEGRO_KEY_F3; + io.KeyMap[ImGuiKey_F4] = ALLEGRO_KEY_F4; + io.KeyMap[ImGuiKey_F5] = ALLEGRO_KEY_F5; + io.KeyMap[ImGuiKey_F6] = ALLEGRO_KEY_F6; + io.KeyMap[ImGuiKey_F7] = ALLEGRO_KEY_F7; + io.KeyMap[ImGuiKey_F8] = ALLEGRO_KEY_F8; + io.KeyMap[ImGuiKey_F9] = ALLEGRO_KEY_F9; + io.KeyMap[ImGuiKey_F10] = ALLEGRO_KEY_F10; + io.KeyMap[ImGuiKey_F11] = ALLEGRO_KEY_F11; + io.KeyMap[ImGuiKey_F12] = ALLEGRO_KEY_F12; io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX); #if ALLEGRO_HAS_CLIPBOARD diff --git a/examples/imgui_impl_glfw.cpp b/examples/imgui_impl_glfw.cpp index c496232cbdcd..83e1e5894dda 100644 --- a/examples/imgui_impl_glfw.cpp +++ b/examples/imgui_impl_glfw.cpp @@ -166,12 +166,54 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER; io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE; io.KeyMap[ImGuiKey_KeyPadEnter] = GLFW_KEY_KP_ENTER; + io.KeyMap[ImGuiKey_0] = GLFW_KEY_0; + io.KeyMap[ImGuiKey_1] = GLFW_KEY_1; + io.KeyMap[ImGuiKey_2] = GLFW_KEY_2; + io.KeyMap[ImGuiKey_3] = GLFW_KEY_3; + io.KeyMap[ImGuiKey_4] = GLFW_KEY_4; + io.KeyMap[ImGuiKey_5] = GLFW_KEY_5; + io.KeyMap[ImGuiKey_6] = GLFW_KEY_6; + io.KeyMap[ImGuiKey_7] = GLFW_KEY_7; + io.KeyMap[ImGuiKey_8] = GLFW_KEY_8; + io.KeyMap[ImGuiKey_9] = GLFW_KEY_9; io.KeyMap[ImGuiKey_A] = GLFW_KEY_A; + io.KeyMap[ImGuiKey_B] = GLFW_KEY_B; io.KeyMap[ImGuiKey_C] = GLFW_KEY_C; + io.KeyMap[ImGuiKey_D] = GLFW_KEY_D; + io.KeyMap[ImGuiKey_E] = GLFW_KEY_E; + io.KeyMap[ImGuiKey_F] = GLFW_KEY_F; + io.KeyMap[ImGuiKey_G] = GLFW_KEY_G; + io.KeyMap[ImGuiKey_H] = GLFW_KEY_H; + io.KeyMap[ImGuiKey_I] = GLFW_KEY_I; + io.KeyMap[ImGuiKey_J] = GLFW_KEY_J; + io.KeyMap[ImGuiKey_K] = GLFW_KEY_K; + io.KeyMap[ImGuiKey_L] = GLFW_KEY_L; + io.KeyMap[ImGuiKey_M] = GLFW_KEY_M; + io.KeyMap[ImGuiKey_N] = GLFW_KEY_N; + io.KeyMap[ImGuiKey_O] = GLFW_KEY_O; + io.KeyMap[ImGuiKey_P] = GLFW_KEY_P; + io.KeyMap[ImGuiKey_Q] = GLFW_KEY_Q; + io.KeyMap[ImGuiKey_R] = GLFW_KEY_R; + io.KeyMap[ImGuiKey_S] = GLFW_KEY_S; + io.KeyMap[ImGuiKey_T] = GLFW_KEY_T; + io.KeyMap[ImGuiKey_U] = GLFW_KEY_U; io.KeyMap[ImGuiKey_V] = GLFW_KEY_V; + io.KeyMap[ImGuiKey_W] = GLFW_KEY_W; io.KeyMap[ImGuiKey_X] = GLFW_KEY_X; io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y; io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z; + io.KeyMap[ImGuiKey_F1] = GLFW_KEY_F1; + io.KeyMap[ImGuiKey_F2] = GLFW_KEY_F2; + io.KeyMap[ImGuiKey_F3] = GLFW_KEY_F3; + io.KeyMap[ImGuiKey_F4] = GLFW_KEY_F4; + io.KeyMap[ImGuiKey_F5] = GLFW_KEY_F5; + io.KeyMap[ImGuiKey_F6] = GLFW_KEY_F6; + io.KeyMap[ImGuiKey_F7] = GLFW_KEY_F7; + io.KeyMap[ImGuiKey_F8] = GLFW_KEY_F8; + io.KeyMap[ImGuiKey_F9] = GLFW_KEY_F9; + io.KeyMap[ImGuiKey_F10] = GLFW_KEY_F10; + io.KeyMap[ImGuiKey_F11] = GLFW_KEY_F11; + io.KeyMap[ImGuiKey_F12] = GLFW_KEY_F12; io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText; diff --git a/examples/imgui_impl_glut.cpp b/examples/imgui_impl_glut.cpp index 3c17bbfc1d0d..76b2d8760540 100644 --- a/examples/imgui_impl_glut.cpp +++ b/examples/imgui_impl_glut.cpp @@ -65,12 +65,54 @@ bool ImGui_ImplGLUT_Init() io.KeyMap[ImGuiKey_Enter] = 13; // == CTRL+M io.KeyMap[ImGuiKey_Escape] = 27; io.KeyMap[ImGuiKey_KeyPadEnter] = 13; // == CTRL+M + io.KeyMap[ImGuiKey_0] = '0'; + io.KeyMap[ImGuiKey_1] = '1'; + io.KeyMap[ImGuiKey_2] = '2'; + io.KeyMap[ImGuiKey_3] = '3'; + io.KeyMap[ImGuiKey_4] = '4'; + io.KeyMap[ImGuiKey_5] = '5'; + io.KeyMap[ImGuiKey_6] = '6'; + io.KeyMap[ImGuiKey_7] = '7'; + io.KeyMap[ImGuiKey_8] = '8'; + io.KeyMap[ImGuiKey_9] = '9'; io.KeyMap[ImGuiKey_A] = 'A'; + io.KeyMap[ImGuiKey_B] = 'B'; io.KeyMap[ImGuiKey_C] = 'C'; + io.KeyMap[ImGuiKey_D] = 'D'; + io.KeyMap[ImGuiKey_E] = 'E'; + io.KeyMap[ImGuiKey_F] = 'F'; + io.KeyMap[ImGuiKey_G] = 'G'; + io.KeyMap[ImGuiKey_H] = 'H'; + io.KeyMap[ImGuiKey_I] = 'I'; + io.KeyMap[ImGuiKey_J] = 'J'; + io.KeyMap[ImGuiKey_K] = 'K'; + io.KeyMap[ImGuiKey_L] = 'L'; + io.KeyMap[ImGuiKey_M] = 'M'; + io.KeyMap[ImGuiKey_N] = 'N'; + io.KeyMap[ImGuiKey_O] = 'O'; + io.KeyMap[ImGuiKey_P] = 'P'; + io.KeyMap[ImGuiKey_Q] = 'Q'; + io.KeyMap[ImGuiKey_R] = 'R'; + io.KeyMap[ImGuiKey_S] = 'S'; + io.KeyMap[ImGuiKey_T] = 'T'; + io.KeyMap[ImGuiKey_U] = 'U'; io.KeyMap[ImGuiKey_V] = 'V'; + io.KeyMap[ImGuiKey_W] = 'W'; io.KeyMap[ImGuiKey_X] = 'X'; io.KeyMap[ImGuiKey_Y] = 'Y'; io.KeyMap[ImGuiKey_Z] = 'Z'; + io.KeyMap[ImGuiKey_F1] = 256 + GLUT_KEY_F1; + io.KeyMap[ImGuiKey_F2] = 256 + GLUT_KEY_F2; + io.KeyMap[ImGuiKey_F3] = 256 + GLUT_KEY_F3; + io.KeyMap[ImGuiKey_F4] = 256 + GLUT_KEY_F4; + io.KeyMap[ImGuiKey_F5] = 256 + GLUT_KEY_F5; + io.KeyMap[ImGuiKey_F6] = 256 + GLUT_KEY_F6; + io.KeyMap[ImGuiKey_F7] = 256 + GLUT_KEY_F7; + io.KeyMap[ImGuiKey_F8] = 256 + GLUT_KEY_F8; + io.KeyMap[ImGuiKey_F9] = 256 + GLUT_KEY_F9; + io.KeyMap[ImGuiKey_F10] = 256 + GLUT_KEY_F10; + io.KeyMap[ImGuiKey_F11] = 256 + GLUT_KEY_F11; + io.KeyMap[ImGuiKey_F12] = 256 + GLUT_KEY_F12; return true; } diff --git a/examples/imgui_impl_marmalade.cpp b/examples/imgui_impl_marmalade.cpp index 0675c6b4f038..76dcd811acfe 100644 --- a/examples/imgui_impl_marmalade.cpp +++ b/examples/imgui_impl_marmalade.cpp @@ -237,12 +237,52 @@ bool ImGui_Marmalade_Init(bool install_callbacks) io.KeyMap[ImGuiKey_Enter] = s3eKeyEnter; io.KeyMap[ImGuiKey_Escape] = s3eKeyEsc; io.KeyMap[ImGuiKey_KeyPadEnter] = s3eKeyNumPadEnter; + io.KeyMap[ImGuiKey_0] = s3eKey0; + io.KeyMap[ImGuiKey_1] = s3eKey1; + io.KeyMap[ImGuiKey_2] = s3eKey2; + io.KeyMap[ImGuiKey_3] = s3eKey3; + io.KeyMap[ImGuiKey_4] = s3eKey4; + io.KeyMap[ImGuiKey_5] = s3eKey5; + io.KeyMap[ImGuiKey_6] = s3eKey6; + io.KeyMap[ImGuiKey_7] = s3eKey7; + io.KeyMap[ImGuiKey_8] = s3eKey8; + io.KeyMap[ImGuiKey_9] = s3eKey9; io.KeyMap[ImGuiKey_A] = s3eKeyA; + io.KeyMap[ImGuiKey_B] = s3eKeyB; io.KeyMap[ImGuiKey_C] = s3eKeyC; + io.KeyMap[ImGuiKey_D] = s3eKeyD; + io.KeyMap[ImGuiKey_E] = s3eKeyE; + io.KeyMap[ImGuiKey_F] = s3eKeyF; + io.KeyMap[ImGuiKey_G] = s3eKeyG; + io.KeyMap[ImGuiKey_H] = s3eKeyH; + io.KeyMap[ImGuiKey_I] = s3eKeyI; + io.KeyMap[ImGuiKey_J] = s3eKeyJ; + io.KeyMap[ImGuiKey_K] = s3eKeyK; + io.KeyMap[ImGuiKey_L] = s3eKeyL; + io.KeyMap[ImGuiKey_M] = s3eKeyM; + io.KeyMap[ImGuiKey_N] = s3eKeyN; + io.KeyMap[ImGuiKey_O] = s3eKeyO; + io.KeyMap[ImGuiKey_P] = s3eKeyP; + io.KeyMap[ImGuiKey_Q] = s3eKeyQ; + io.KeyMap[ImGuiKey_R] = s3eKeyR; + io.KeyMap[ImGuiKey_S] = s3eKeyS; + io.KeyMap[ImGuiKey_T] = s3eKeyT; + io.KeyMap[ImGuiKey_U] = s3eKeyU; io.KeyMap[ImGuiKey_V] = s3eKeyV; + io.KeyMap[ImGuiKey_W] = s3eKeyW; io.KeyMap[ImGuiKey_X] = s3eKeyX; io.KeyMap[ImGuiKey_Y] = s3eKeyY; io.KeyMap[ImGuiKey_Z] = s3eKeyZ; + io.KeyMap[ImGuiKey_F1] = s3eKeyF1; + io.KeyMap[ImGuiKey_F2] = s3eKeyF2; + io.KeyMap[ImGuiKey_F3] = s3eKeyF3; + io.KeyMap[ImGuiKey_F4] = s3eKeyF4; + io.KeyMap[ImGuiKey_F5] = s3eKeyF5; + io.KeyMap[ImGuiKey_F6] = s3eKeyF6; + io.KeyMap[ImGuiKey_F7] = s3eKeyF7; + io.KeyMap[ImGuiKey_F8] = s3eKeyF8; + io.KeyMap[ImGuiKey_F9] = s3eKeyF9; + io.KeyMap[ImGuiKey_F10] = s3eKeyF10; io.SetClipboardTextFn = ImGui_Marmalade_SetClipboardText; io.GetClipboardTextFn = ImGui_Marmalade_GetClipboardText; diff --git a/examples/imgui_impl_osx.mm b/examples/imgui_impl_osx.mm index 54b23d0707b8..ddda3e194801 100644 --- a/examples/imgui_impl_osx.mm +++ b/examples/imgui_impl_osx.mm @@ -66,12 +66,54 @@ bool ImGui_ImplOSX_Init() io.KeyMap[ImGuiKey_Enter] = 13; io.KeyMap[ImGuiKey_Escape] = 27; io.KeyMap[ImGuiKey_KeyPadEnter] = 13; + io.KeyMap[ImGuiKey_0] = '0'; + io.KeyMap[ImGuiKey_1] = '1'; + io.KeyMap[ImGuiKey_2] = '2'; + io.KeyMap[ImGuiKey_3] = '3'; + io.KeyMap[ImGuiKey_4] = '4'; + io.KeyMap[ImGuiKey_5] = '5'; + io.KeyMap[ImGuiKey_6] = '6'; + io.KeyMap[ImGuiKey_7] = '7'; + io.KeyMap[ImGuiKey_8] = '8'; + io.KeyMap[ImGuiKey_9] = '9'; io.KeyMap[ImGuiKey_A] = 'A'; + io.KeyMap[ImGuiKey_B] = 'B'; io.KeyMap[ImGuiKey_C] = 'C'; + io.KeyMap[ImGuiKey_D] = 'D'; + io.KeyMap[ImGuiKey_E] = 'E'; + io.KeyMap[ImGuiKey_F] = 'F'; + io.KeyMap[ImGuiKey_G] = 'G'; + io.KeyMap[ImGuiKey_H] = 'H'; + io.KeyMap[ImGuiKey_I] = 'I'; + io.KeyMap[ImGuiKey_J] = 'J'; + io.KeyMap[ImGuiKey_K] = 'K'; + io.KeyMap[ImGuiKey_L] = 'L'; + io.KeyMap[ImGuiKey_M] = 'M'; + io.KeyMap[ImGuiKey_N] = 'N'; + io.KeyMap[ImGuiKey_O] = 'O'; + io.KeyMap[ImGuiKey_P] = 'P'; + io.KeyMap[ImGuiKey_Q] = 'Q'; + io.KeyMap[ImGuiKey_R] = 'R'; + io.KeyMap[ImGuiKey_S] = 'S'; + io.KeyMap[ImGuiKey_T] = 'T'; + io.KeyMap[ImGuiKey_U] = 'U'; io.KeyMap[ImGuiKey_V] = 'V'; + io.KeyMap[ImGuiKey_W] = 'W'; io.KeyMap[ImGuiKey_X] = 'X'; io.KeyMap[ImGuiKey_Y] = 'Y'; io.KeyMap[ImGuiKey_Z] = 'Z'; + io.KeyMap[ImGuiKey_F1] = NSF1FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F2] = NSF2FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F3] = NSF3FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F4] = NSF4FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F5] = NSF5FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F6] = NSF6FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F7] = NSF7FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F8] = NSF8FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F9] = NSF9FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F10] = NSF10FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F11] = NSF11FunctionKey + offset_for_function_keys; + io.KeyMap[ImGuiKey_F12] = NSF12FunctionKey + offset_for_function_keys; // Load cursors. Some of them are undocumented. g_MouseCursorHidden = false; diff --git a/examples/imgui_impl_sdl.cpp b/examples/imgui_impl_sdl.cpp index 9fd2cc483b14..a2b42d00d10c 100644 --- a/examples/imgui_impl_sdl.cpp +++ b/examples/imgui_impl_sdl.cpp @@ -154,12 +154,54 @@ static bool ImGui_ImplSDL2_Init(SDL_Window* window) io.KeyMap[ImGuiKey_Enter] = SDL_SCANCODE_RETURN; io.KeyMap[ImGuiKey_Escape] = SDL_SCANCODE_ESCAPE; io.KeyMap[ImGuiKey_KeyPadEnter] = SDL_SCANCODE_KP_ENTER; + io.KeyMap[ImGuiKey_0] = SDL_SCANCODE_0; + io.KeyMap[ImGuiKey_1] = SDL_SCANCODE_1; + io.KeyMap[ImGuiKey_2] = SDL_SCANCODE_2; + io.KeyMap[ImGuiKey_3] = SDL_SCANCODE_3; + io.KeyMap[ImGuiKey_4] = SDL_SCANCODE_4; + io.KeyMap[ImGuiKey_5] = SDL_SCANCODE_5; + io.KeyMap[ImGuiKey_6] = SDL_SCANCODE_6; + io.KeyMap[ImGuiKey_7] = SDL_SCANCODE_7; + io.KeyMap[ImGuiKey_8] = SDL_SCANCODE_8; + io.KeyMap[ImGuiKey_9] = SDL_SCANCODE_9; io.KeyMap[ImGuiKey_A] = SDL_SCANCODE_A; + io.KeyMap[ImGuiKey_B] = SDL_SCANCODE_B; io.KeyMap[ImGuiKey_C] = SDL_SCANCODE_C; + io.KeyMap[ImGuiKey_D] = SDL_SCANCODE_D; + io.KeyMap[ImGuiKey_E] = SDL_SCANCODE_E; + io.KeyMap[ImGuiKey_F] = SDL_SCANCODE_F; + io.KeyMap[ImGuiKey_G] = SDL_SCANCODE_G; + io.KeyMap[ImGuiKey_H] = SDL_SCANCODE_H; + io.KeyMap[ImGuiKey_I] = SDL_SCANCODE_I; + io.KeyMap[ImGuiKey_J] = SDL_SCANCODE_J; + io.KeyMap[ImGuiKey_K] = SDL_SCANCODE_K; + io.KeyMap[ImGuiKey_L] = SDL_SCANCODE_L; + io.KeyMap[ImGuiKey_M] = SDL_SCANCODE_M; + io.KeyMap[ImGuiKey_N] = SDL_SCANCODE_N; + io.KeyMap[ImGuiKey_O] = SDL_SCANCODE_O; + io.KeyMap[ImGuiKey_P] = SDL_SCANCODE_P; + io.KeyMap[ImGuiKey_Q] = SDL_SCANCODE_Q; + io.KeyMap[ImGuiKey_R] = SDL_SCANCODE_R; + io.KeyMap[ImGuiKey_S] = SDL_SCANCODE_S; + io.KeyMap[ImGuiKey_T] = SDL_SCANCODE_T; + io.KeyMap[ImGuiKey_U] = SDL_SCANCODE_U; io.KeyMap[ImGuiKey_V] = SDL_SCANCODE_V; + io.KeyMap[ImGuiKey_W] = SDL_SCANCODE_W; io.KeyMap[ImGuiKey_X] = SDL_SCANCODE_X; io.KeyMap[ImGuiKey_Y] = SDL_SCANCODE_Y; io.KeyMap[ImGuiKey_Z] = SDL_SCANCODE_Z; + io.KeyMap[ImGuiKey_F1] = SDL_SCANCODE_F1; + io.KeyMap[ImGuiKey_F2] = SDL_SCANCODE_F2; + io.KeyMap[ImGuiKey_F3] = SDL_SCANCODE_F3; + io.KeyMap[ImGuiKey_F4] = SDL_SCANCODE_F4; + io.KeyMap[ImGuiKey_F5] = SDL_SCANCODE_F5; + io.KeyMap[ImGuiKey_F6] = SDL_SCANCODE_F6; + io.KeyMap[ImGuiKey_F7] = SDL_SCANCODE_F7; + io.KeyMap[ImGuiKey_F8] = SDL_SCANCODE_F8; + io.KeyMap[ImGuiKey_F9] = SDL_SCANCODE_F9; + io.KeyMap[ImGuiKey_F10] = SDL_SCANCODE_F10; + io.KeyMap[ImGuiKey_F11] = SDL_SCANCODE_F11; + io.KeyMap[ImGuiKey_F12] = SDL_SCANCODE_F12; io.SetClipboardTextFn = ImGui_ImplSDL2_SetClipboardText; io.GetClipboardTextFn = ImGui_ImplSDL2_GetClipboardText; diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp index f8868ce69fe4..8beaf78f3fc6 100644 --- a/examples/imgui_impl_win32.cpp +++ b/examples/imgui_impl_win32.cpp @@ -93,12 +93,54 @@ bool ImGui_ImplWin32_Init(void* hwnd) io.KeyMap[ImGuiKey_Enter] = VK_RETURN; io.KeyMap[ImGuiKey_Escape] = VK_ESCAPE; io.KeyMap[ImGuiKey_KeyPadEnter] = VK_RETURN; + io.KeyMap[ImGuiKey_0] = '0'; + io.KeyMap[ImGuiKey_1] = '1'; + io.KeyMap[ImGuiKey_2] = '2'; + io.KeyMap[ImGuiKey_3] = '3'; + io.KeyMap[ImGuiKey_4] = '4'; + io.KeyMap[ImGuiKey_5] = '5'; + io.KeyMap[ImGuiKey_6] = '6'; + io.KeyMap[ImGuiKey_7] = '7'; + io.KeyMap[ImGuiKey_8] = '8'; + io.KeyMap[ImGuiKey_9] = '9'; io.KeyMap[ImGuiKey_A] = 'A'; + io.KeyMap[ImGuiKey_B] = 'B'; io.KeyMap[ImGuiKey_C] = 'C'; + io.KeyMap[ImGuiKey_D] = 'D'; + io.KeyMap[ImGuiKey_E] = 'E'; + io.KeyMap[ImGuiKey_F] = 'F'; + io.KeyMap[ImGuiKey_G] = 'G'; + io.KeyMap[ImGuiKey_H] = 'H'; + io.KeyMap[ImGuiKey_I] = 'I'; + io.KeyMap[ImGuiKey_J] = 'J'; + io.KeyMap[ImGuiKey_K] = 'K'; + io.KeyMap[ImGuiKey_L] = 'L'; + io.KeyMap[ImGuiKey_M] = 'M'; + io.KeyMap[ImGuiKey_N] = 'N'; + io.KeyMap[ImGuiKey_O] = 'O'; + io.KeyMap[ImGuiKey_P] = 'P'; + io.KeyMap[ImGuiKey_Q] = 'Q'; + io.KeyMap[ImGuiKey_R] = 'R'; + io.KeyMap[ImGuiKey_S] = 'S'; + io.KeyMap[ImGuiKey_T] = 'T'; + io.KeyMap[ImGuiKey_U] = 'U'; io.KeyMap[ImGuiKey_V] = 'V'; + io.KeyMap[ImGuiKey_W] = 'W'; io.KeyMap[ImGuiKey_X] = 'X'; io.KeyMap[ImGuiKey_Y] = 'Y'; io.KeyMap[ImGuiKey_Z] = 'Z'; + io.KeyMap[ImGuiKey_F1] = VK_F1; + io.KeyMap[ImGuiKey_F2] = VK_F2; + io.KeyMap[ImGuiKey_F3] = VK_F3; + io.KeyMap[ImGuiKey_F4] = VK_F4; + io.KeyMap[ImGuiKey_F5] = VK_F5; + io.KeyMap[ImGuiKey_F6] = VK_F6; + io.KeyMap[ImGuiKey_F7] = VK_F7; + io.KeyMap[ImGuiKey_F8] = VK_F8; + io.KeyMap[ImGuiKey_F9] = VK_F9; + io.KeyMap[ImGuiKey_F10] = VK_F10; + io.KeyMap[ImGuiKey_F11] = VK_F11; + io.KeyMap[ImGuiKey_F12] = VK_F12; return true; } diff --git a/imgui.h b/imgui.h index 92c56740d32d..701bcdabfec7 100644 --- a/imgui.h +++ b/imgui.h @@ -1000,12 +1000,54 @@ enum ImGuiKey_ ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_KeyPadEnter, - ImGuiKey_A, // for text edit CTRL+A: select all - ImGuiKey_C, // for text edit CTRL+C: copy - ImGuiKey_V, // for text edit CTRL+V: paste - ImGuiKey_X, // for text edit CTRL+X: cut - ImGuiKey_Y, // for text edit CTRL+Y: redo - ImGuiKey_Z, // for text edit CTRL+Z: undo + ImGuiKey_0, // + ImGuiKey_1, // + ImGuiKey_2, // + ImGuiKey_3, // + ImGuiKey_4, // + ImGuiKey_5, // + ImGuiKey_6, // + ImGuiKey_7, // + ImGuiKey_8, // + ImGuiKey_9, // + ImGuiKey_A, // for text edit CTRL+A: select all + ImGuiKey_B, // + ImGuiKey_C, // for text edit CTRL+C: copy + ImGuiKey_D, // + ImGuiKey_E, // + ImGuiKey_F, // + ImGuiKey_G, // + ImGuiKey_H, // + ImGuiKey_I, // + ImGuiKey_J, // + ImGuiKey_K, // + ImGuiKey_L, // + ImGuiKey_M, // + ImGuiKey_N, // + ImGuiKey_O, // + ImGuiKey_P, // + ImGuiKey_Q, // + ImGuiKey_R, // + ImGuiKey_S, // + ImGuiKey_T, // + ImGuiKey_U, // + ImGuiKey_V, // for text edit CTRL+V: paste + ImGuiKey_W, // + ImGuiKey_X, // for text edit CTRL+X: cut + ImGuiKey_Y, // for text edit CTRL+Y: redo + ImGuiKey_Z, // for text edit CTRL+Z: undo + ImGuiKey_F1, // + ImGuiKey_F2, // + ImGuiKey_F3, // + ImGuiKey_F4, // + ImGuiKey_F5, // + ImGuiKey_F6, // + ImGuiKey_F7, // + ImGuiKey_F8, // + ImGuiKey_F9, // + ImGuiKey_F10, // + ImGuiKey_F11, // + ImGuiKey_F12, // ImGuiKey_COUNT };