From 8c99c7e91f2588965164786e326664980c265cc1 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 5 Jul 2011 05:40:14 +0000 Subject: [PATCH] - fixed debug key --- source/glest_game/game/chat_manager.cpp | 6 +++--- source/shared_lib/sources/platform/sdl/window.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/glest_game/game/chat_manager.cpp b/source/glest_game/game/chat_manager.cpp index 8f8efe04..4bc5e052 100644 --- a/source/glest_game/game/chat_manager.cpp +++ b/source/glest_game/game/chat_manager.cpp @@ -69,7 +69,7 @@ void ChatManager::keyUp(SDL_KeyboardEvent key) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key.keysym.sym,key.keysym.sym); //if(key == vkEscape || key == SDLK_ESCAPE) { - if(isKeyPressed(SDLK_ESCAPE,key) == true) { + if(isKeyPressed(SDLK_ESCAPE,key,false) == true) { text.clear(); editEnabled= false; } @@ -110,7 +110,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) { } //if(key==vkReturn) { - if(isKeyPressed(SDLK_RETURN,key) == true) { + if(isKeyPressed(SDLK_RETURN,key, false) == true) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key.keysym.sym,key.keysym.sym); //SDL_keysym keystate = Window::getKeystate(); @@ -155,7 +155,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) { } } //else if(key==vkBack) { - else if(isKeyPressed(SDLK_BACKSPACE,key) == true) { + else if(isKeyPressed(SDLK_BACKSPACE,key,false) == true) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key.keysym.sym,key.keysym.sym); if(!text.empty()) { diff --git a/source/shared_lib/sources/platform/sdl/window.cpp b/source/shared_lib/sources/platform/sdl/window.cpp index 7a90c198..f674bff4 100644 --- a/source/shared_lib/sources/platform/sdl/window.cpp +++ b/source/shared_lib/sources/platform/sdl/window.cpp @@ -947,7 +947,7 @@ char Window::getKey(SDL_keysym keysym,bool skipSpecialKeys) { bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllowed) { Uint16 c = SDLK_UNKNOWN; //if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) { - if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) { + if(input.keysym.unicode > 0) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); // When modifiers are pressed the unicode result is wrong @@ -961,6 +961,11 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllow c = input.keysym.unicode; //c = toupper(c); } + else if(c == SDLK_QUESTION && + (input.keysym.mod & KMOD_LSHIFT) == KMOD_LSHIFT || + (input.keysym.mod & KMOD_RSHIFT) == KMOD_RSHIFT) { + c = input.keysym.unicode; + } if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF)); }