make space assignable as a key

This commit is contained in:
darkrose 2015-06-08 22:45:33 +10:00
parent 9b45876c20
commit 0d634f1676
1 changed files with 8 additions and 2 deletions

View File

@ -526,8 +526,10 @@ bool GUISettingsMenu::resetMenu()
{ {
if (activeKey >= 0) { if (activeKey >= 0) {
gui::IGUIElement *e = getElementFromId(activeKey); gui::IGUIElement *e = getElementFromId(activeKey);
if (e != NULL && e->getType() == gui::EGUIET_BUTTON) if (e != NULL && e->getType() == gui::EGUIET_BUTTON) {
e->setEnabled(true);
e->setText(keynames[activeKey-GUI_ID_KEYSETTINGS_BASE]); e->setText(keynames[activeKey-GUI_ID_KEYSETTINGS_BASE]);
}
activeKey = -1; activeKey = -1;
return false; return false;
} }
@ -539,6 +541,7 @@ bool GUISettingsMenu::OnEvent(const SEvent& event)
KeyPress kp(event.KeyInput); KeyPress kp(event.KeyInput);
gui::IGUIElement *e = getElementFromId(activeKey); gui::IGUIElement *e = getElementFromId(activeKey);
if (e != NULL && e->getType() == gui::EGUIET_BUTTON) { if (e != NULL && e->getType() == gui::EGUIET_BUTTON) {
e->setEnabled(true);
e->setText(kp.guiName()); e->setText(kp.guiName());
keys[activeKey-GUI_ID_KEYSETTINGS_BASE] = kp; keys[activeKey-GUI_ID_KEYSETTINGS_BASE] = kp;
} }
@ -560,8 +563,11 @@ bool GUISettingsMenu::OnEvent(const SEvent& event)
resetMenu(); resetMenu();
activeKey = id; activeKey = id;
gui::IGUIElement *e = getElementFromId(id); gui::IGUIElement *e = getElementFromId(id);
if (e != NULL && e->getType() == gui::EGUIET_BUTTON) if (e != NULL && e->getType() == gui::EGUIET_BUTTON) {
e->setText(wgettext("press Key")); e->setText(wgettext("press Key"));
e->setEnabled(false);
return true;
}
}else{ }else{
switch (event.GUIEvent.Caller->getID()) { switch (event.GUIEvent.Caller->getID()) {
case GUI_ID_TAB_SETTINGS_CONTROLS: case GUI_ID_TAB_SETTINGS_CONTROLS: