- bugfix for esc key

This commit is contained in:
Mark Vejvoda 2011-03-08 02:07:35 +00:00
parent 76919f81b6
commit 5b2a6bb45f
4 changed files with 20 additions and 6 deletions

View File

@ -265,7 +265,7 @@ const string Config::getString(const string &key,const char *defaultValueIfNotFo
}
SDLKey Config::translateSpecialStringToSDLKey(char c) const {
SDLKey result;
SDLKey result = SDLK_UNKNOWN;
if(c < 0) {
switch(c) {
case vkAdd:

View File

@ -363,8 +363,13 @@ void MenuStateKeysetup::keyUp(char key) {
for(int i = 0; i < userProperties.size(); ++i) {
string hotKeyName = userProperties[i].first;
if(nameValuePair.first == hotKeyName) {
if(keysym > 255) {
userProperties[i].second = keyName;
if(keysym <= SDLK_ESCAPE || keysym > 255) {
if(keysym <= SDLK_ESCAPE) {
userProperties[i].second = intToStr(key);
}
else {
userProperties[i].second = keyName;
}
}
else {
userProperties[i].second = "";
@ -376,8 +381,13 @@ void MenuStateKeysetup::keyUp(char key) {
}
if(isNewUserKeyEntry == true) {
pair<string,string> newNameValuePair = nameValuePair;
if(keysym > 255) {
newNameValuePair.second = keyName;
if(keysym <= SDLK_ESCAPE || keysym > 255) {
if(keysym <= SDLK_ESCAPE) {
newNameValuePair.second = intToStr(key);
}
else {
newNameValuePair.second = keyName;
}
}
else {
newNameValuePair.second = key;

View File

@ -201,6 +201,7 @@ void MenuStateRoot::update(){
void MenuStateRoot::keyDown(char key) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] key = [%d - %c]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
//exit

View File

@ -689,8 +689,11 @@ char Window::getNormalKey(SDL_keysym keysym,bool skipSpecialKeys) {
if(keyName == "minus sign" || keyName == "minus") {
return vkSubtract;
}
//if(keyName == "escape") {
// return vkEscape;
//}
if(keyName == "escape") {
return vkEscape;
return unicodeKey;
}
if(keyName == "tab") {
return vkTab;