mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-17 11:59:28 +00:00
Fix ACTION_MENU* input to be sent as intended, broke in a7c2d054a2
iirc
This commit is contained in:
parent
37fa087c2e
commit
4990ae3bf6
8 changed files with 54 additions and 87 deletions
|
@ -85,9 +85,10 @@ public:
|
|||
bool getKeyState(int k, int sourceID);
|
||||
|
||||
ActionData *getActionDataByIDAndSource(int actionID, int source);
|
||||
|
||||
protected:
|
||||
|
||||
std::vector<Event*>createdEvents;
|
||||
std::vector<Event*> createdEvents;
|
||||
|
||||
bool inUpdate;
|
||||
bool inputEnabled;
|
||||
|
|
|
@ -160,6 +160,8 @@ void ActionSet::importAction(ActionMapper *mapper, const std::string &name, int
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
debugLog("ActionSet::importAction: No such action: " + name);
|
||||
}
|
||||
|
||||
void ActionSet::importAction(ActionMapper *mapper, const std::string &name, Event *event, int state) const
|
||||
|
@ -178,6 +180,8 @@ void ActionSet::importAction(ActionMapper *mapper, const std::string &name, Even
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
debugLog("ActionSet::importAction: No such action: " + name);
|
||||
}
|
||||
|
||||
ActionInput *ActionSet::addActionInput(const std::string &name)
|
||||
|
|
|
@ -23,6 +23,12 @@ void ActionButtonStatus::import(const ActionSet& as)
|
|||
if(unsigned(inp.data.all[j]) < ACTION_BUTTON_ENUM_SIZE)
|
||||
found[inp.data.all[j]] = 1;
|
||||
}
|
||||
|
||||
// HACK: always query these for menu input emulation
|
||||
found[JOY_STICK_LEFT] = 1;
|
||||
found[JOY_STICK_RIGHT] = 1;
|
||||
found[JOY_STICK_UP] = 1;
|
||||
found[JOY_STICK_DOWN]= 1;
|
||||
|
||||
toQuery.clear();
|
||||
for(int k = 1; k < sizeof(found); ++k) // ignore [0]
|
||||
|
@ -97,6 +103,15 @@ bool ActionButtonStatus::_queryStatus(int k) const
|
|||
if (k >= JOY_BUTTON_0 && k < JOY_BUTTON_END)
|
||||
return j->getButton(k - JOY_BUTTON_0);
|
||||
|
||||
if(k == JOY_STICK_LEFT)
|
||||
return j->position.x < -JOY_AXIS_THRESHOLD;
|
||||
if(k == JOY_STICK_RIGHT)
|
||||
return j->position.x > JOY_AXIS_THRESHOLD;
|
||||
if(k == JOY_STICK_UP)
|
||||
return j->position.y < -JOY_AXIS_THRESHOLD;
|
||||
if(k == JOY_STICK_DOWN)
|
||||
return j->position.y > JOY_AXIS_THRESHOLD;
|
||||
|
||||
if (k >= JOY_AXIS_0_POS && k < JOY_AXIS_END_POS)
|
||||
{
|
||||
float ax = j->getAxisUncalibrated(k - JOY_AXIS_0_POS);
|
||||
|
|
|
@ -17,7 +17,15 @@ enum ActionButtonType
|
|||
MOUSE_BUTTON_EXTRA_START,
|
||||
MOUSE_BUTTON_EXTRA_END = MOUSE_BUTTON_EXTRA_START + mouseExtraButtons,
|
||||
|
||||
JOY_BUTTON_0 = MOUSE_BUTTON_EXTRA_END,
|
||||
// maps to whatever is configured as the primary joystick x/y axes
|
||||
JOY_STICK_LEFT = MOUSE_BUTTON_EXTRA_END,
|
||||
JOY_STICK_RIGHT,
|
||||
JOY_STICK_UP,
|
||||
JOY_STICK_DOWN,
|
||||
|
||||
INTERNALLY_USED_ACTION_BUTTONS_END, // Engine needs anything above this for handling inputs properly
|
||||
|
||||
JOY_BUTTON_0 = INTERNALLY_USED_ACTION_BUTTONS_END,
|
||||
JOY_BUTTON_END = JOY_BUTTON_0 + MAX_JOYSTICK_BTN,
|
||||
|
||||
JOY_AXIS_0_POS = JOY_BUTTON_END,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue