mirror of
https://github.com/glest/glest-source.git
synced 2025-08-17 13:50:43 +02:00
- bugfix for hotkey processing (allow single quoted characters to fix grouping units)
This commit is contained in:
@@ -14,16 +14,16 @@ ChangeFontColor=C
|
|||||||
GameSpeedIncrease=vkAdd
|
GameSpeedIncrease=vkAdd
|
||||||
GameSpeedDecrease=vkSubtract
|
GameSpeedDecrease=vkSubtract
|
||||||
ExitKey=vkEscape
|
ExitKey=vkEscape
|
||||||
GroupUnitsKey1=0
|
GroupUnitsKey1='0'
|
||||||
GroupUnitsKey2=1
|
GroupUnitsKey2='1'
|
||||||
GroupUnitsKey3=2
|
GroupUnitsKey3='2'
|
||||||
GroupUnitsKey4=3
|
GroupUnitsKey4='3'
|
||||||
GroupUnitsKey5=4
|
GroupUnitsKey5='4'
|
||||||
GroupUnitsKey6=5
|
GroupUnitsKey6='5'
|
||||||
GroupUnitsKey7=6
|
GroupUnitsKey7='6'
|
||||||
GroupUnitsKey8=7
|
GroupUnitsKey8='7'
|
||||||
GroupUnitsKey9=8
|
GroupUnitsKey9='8'
|
||||||
GroupUnitsKey10=9
|
GroupUnitsKey10='9'
|
||||||
CameraRotateLeft=A
|
CameraRotateLeft=A
|
||||||
CameraRotateRight=D
|
CameraRotateRight=D
|
||||||
CameraRotateUp=S
|
CameraRotateUp=S
|
||||||
|
@@ -810,7 +810,7 @@ void Game::eventMouseWheel(int x, int y, int zDelta) {
|
|||||||
|
|
||||||
void Game::keyDown(char key){
|
void Game::keyDown(char key){
|
||||||
try {
|
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();
|
Lang &lang= Lang::getInstance();
|
||||||
bool speedChangesAllowed= !NetworkManager::getInstance().isNetworkGame();
|
bool speedChangesAllowed= !NetworkManager::getInstance().isNetworkGame();
|
||||||
@@ -909,9 +909,12 @@ void Game::keyDown(char key){
|
|||||||
|
|
||||||
for(int idx = 1; idx <= Selection::maxGroups; idx++) {
|
for(int idx = 1; idx <= Selection::maxGroups; idx++) {
|
||||||
string keyName = "GroupUnitsKey" + intToStr(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');
|
//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);
|
gui.groupKey(idx-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -214,7 +214,12 @@ char Config::translateStringToCharKey(const string &value) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(value.length() >= 1) {
|
else if(value.length() >= 1) {
|
||||||
result = value[0];
|
if(value.length() == 3 && value[0] == '\'' && value[2] == '\'') {
|
||||||
|
result = value[1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = value[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string sError = "Unsupported key translation" + value;
|
string sError = "Unsupported key translation" + value;
|
||||||
|
@@ -194,7 +194,7 @@ private:
|
|||||||
void handleMouseDown(SDL_Event event);
|
void handleMouseDown(SDL_Event event);
|
||||||
|
|
||||||
static MouseButton getMouseButton(int sdlButton);
|
static MouseButton getMouseButton(int sdlButton);
|
||||||
static char getKey(SDL_keysym keysym);
|
static char getKey(SDL_keysym keysym, bool skipSpecialKeys=false);
|
||||||
static void toggleFullscreen();
|
static void toggleFullscreen();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -147,7 +147,7 @@ bool Window::handleEvent() {
|
|||||||
if(global_window) {
|
if(global_window) {
|
||||||
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__);
|
||||||
|
|
||||||
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));
|
global_window->eventKeyPress(static_cast<char>(event.key.keysym.unicode));
|
||||||
|
|
||||||
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__);
|
||||||
@@ -160,7 +160,7 @@ bool Window::handleEvent() {
|
|||||||
keystate = event.key.keysym;
|
keystate = event.key.keysym;
|
||||||
|
|
||||||
if(global_window) {
|
if(global_window) {
|
||||||
global_window->eventKeyUp(getKey(event.key.keysym));
|
global_window->eventKeyUp(getKey(event.key.keysym,true));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_ACTIVEEVENT:
|
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) {
|
switch(keysym.sym) {
|
||||||
case SDLK_PLUS:
|
case SDLK_PLUS:
|
||||||
case SDLK_KP_PLUS:
|
case SDLK_KP_PLUS:
|
||||||
@@ -499,15 +512,6 @@ char Window::getKey(SDL_keysym keysym) {
|
|||||||
case SDLK_MINUS:
|
case SDLK_MINUS:
|
||||||
case SDLK_KP_MINUS:
|
case SDLK_KP_MINUS:
|
||||||
return vkSubtract;
|
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:
|
case SDLK_ESCAPE:
|
||||||
return vkEscape;
|
return vkEscape;
|
||||||
case SDLK_UP:
|
case SDLK_UP:
|
||||||
|
Reference in New Issue
Block a user