mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 14:11:15 +02:00
- fixed bug in sdl where it doesn't always give the correct key modifiers.
- can now press alt-enter on intro screen
This commit is contained in:
@@ -779,6 +779,20 @@ void Intro::render() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Intro::keyDown(SDL_KeyboardEvent key) {
|
void Intro::keyDown(SDL_KeyboardEvent key) {
|
||||||
|
SDL_keysym keystate = key.keysym;
|
||||||
|
//printf("keystate.mod = %d key = unicode[%d] regular[%d] lalt [%d] ralt [%d] alt [%d]\n",keystate.mod,key.keysym.unicode,key.keysym.sym,(keystate.mod & KMOD_LALT),(keystate.mod & KMOD_RALT),(keystate.mod & KMOD_ALT));
|
||||||
|
|
||||||
|
if(keystate.mod & (KMOD_LALT | KMOD_RALT)) {
|
||||||
|
//printf("ALT KEY #1\n");
|
||||||
|
|
||||||
|
if(isKeyPressed(SDLK_RETURN,key) == true ||
|
||||||
|
isKeyPressed(SDLK_RALT,key) == true ||
|
||||||
|
isKeyPressed(SDLK_LALT,key) == true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//printf("Exiting intro\n");
|
||||||
mouseUpLeft(0, 0);
|
mouseUpLeft(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -960,6 +960,7 @@ void MainWindow::eventKeyDown(SDL_KeyboardEvent key) {
|
|||||||
|
|
||||||
//SDL_keysym keystate = Window::getKeystate();
|
//SDL_keysym keystate = Window::getKeystate();
|
||||||
SDL_keysym keystate = key.keysym;
|
SDL_keysym keystate = key.keysym;
|
||||||
|
//printf("keystate.mod = %d key = %d lalt [%d] ralt [%d] alt [%d]\n",keystate.mod,key.keysym.unicode,(keystate.mod & KMOD_LALT),(keystate.mod & KMOD_RALT),(keystate.mod & KMOD_ALT));
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c][%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c][%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||||
|
|
||||||
|
@@ -185,9 +185,10 @@ bool Window::handleEvent() {
|
|||||||
|
|
||||||
codeLocation = "i";
|
codeLocation = "i";
|
||||||
Window::isKeyPressedDown = true;
|
Window::isKeyPressedDown = true;
|
||||||
#ifdef WIN32
|
//#ifdef WIN32
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("KD mod = %d : %d\n",event.key.keysym.mod,SDL_GetModState());
|
||||||
event.key.keysym.mod = SDL_GetModState();
|
event.key.keysym.mod = SDL_GetModState();
|
||||||
#endif
|
//#endif
|
||||||
keystate = event.key.keysym;
|
keystate = event.key.keysym;
|
||||||
|
|
||||||
string keyName = SDL_GetKeyName(event.key.keysym.sym);
|
string keyName = SDL_GetKeyName(event.key.keysym.sym);
|
||||||
@@ -213,6 +214,7 @@ bool Window::handleEvent() {
|
|||||||
//key = tolower(key);
|
//key = tolower(key);
|
||||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("******************* key [%d]\n",key);
|
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("******************* key [%d]\n",key);
|
||||||
|
|
||||||
|
//event.key.keysym.mod = SDL_GetModState();
|
||||||
global_window->eventKeyDown(event.key);
|
global_window->eventKeyDown(event.key);
|
||||||
global_window->eventKeyPress(event.key);
|
global_window->eventKeyPress(event.key);
|
||||||
|
|
||||||
@@ -231,9 +233,10 @@ bool Window::handleEvent() {
|
|||||||
codeLocation = "j";
|
codeLocation = "j";
|
||||||
|
|
||||||
Window::isKeyPressedDown = false;
|
Window::isKeyPressedDown = false;
|
||||||
#ifdef WIN32
|
//#ifdef WIN32
|
||||||
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("KU mod = %d : %d\n",event.key.keysym.mod,SDL_GetModState());
|
||||||
event.key.keysym.mod = SDL_GetModState();
|
event.key.keysym.mod = SDL_GetModState();
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
keystate = event.key.keysym;
|
keystate = event.key.keysym;
|
||||||
|
|
||||||
@@ -804,6 +807,8 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllow
|
|||||||
string compareKeyName = SDL_GetKeyName(compareKey);
|
string compareKeyName = SDL_GetKeyName(compareKey);
|
||||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||||
|
|
||||||
|
//printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
||||||
//printf ("ISPRESS compareKey [%d - %s] pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d result = %d\n",
|
//printf ("ISPRESS compareKey [%d - %s] pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d result = %d\n",
|
||||||
// compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod,result);
|
// compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod,result);
|
||||||
|
Reference in New Issue
Block a user