- fixed debug key

This commit is contained in:
Mark Vejvoda 2011-07-05 05:40:14 +00:00
parent 2c80543889
commit 8c99c7e91f
2 changed files with 9 additions and 4 deletions

View File

@ -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()) {

View File

@ -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));
}