mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
hard-wire Escape key to always trigger ACTION_ESC.
Additional config for more keys/button to trigger the same action is still possible.
This commit is contained in:
parent
520c71fdb7
commit
0abe0f821c
7 changed files with 17 additions and 18 deletions
|
@ -491,7 +491,6 @@ AquariaKeyConfig::AquariaKeyConfig(const std::string &actionInputName, InputSetT
|
|||
, inputSetType(inputSetType)
|
||||
, inputIdx(inputIdx)
|
||||
, actionSetIndex(0)
|
||||
, acceptEsc(false)
|
||||
, rejectJoyAxis(false)
|
||||
{
|
||||
bg = new Quad();
|
||||
|
@ -760,7 +759,7 @@ void AquariaKeyConfig::onUpdate(float dt)
|
|||
{
|
||||
if(*k == i) // clear key if pressed again
|
||||
*k = 0;
|
||||
else if(acceptEsc || i != KEY_ESCAPE)
|
||||
else if(i != KEY_ESCAPE)
|
||||
{
|
||||
if (i == KEY_DELETE || i == KEY_BACKSPACE)
|
||||
*k = 0;
|
||||
|
@ -963,11 +962,6 @@ void AquariaKeyConfig::setActionSetIndex(size_t idx)
|
|||
actionSetIndex = idx;
|
||||
}
|
||||
|
||||
void AquariaKeyConfig::setAcceptEsc(bool a)
|
||||
{
|
||||
acceptEsc = a;
|
||||
}
|
||||
|
||||
void AquariaKeyConfig::setRejectJoyAxis(bool b)
|
||||
{
|
||||
rejectJoyAxis = b;
|
||||
|
|
|
@ -174,7 +174,6 @@ public:
|
|||
|
||||
static AquariaKeyConfig *waitingForInput;
|
||||
|
||||
void setAcceptEsc(bool a);
|
||||
void setActionSetIndex(size_t idx);
|
||||
void setRejectJoyAxis(bool b);
|
||||
|
||||
|
@ -192,7 +191,6 @@ protected:
|
|||
TTFText *keyConfigFont;
|
||||
Quad *bg, *bg2;
|
||||
size_t actionSetIndex;
|
||||
bool acceptEsc;
|
||||
bool rejectJoyAxis;
|
||||
};
|
||||
|
||||
|
|
|
@ -3696,6 +3696,7 @@ void DSQ::bindInput()
|
|||
almb.clear();
|
||||
armb.clear();
|
||||
|
||||
addAction(ACTION_ESC, KEY_ESCAPE, -1);
|
||||
addAction(MakeFunctionEvent(DSQ, onSwitchScreenMode), KEY_RETURN, 1);
|
||||
|
||||
if (isDeveloperKeys())
|
||||
|
|
|
@ -3226,6 +3226,8 @@ void Game::bindInput()
|
|||
ActionMapper::clearActions();
|
||||
//ActionMapper::clearCreatedEvents();
|
||||
|
||||
addAction(ACTION_ESC, KEY_ESCAPE, -1);
|
||||
|
||||
|
||||
#ifdef AQUARIA_BUILD_SCENEEDITOR
|
||||
if (dsq->canOpenEditor())
|
||||
|
|
|
@ -925,6 +925,8 @@ InGameMenu::~InGameMenu()
|
|||
|
||||
void InGameMenu::bindInput()
|
||||
{
|
||||
addAction(ACTION_ESC, KEY_ESCAPE, -1);
|
||||
|
||||
for(size_t i = 0; i < dsq->user.control.actionSets.size(); ++i)
|
||||
{
|
||||
const ActionSet& as = dsq->user.control.actionSets[i];
|
||||
|
@ -1522,7 +1524,7 @@ void InGameMenu::hide(bool effects, bool cancel)
|
|||
}
|
||||
|
||||
|
||||
void InGameMenu::addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int x, int y, bool acceptEsc, bool rejectJoyAxis)
|
||||
void InGameMenu::addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int x, int y, bool rejectJoyAxis)
|
||||
{
|
||||
TTFText *lb = new TTFText(&dsq->fontArialSmallest);
|
||||
lb->setText(label);
|
||||
|
@ -1540,14 +1542,12 @@ void InGameMenu::addKeyConfigLine(RenderObject *group, const std::string &label,
|
|||
k1->position = Vector(x,y);
|
||||
group->addChild(k1, PM_POINTER);
|
||||
keyConfigs.push_back(k1);
|
||||
k1->setAcceptEsc(acceptEsc);
|
||||
x += KEYCONFIG_COL_DISTANCE;
|
||||
|
||||
AquariaKeyConfig *k2 = new AquariaKeyConfig(actionInputName, INPUTSET_KEY, 1);
|
||||
k2->position = Vector(x,y);
|
||||
group->addChild(k2, PM_POINTER);
|
||||
keyConfigs.push_back(k2);
|
||||
k2->setAcceptEsc(acceptEsc);
|
||||
x += KEYCONFIG_COL_DISTANCE;
|
||||
|
||||
AquariaKeyConfig *j1 = new AquariaKeyConfig(actionInputName, INPUTSET_JOY, 0);
|
||||
|
@ -2127,10 +2127,10 @@ void InGameMenu::create()
|
|||
|
||||
addKeyConfigLine(kk, SB(2107), "PrimaryAction", offx, y+=yi);
|
||||
addKeyConfigLine(kk, SB(2108), "SecondaryAction", offx, y+=yi);
|
||||
addKeyConfigLine(kk, SB(2109), "SwimUp", offx, y+=yi, false, true);
|
||||
addKeyConfigLine(kk, SB(2110), "SwimDown", offx, y+=yi, false, true);
|
||||
addKeyConfigLine(kk, SB(2111), "SwimLeft", offx, y+=yi, false, true);
|
||||
addKeyConfigLine(kk, SB(2112), "SwimRight", offx, y+=yi, false, true);
|
||||
addKeyConfigLine(kk, SB(2109), "SwimUp", offx, y+=yi, true);
|
||||
addKeyConfigLine(kk, SB(2110), "SwimDown", offx, y+=yi, true);
|
||||
addKeyConfigLine(kk, SB(2111), "SwimLeft", offx, y+=yi, true);
|
||||
addKeyConfigLine(kk, SB(2112), "SwimRight", offx, y+=yi, true);
|
||||
addKeyConfigLine(kk, SB(2113), "Roll", offx, y+=yi);
|
||||
addKeyConfigLine(kk, SB(2114), "Revert", offx, y+=yi);
|
||||
addKeyConfigLine(kk, SB(2115), "WorldMap", offx, y+=yi);
|
||||
|
@ -2162,7 +2162,7 @@ void InGameMenu::create()
|
|||
|
||||
int y = offy;
|
||||
|
||||
addKeyConfigLine(kk, SB(2116), "Escape", offx, y+=yi, true);
|
||||
addKeyConfigLine(kk, SB(2116), "Escape", offx, y+=yi);
|
||||
addKeyConfigLine(kk, SB(2128), "ToggleHelp", offx, y+=yi);
|
||||
addKeyConfigLine(kk, SB(2121), "PrevPage", offx, y+=yi);
|
||||
addKeyConfigLine(kk, SB(2122), "NextPage", offx, y+=yi);
|
||||
|
|
|
@ -194,7 +194,7 @@ private:
|
|||
|
||||
void onKeyConfig();
|
||||
|
||||
void addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int x, int y, bool acceptEsc = false, bool rejectJoyAxis = false);
|
||||
void addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int x, int y, bool rejectJoyAxis = false);
|
||||
|
||||
AquariaKeyConfig *addAxesConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int offx, int y);
|
||||
|
||||
|
|
|
@ -197,6 +197,10 @@ int getStringToInputCode(const std::string& s)
|
|||
k = getInputCodeFromKeyName(s.c_str());
|
||||
}
|
||||
|
||||
// Non-configurable keys
|
||||
if(k == KEY_ESCAPE)
|
||||
return 0;
|
||||
|
||||
if(k < ACTION_BUTTON_ENUM_SIZE)
|
||||
return k;
|
||||
|
||||
|
|
Loading…
Reference in a new issue