mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-08 23:30:06 +00:00
Getting closer to mutliple inputs actually working
Split logic and state from ActionMapper into another class, of which one exists per input set.
This commit is contained in:
parent
dcf09343b5
commit
c943759ce1
16 changed files with 309 additions and 186 deletions
53
BBGE/ActionStatus.h
Normal file
53
BBGE/ActionStatus.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
#ifndef ACTIONSTATUS_H
|
||||
#define ACTIONSTATUS_H
|
||||
|
||||
#include "GameKeys.h"
|
||||
#include "Joystick.h"
|
||||
|
||||
class ActionSet;
|
||||
|
||||
const unsigned mouseExtraButtons = 8;
|
||||
|
||||
enum ActionButtonType
|
||||
{
|
||||
MOUSE_BUTTON_LEFT = KEY_MAXARRAY + 1,
|
||||
MOUSE_BUTTON_RIGHT,
|
||||
MOUSE_BUTTON_MIDDLE,
|
||||
MOUSE_BUTTON_EXTRA_START,
|
||||
MOUSE_BUTTON_EXTRA_END = MOUSE_BUTTON_EXTRA_START + mouseExtraButtons,
|
||||
|
||||
JOY_BUTTON_0 = MOUSE_BUTTON_EXTRA_END,
|
||||
JOY_BUTTON_END = JOY_BUTTON_0 + MAX_JOYSTICK_BTN,
|
||||
|
||||
JOY_AXIS_0_POS = JOY_BUTTON_END,
|
||||
JOY_AXIS_END_POS = JOY_AXIS_0_POS + MAX_JOYSTICK_AXIS,
|
||||
|
||||
JOY_AXIS_0_NEG = JOY_AXIS_END_POS,
|
||||
JOY_AXIS_END_NEG = JOY_AXIS_0_NEG + MAX_JOYSTICK_AXIS,
|
||||
|
||||
ACTION_BUTTON_ENUM_SIZE = JOY_AXIS_END_NEG
|
||||
};
|
||||
|
||||
|
||||
class ActionButtonStatus
|
||||
{
|
||||
public:
|
||||
ActionButtonStatus();
|
||||
void update();
|
||||
inline bool getKeyState(int k) const { return !!status[k]; }
|
||||
inline bool isKeyChanged(int k) { return !!changed[k]; }
|
||||
void import(const ActionSet& as);
|
||||
inline const std::vector<int>& getToQuery() const {return toQuery; }
|
||||
inline int getJoystickID() const { return joystickID; }
|
||||
private:
|
||||
void _queryAllStatus();
|
||||
bool _queryStatus(int k) const;
|
||||
|
||||
int joystickID;
|
||||
unsigned char status[ACTION_BUTTON_ENUM_SIZE];
|
||||
unsigned char changed[ACTION_BUTTON_ENUM_SIZE];
|
||||
std::vector<int> toQuery;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue