Commit graph

7 commits

Author SHA1 Message Date
Lars Sundström
a5cc5e17b8 IOS7: Fix compiler warnings
This commit fixes the compiler warnings regarding:
- The local declaration of 'view' hides instance variable [-Wshadow-ivar]
- Some of the gamepad controller buttons is only available in specific
versions of iOS and tvOS.
- Use of non-standard escape character '\E'. \E is a GNU shortcut.
2023-04-27 21:18:43 +01:00
Lars Sundström
1ace0305ce IOS7: Add general handling of the menu button on game controllers
Expose the handleMainMenuKey function and call that when pressing the
menu button on game controllers.
2023-04-27 21:18:34 +01:00
Lars Sundström
80cb6427e1 IOS7: Trigger joystick presses only once for buttons A and B
All buttons and triggers on MFi game controllers are pressure sensitive
which means that when pressing buttons the registered
valueChangedHandler function is called multiple times providing updates
on the pressure value the button is pressed with. This causes multiple
kInputJoystickButtonDown events to be sent to the EventManager.
In adventure games the pressure value is not relevant and could cause
problems for the user that it triggers multiple presses on e.g. the B
button which often is mapped to the right mouse button. In some games
a click on the right mouse button changes what action that should be
performed.

Keep track on if the joystick buttons A or B (often mapped as left and
right mouse buttons) are being pressed. If the button is already
pressed do not add a new event until the button isn't pressed anymore.

To not interfere with any open dialog, don't send key events while the
keyboard is visible.
2023-04-27 21:17:58 +01:00
Lars Sundström
e7759ac0ef IOS7: Implement getHardwareInputSet to get connected devices
Trigger EVENT_INPUT_CHANGED when devices connects to make the ScummVM
engine update the hardware input set.
2022-08-08 21:08:56 +01:00
Lars Sundström
d76bc708c0 IOS7: Add isConnected property to GameControllers 2022-08-08 21:08:56 +01:00
Lars Sundström
f18305e715 IOS7: Add support for Joystick actions in GameController
Joystick actions are suitable for joysticks and gamepads where the
movements are updated by a controller stick. On gamepads that's usually
a thumbstick.

Add joystick events which can be triggered by each implemented
controller that should utilize the ScummVM Joystick events.
2022-08-08 21:08:56 +01:00
Lars Sundström
15507ebc50 IOS7: Add GameController base class
Add a GameController base class which handles user inputs from a
controller. The input is either a pointer move or a button action.
If the input is a pointer move, make sure that the move is within
valid coordinates in the game (respecting the resolution which is
most probably lower than the view resolution).
2022-08-08 21:08:56 +01:00