mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 07:01:21 +02:00
bugfix for ctrl + # grouping of units in win32
This commit is contained in:
@@ -309,17 +309,23 @@ void Gui::mouseDoubleClickLeftGraphics(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gui::groupKey(int groupIndex){
|
void Gui::groupKey(int groupIndex){
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);
|
||||||
|
|
||||||
if(isKeyDown(vkControl)){
|
if(isKeyDown(vkControl)){
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);
|
||||||
|
|
||||||
selection.assignGroup(groupIndex);
|
selection.assignGroup(groupIndex);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);
|
||||||
|
|
||||||
selection.recallGroup(groupIndex);
|
selection.recallGroup(groupIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::hotKey(char key){
|
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'){
|
if(key=='G'){
|
||||||
centerCameraOnSelection();
|
centerCameraOnSelection();
|
||||||
|
@@ -200,10 +200,10 @@ void MainWindow::eventMouseWheel(int x, int y, int zDelta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::eventKeyDown(char key){
|
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);
|
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) {
|
if(key == vkReturn) {
|
||||||
SDL_keysym keystate = Window::getKeystate();
|
SDL_keysym keystate = Window::getKeystate();
|
||||||
|
@@ -820,7 +820,45 @@ void showCursor(bool b){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isKeyDown(int virtualKey){
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =====================================
|
// =====================================
|
||||||
|
Reference in New Issue
Block a user