bugfix for ctrl + # grouping of units in win32
This commit is contained in:
parent
99c03d25bc
commit
9a2b958869
|
@ -309,17 +309,23 @@ void Gui::mouseDoubleClickLeftGraphics(int x, int y){
|
|||
}
|
||||
|
||||
void Gui::groupKey(int groupIndex){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);
|
||||
|
||||
if(isKeyDown(vkControl)){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);
|
||||
|
||||
selection.assignGroup(groupIndex);
|
||||
}
|
||||
else{
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);
|
||||
|
||||
selection.recallGroup(groupIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void Gui::hotKey(char key){
|
||||
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] key = [%c]\n",__FILE__,__FUNCTION__,key);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] key = [%c][%d]\n",__FILE__,__FUNCTION__,key,key);
|
||||
|
||||
if(key=='G'){
|
||||
centerCameraOnSelection();
|
||||
|
|
|
@ -200,10 +200,10 @@ void MainWindow::eventMouseWheel(int x, int y, int zDelta) {
|
|||
}
|
||||
|
||||
void MainWindow::eventKeyDown(char key){
|
||||
//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);
|
||||
program->keyDown(key);
|
||||
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
if(key == vkReturn) {
|
||||
SDL_keysym keystate = Window::getKeystate();
|
||||
|
|
|
@ -820,7 +820,45 @@ void showCursor(bool b){
|
|||
}
|
||||
|
||||
bool isKeyDown(int virtualKey){
|
||||
return (GetKeyState(virtualKey) & 0x8000) != 0;
|
||||
//return (GetKeyState(virtualKey) & 0x8000) != 0;
|
||||
|
||||
char key = static_cast<char> (virtualKey);
|
||||
const Uint8* keystate = SDL_GetKeyState(0);
|
||||
|
||||
// kinda hack and wrong...
|
||||
if(key >= 0) {
|
||||
return keystate[key];
|
||||
}
|
||||
switch(key) {
|
||||
case vkAdd:
|
||||
return keystate[SDLK_PLUS] | keystate[SDLK_KP_PLUS];
|
||||
case vkSubtract:
|
||||
return keystate[SDLK_MINUS] | keystate[SDLK_KP_MINUS];
|
||||
case vkAlt:
|
||||
return keystate[SDLK_LALT] | keystate[SDLK_RALT];
|
||||
case vkControl:
|
||||
return keystate[SDLK_LCTRL] | keystate[SDLK_RCTRL];
|
||||
case vkShift:
|
||||
return keystate[SDLK_LSHIFT] | keystate[SDLK_RSHIFT];
|
||||
case vkEscape:
|
||||
return keystate[SDLK_ESCAPE];
|
||||
case vkUp:
|
||||
return keystate[SDLK_UP];
|
||||
case vkLeft:
|
||||
return keystate[SDLK_LEFT];
|
||||
case vkRight:
|
||||
return keystate[SDLK_RIGHT];
|
||||
case vkDown:
|
||||
return keystate[SDLK_DOWN];
|
||||
case vkReturn:
|
||||
return keystate[SDLK_RETURN] | keystate[SDLK_KP_ENTER];
|
||||
case vkBack:
|
||||
return keystate[SDLK_BACKSPACE];
|
||||
default:
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"isKeyDown called with unknown key.\n");
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// =====================================
|
||||
|
|
Loading…
Reference in New Issue