- another attempt to fix keyboard menu for windows

This commit is contained in:
Mark Vejvoda 2011-03-06 07:55:38 +00:00
parent d9e6b45052
commit d75fbe51f6
2 changed files with 19 additions and 7 deletions

View File

@ -80,25 +80,35 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu):
keyButtonsToRender=400/keyButtonsLineHeight;
int labelWidth=100;
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
mergedProperties=configKeys.getMergedProperties();
masterProperties=configKeys.getMasterProperties();
//userProperties=configKeys.getUserProperties();
userProperties.clear();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//throw runtime_error("Test!");
for(int i = 0; i < mergedProperties.size(); ++i) {
string keyName = mergedProperties[i].second;
if(keyName.length() > 0) {
SDLKey keysym = static_cast<SDLKey>(configKeys.translateStringToCharKey(keyName));
// SDL skips capital letters
if(keysym >= 65 && keysym <= 90) {
keysym = (SDLKey)((int)keysym + 32);
char c = configKeys.translateStringToCharKey(keyName);
if(c > SDLK_UNKNOWN && c < SDLK_LAST) {
SDLKey keysym = static_cast<SDLKey>(c);
// SDL skips capital letters
if(keysym >= 65 && keysym <= 90) {
keysym = (SDLKey)((int)keysym + 32);
}
keyName = SDL_GetKeyName(keysym);
}
keyName = SDL_GetKeyName(keysym);
if(keyName == "unknown key") {
else {
keyName = "";
}
if(keyName == "unknown key" || keyName == "") {
keyName = mergedProperties[i].second;
}
}
@ -113,6 +123,8 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu):
labels.push_back(label);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
keyScrollBar.init(keyButtonsXBase+keyButtonsWidth+labelWidth+20,200,false,200,20);
keyScrollBar.setLength(400);
keyScrollBar.setElementCount(keyButtons.size());

View File

@ -55,7 +55,7 @@ private:
public:
MenuStateKeysetup(Program *program, MainMenu *mainMenu);
~MenuStateKeysetup();
virtual ~MenuStateKeysetup();
void mouseClick(int x, int y, MouseButton mouseButton);
void mouseMove(int x, int y, const MouseState *mouseState);