@ -152,7 +152,8 @@ bool ImGui_ImplSdlGL2_ProcessEvent(SDL_Event* event)
case SDL_KEYDOWN :
case SDL_KEYUP :
{
int key = event - > key . keysym . sym & ~ SDLK_SCANCODE_MASK ;
int key = event - > key . keysym . scancode ;
IM_ASSERT ( key > = 0 & & key < IM_ARRAYSIZE ( io . KeysDown ) ) ;
io . KeysDown [ key ] = ( event - > type = = SDL_KEYDOWN ) ;
io . KeyShift = ( ( SDL_GetModState ( ) & KMOD_SHIFT ) ! = 0 ) ;
io . KeyCtrl = ( ( SDL_GetModState ( ) & KMOD_CTRL ) ! = 0 ) ;
@ -203,8 +204,9 @@ void ImGui_ImplSdlGL2_InvalidateDeviceObjects()
bool ImGui_ImplSdlGL2_Init ( SDL_Window * window )
{
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
ImGuiIO & io = ImGui : : GetIO ( ) ;
io . KeyMap [ ImGuiKey_Tab ] = SDL K_TAB; // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
io . KeyMap [ ImGuiKey_Tab ] = SDL _SCANCODE_TAB;
io . KeyMap [ ImGuiKey_LeftArrow ] = SDL_SCANCODE_LEFT ;
io . KeyMap [ ImGuiKey_RightArrow ] = SDL_SCANCODE_RIGHT ;
io . KeyMap [ ImGuiKey_UpArrow ] = SDL_SCANCODE_UP ;
@ -214,16 +216,16 @@ bool ImGui_ImplSdlGL2_Init(SDL_Window* window)
io . KeyMap [ ImGuiKey_Home ] = SDL_SCANCODE_HOME ;
io . KeyMap [ ImGuiKey_End ] = SDL_SCANCODE_END ;
io . KeyMap [ ImGuiKey_Insert ] = SDL_SCANCODE_INSERT ;
io . KeyMap [ ImGuiKey_Delete ] = SDL K _DELETE;
io . KeyMap [ ImGuiKey_Backspace ] = SDL K _BACKSPACE;
io . KeyMap [ ImGuiKey_Enter ] = SDL K _RETURN;
io . KeyMap [ ImGuiKey_Escape ] = SDL K _ESCAPE;
io . KeyMap [ ImGuiKey_A ] = SDL K_a ;
io . KeyMap [ ImGuiKey_C ] = SDL K_c ;
io . KeyMap [ ImGuiKey_V ] = SDL K_v ;
io . KeyMap [ ImGuiKey_X ] = SDL K_x ;
io . KeyMap [ ImGuiKey_Y ] = SDL K_y ;
io . KeyMap [ ImGuiKey_Z ] = SDL K_z ;
io . KeyMap [ ImGuiKey_Delete ] = SDL _SCANCODE _DELETE;
io . KeyMap [ ImGuiKey_Backspace ] = SDL _SCANCODE _BACKSPACE;
io . KeyMap [ ImGuiKey_Enter ] = SDL _SCANCODE _RETURN;
io . KeyMap [ ImGuiKey_Escape ] = SDL _SCANCODE _ESCAPE;
io . KeyMap [ ImGuiKey_A ] = SDL _SCANCODE_A ;
io . KeyMap [ ImGuiKey_C ] = SDL _SCANCODE_C ;
io . KeyMap [ ImGuiKey_V ] = SDL _SCANCODE_V ;
io . KeyMap [ ImGuiKey_X ] = SDL _SCANCODE_X ;
io . KeyMap [ ImGuiKey_Y ] = SDL _SCANCODE_Y ;
io . KeyMap [ ImGuiKey_Z ] = SDL _SCANCODE_Z ;
io . RenderDrawListsFn = ImGui_ImplSdlGL2_RenderDrawLists ; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.
io . SetClipboardTextFn = ImGui_ImplSdlGL2_SetClipboardText ;