1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

Add MOUSE_BUTTON_REAL_* mapping IDs because sometimes we need to handle unmapped mouse buttons

One such case is the editor; if Ctrl was mapped to RMB then rotating
tiles in 45° increment mode is impossible
(since the editor checks for Ctrl to enable increment mode,
and it did the wrong thing when releasing "both" at the same time)
This commit is contained in:
fgenesis 2024-09-22 02:36:18 +02:00
parent beb726e65d
commit 2c2153de9d
3 changed files with 19 additions and 5 deletions

View file

@ -691,10 +691,10 @@ void SceneEditor::init()
addAction(MakeFunctionEvent(SceneEditor, editModeEntities), KEY_F6, 0); addAction(MakeFunctionEvent(SceneEditor, editModeEntities), KEY_F6, 0);
addAction(MakeFunctionEvent(SceneEditor, editModePaths), KEY_F7, 0); addAction(MakeFunctionEvent(SceneEditor, editModePaths), KEY_F7, 0);
addAction(MakeFunctionEvent(SceneEditor, mouseButtonLeft), MOUSE_BUTTON_LEFT, 1); addAction(MakeFunctionEvent(SceneEditor, mouseButtonLeft), MOUSE_BUTTON_REAL_LEFT, 1);
addAction(MakeFunctionEvent(SceneEditor, mouseButtonRight), MOUSE_BUTTON_RIGHT, 1); addAction(MakeFunctionEvent(SceneEditor, mouseButtonRight), MOUSE_BUTTON_REAL_RIGHT, 1);
addAction(MakeFunctionEvent(SceneEditor, mouseButtonLeftUp), MOUSE_BUTTON_LEFT, 0); addAction(MakeFunctionEvent(SceneEditor, mouseButtonLeftUp), MOUSE_BUTTON_REAL_LEFT, 0);
addAction(MakeFunctionEvent(SceneEditor, mouseButtonRightUp), MOUSE_BUTTON_RIGHT, 0); addAction(MakeFunctionEvent(SceneEditor, mouseButtonRightUp), MOUSE_BUTTON_REAL_RIGHT, 0);
addAction(MakeFunctionEvent(SceneEditor, placeElement), KEY_SPACE, 1); addAction(MakeFunctionEvent(SceneEditor, placeElement), KEY_SPACE, 1);

View file

@ -94,6 +94,15 @@ bool ActionButtonStatus::_queryStatus(int k) const
if (k >= MOUSE_BUTTON_EXTRA_START && k < MOUSE_BUTTON_EXTRA_END) if (k >= MOUSE_BUTTON_EXTRA_START && k < MOUSE_BUTTON_EXTRA_END)
return core->mouse.buttons.extra[k - MOUSE_BUTTON_EXTRA_START]; return core->mouse.buttons.extra[k - MOUSE_BUTTON_EXTRA_START];
if (k == MOUSE_BUTTON_REAL_LEFT)
return core->mouse.pure_buttons.left == DOWN;
if (k == MOUSE_BUTTON_REAL_RIGHT)
return core->mouse.pure_buttons.right == DOWN;
if (k == MOUSE_BUTTON_REAL_MIDDLE)
return core->mouse.pure_buttons.middle == DOWN;
// --- joystick from here --- // --- joystick from here ---
Joystick *j = core->getJoystick(joystickID); Joystick *j = core->getJoystick(joystickID);

View file

@ -11,7 +11,12 @@ const unsigned mouseExtraButtons = 8;
// *_END is non-inclusive! // *_END is non-inclusive!
enum ActionButtonType enum ActionButtonType
{ {
MOUSE_BUTTON_LEFT = KEY_MAXARRAY + 1, // Only concerns real mouse buttons, not whatever is mapped to "left mouse"
MOUSE_BUTTON_REAL_LEFT = KEY_MAXARRAY + 1,
MOUSE_BUTTON_REAL_RIGHT,
MOUSE_BUTTON_REAL_MIDDLE,
MOUSE_BUTTON_LEFT,
MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_RIGHT,
MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_MIDDLE,
MOUSE_BUTTON_EXTRA_START, MOUSE_BUTTON_EXTRA_START,