mirror of
https://github.com/glest/glest-source.git
synced 2025-09-03 04:52:34 +02:00
- bugfix for hotkey processing (allow single quoted characters to fix grouping units)
This commit is contained in:
@@ -810,7 +810,7 @@ void Game::eventMouseWheel(int x, int y, int zDelta) {
|
||||
|
||||
void Game::keyDown(char key){
|
||||
try {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = %d\n",__FILE__,__FUNCTION__,__LINE__,key);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
|
||||
|
||||
Lang &lang= Lang::getInstance();
|
||||
bool speedChangesAllowed= !NetworkManager::getInstance().isNetworkGame();
|
||||
@@ -909,9 +909,12 @@ void Game::keyDown(char key){
|
||||
|
||||
for(int idx = 1; idx <= Selection::maxGroups; idx++) {
|
||||
string keyName = "GroupUnitsKey" + intToStr(idx);
|
||||
if(key == configKeys.getCharKey(keyName.c_str())) {
|
||||
char groupHotKey = configKeys.getCharKey(keyName.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] keyName [%s] group index = %d, key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,keyName.c_str(),idx,groupHotKey,groupHotKey);
|
||||
|
||||
if(key == groupHotKey) {
|
||||
//gui.groupKey(key-'0');
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = %d\n",__FILE__,__FUNCTION__,__LINE__,key);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
gui.groupKey(idx-1);
|
||||
break;
|
||||
}
|
||||
|
@@ -214,7 +214,12 @@ char Config::translateStringToCharKey(const string &value) const {
|
||||
}
|
||||
}
|
||||
else if(value.length() >= 1) {
|
||||
result = value[0];
|
||||
if(value.length() == 3 && value[0] == '\'' && value[2] == '\'') {
|
||||
result = value[1];
|
||||
}
|
||||
else {
|
||||
result = value[0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
string sError = "Unsupported key translation" + value;
|
||||
|
@@ -194,7 +194,7 @@ private:
|
||||
void handleMouseDown(SDL_Event event);
|
||||
|
||||
static MouseButton getMouseButton(int sdlButton);
|
||||
static char getKey(SDL_keysym keysym);
|
||||
static char getKey(SDL_keysym keysym, bool skipSpecialKeys=false);
|
||||
static void toggleFullscreen();
|
||||
};
|
||||
|
||||
|
@@ -147,7 +147,7 @@ bool Window::handleEvent() {
|
||||
if(global_window) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
global_window->eventKeyDown(getKey(event.key.keysym));
|
||||
global_window->eventKeyDown(getKey(event.key.keysym,true));
|
||||
global_window->eventKeyPress(static_cast<char>(event.key.keysym.unicode));
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
@@ -160,7 +160,7 @@ bool Window::handleEvent() {
|
||||
keystate = event.key.keysym;
|
||||
|
||||
if(global_window) {
|
||||
global_window->eventKeyUp(getKey(event.key.keysym));
|
||||
global_window->eventKeyUp(getKey(event.key.keysym,true));
|
||||
}
|
||||
break;
|
||||
case SDL_ACTIVEEVENT:
|
||||
@@ -491,7 +491,20 @@ MouseButton Window::getMouseButton(int sdlButton) {
|
||||
}
|
||||
}
|
||||
|
||||
char Window::getKey(SDL_keysym keysym) {
|
||||
char Window::getKey(SDL_keysym keysym,bool skipSpecialKeys) {
|
||||
if(skipSpecialKeys == false) {
|
||||
switch(keysym.sym) {
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
return vkAlt;
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
return vkControl;
|
||||
case SDLK_LSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
return vkShift;
|
||||
}
|
||||
}
|
||||
switch(keysym.sym) {
|
||||
case SDLK_PLUS:
|
||||
case SDLK_KP_PLUS:
|
||||
@@ -499,15 +512,6 @@ char Window::getKey(SDL_keysym keysym) {
|
||||
case SDLK_MINUS:
|
||||
case SDLK_KP_MINUS:
|
||||
return vkSubtract;
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
return vkAlt;
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
return vkControl;
|
||||
case SDLK_LSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
return vkShift;
|
||||
case SDLK_ESCAPE:
|
||||
return vkEscape;
|
||||
case SDLK_UP:
|
||||
|
Reference in New Issue
Block a user