- added ability to reload default key bindings
- reverted keybindings display back to action names instead of PSP key equivalent (see commit commit 168154b52d)
This commit is contained in:
@@ -998,6 +998,8 @@ protected:
|
||||
set<LocalKeySym> confirmedKeys;
|
||||
set<JButton> confirmedButtons;
|
||||
string confirmationString;
|
||||
private:
|
||||
void populateKeyBindingList();
|
||||
};
|
||||
|
||||
/**@} This comment used by Doxyyen. */
|
||||
|
||||
@@ -135,14 +135,14 @@ const KeyRep& translateKey(LocalKeySym key)
|
||||
#endif
|
||||
|
||||
const KeyRep& translateKey(JButton key) {
|
||||
/*
|
||||
|
||||
{
|
||||
map<const JButton, KeyRep>::iterator res;
|
||||
if ((res = slimtable.find(key)) != slimtable.end())
|
||||
return res->second;
|
||||
}
|
||||
|
||||
slimtable[JGE_BTN_NONE] = make_pair(_("None"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_NONE] = make_pair(_("Delete this binding"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_QUIT] = make_pair(_("Quit"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_MENU] = make_pair(_("Menu"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_CTRL] = make_pair(_("Control"), static_cast<JQuad*>(NULL));
|
||||
@@ -158,10 +158,11 @@ const KeyRep& translateKey(JButton key) {
|
||||
slimtable[JGE_BTN_SEC] = make_pair(_("Secondary"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_PREV] = make_pair(_("Next phase/Previous item"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_NEXT] = make_pair(_("Open hand/Next item"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_FULLSCREEN] = make_pair(_("Fullscreen"), static_cast<JQuad*>(NULL));
|
||||
|
||||
return slimtable[key];
|
||||
*/
|
||||
|
||||
/*
|
||||
map<const JButton, KeyRep>::iterator res;
|
||||
if ((res = slimtable.find(key)) == slimtable.end())
|
||||
{
|
||||
@@ -205,7 +206,8 @@ const KeyRep& translateKey(JButton key) {
|
||||
case JGE_BTN_OK : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_CIRCLE", RETRIEVE_NORMAL).get(); break;
|
||||
case JGE_BTN_SEC : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)7*32, 0, 32, 32, "PSP_CTRL_CROSS", RETRIEVE_NORMAL).get(); break;
|
||||
case JGE_BTN_PRI : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 0, 32, 32, "PSP_CTRL_SQUARE", RETRIEVE_NORMAL).get(); break;
|
||||
default: /* Unknown key : no icon */ ;
|
||||
default: ; // Unknown key : no icon
|
||||
}
|
||||
return k;
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -2276,22 +2276,17 @@ WGuiKeyBinder::WGuiKeyBinder(string name, GameStateOptions* parent) :
|
||||
WGuiList(name), parent(parent), confirmMenu(NULL), modal(false), confirmed(CONFIRM_NEED), confirmingKey(LOCAL_KEY_NONE),
|
||||
confirmingButton(JGE_BTN_NONE), confirmationString("")
|
||||
{
|
||||
JGE* j = JGE::GetInstance();
|
||||
JGE::keybindings_it start = j->KeyBindings_begin(), end = j->KeyBindings_end();
|
||||
|
||||
Add(NEW OptionKey(parent, LOCAL_KEY_NONE, JGE_BTN_NONE));
|
||||
for (JGE::keybindings_it it = start; it != end; ++it)
|
||||
Add(NEW OptionKey(parent, it->first, it->second));
|
||||
populateKeyBindingList();
|
||||
}
|
||||
|
||||
void WGuiKeyBinder::Update(float dt)
|
||||
{
|
||||
OptionKey* o = dynamic_cast<OptionKey*> (items[0]);
|
||||
OptionKey* o = dynamic_cast<OptionKey*> (items[1]);
|
||||
if (!o) return;
|
||||
if (LOCAL_KEY_NONE != o->from)
|
||||
{
|
||||
items.insert(items.begin(), NEW OptionKey(parent, LOCAL_KEY_NONE, JGE_BTN_NONE));
|
||||
if (0 == currentItem) ++currentItem;
|
||||
items.insert(items.begin() + 1, NEW OptionKey(parent, LOCAL_KEY_NONE, JGE_BTN_NONE));
|
||||
if (1 == currentItem) ++currentItem;
|
||||
}
|
||||
for (vector<WGuiBase*>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
(*it)->Update(dt);
|
||||
@@ -2416,7 +2411,11 @@ WGuiBase::CONFIRM_TYPE WGuiKeyBinder::needsConfirm()
|
||||
|
||||
void WGuiKeyBinder::ButtonPressed(int controllerId, int controlId)
|
||||
{
|
||||
if (2 == controlId)
|
||||
if (1 == controlId)
|
||||
{
|
||||
confirmed = CONFIRM_CANCEL;
|
||||
}
|
||||
else if (2 == controlId) {
|
||||
switch (controllerId)
|
||||
{
|
||||
case 0:
|
||||
@@ -2426,8 +2425,16 @@ void WGuiKeyBinder::ButtonPressed(int controllerId, int controlId)
|
||||
confirmedButtons.insert(confirmingButton);
|
||||
break;
|
||||
}
|
||||
else
|
||||
confirmed = CONFIRM_CANCEL;
|
||||
}
|
||||
else if (3 == controlId) {
|
||||
switch (controllerId)
|
||||
{
|
||||
case -102:
|
||||
JGE::GetInstance()->ResetBindings();
|
||||
populateKeyBindingList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
SAFE_DELETE(confirmMenu);
|
||||
confirmMenu = NULL;
|
||||
}
|
||||
@@ -2460,3 +2467,16 @@ bool WGuiKeyBinder::yieldFocus()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void WGuiKeyBinder::populateKeyBindingList()
|
||||
{
|
||||
items.clear();
|
||||
DebugTrace(items.empty());
|
||||
Add(NEW WGuiButton(NEW WGuiItem("Load Defaults..."), -102, 3, this));
|
||||
Add(NEW OptionKey(parent, LOCAL_KEY_NONE, JGE_BTN_NONE));
|
||||
|
||||
JGE* j = JGE::GetInstance();
|
||||
JGE::keybindings_it start = j->KeyBindings_begin(), end = j->KeyBindings_end();
|
||||
for (JGE::keybindings_it it = start; it != end; ++it)
|
||||
Add(NEW OptionKey(parent, it->first, it->second));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user