make controls menu display keybinds correctly

This commit is contained in:
Joel Heaton 2015-10-30 17:27:34 +00:00 committed by darkrose
parent 79e3e6a52a
commit f28e30694d
3 changed files with 5 additions and 5 deletions

View File

@ -327,7 +327,7 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize)
{ {
core::rect < s32 > rect(0, 0, 110, 30); core::rect < s32 > rect(0, 0, 110, 30);
rect += topleft_content + offset + v2s32(155, -5); rect += topleft_content + offset + v2s32(155, -5);
Environment->addButton(rect, this, GUI_ID_KEYSETTINGS_BASE+i, keys[i].guiName()); Environment->addButton(rect, this, GUI_ID_KEYSETTINGS_BASE+i, keys[i].guiName().c_str());
} }
offset += v2s32(0, 33); offset += v2s32(0, 33);
if (offset.Y > 450) { if (offset.Y > 450) {
@ -579,7 +579,7 @@ bool GUISettingsMenu::OnEvent(const SEvent& event)
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->setEnabled(true);
e->setText(kp.guiName()); e->setText(kp.guiName().c_str());
keys[activeKey-GUI_ID_KEYSETTINGS_BASE] = kp; keys[activeKey-GUI_ID_KEYSETTINGS_BASE] = kp;
} }
activeKey = -1; activeKey = -1;

View File

@ -339,10 +339,10 @@ const char *KeyPress::name() const
} }
} }
const wchar_t *KeyPress::guiName() const const std::wstring KeyPress::guiName() const
{ {
const char* n = name(); const char* n = name();
return narrow_to_wide(n).c_str(); return narrow_to_wide(n);
} }
const KeyPress EscapeKey("KEY_ESCAPE"); const KeyPress EscapeKey("KEY_ESCAPE");

View File

@ -54,7 +54,7 @@ public:
const char *sym() const; const char *sym() const;
const char *name() const; const char *name() const;
const wchar_t *guiName() const; const std::wstring guiName() const;
std::string debug() const; std::string debug() const;
protected: protected: