Changed: char selection keyboard navigation handler

--HG--
branch : compatibility-develop
hg/compatibility-develop
Inky 6 years ago
parent 21dfa80b73
commit bfab92082b

@ -4609,3 +4609,38 @@ public:
}; };
REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame"); REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame");
// ***************************************************************************
// navigate_charsel
// Arg : current slot selected
// ***************************************************************************
class CHandlerCharselNaviGetKeys : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
{
sint32 slot = 0;
if (!getParam(Params, "cs").empty())
fromString(getParam(Params, "cs"), slot);
if (Driver->AsyncListener.isKeyPushed(KeyESCAPE))
CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_quit");
if (Driver->AsyncListener.isKeyPushed(KeyRETURN))
CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_charsel_enterkeyslot");
const sint32 index = slot;
if (Driver->AsyncListener.isKeyPushed(KeyUP))
{
slot--;
if (slot < 0) slot = 4;
}
else if (Driver->AsyncListener.isKeyPushed(KeyDOWN))
{
slot++;
if (slot > 4) slot = 0;
}
// now select
if (index != slot)
CAHManager::getInstance()->runActionHandler("proc", NULL, toString("proc_charsel_clickslot|%i", slot));
}
};
REGISTER_ACTION_HANDLER( CHandlerCharselNaviGetKeys, "navigate_charsel" );

Loading…
Cancel
Save