mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-07 10:21:31 +00:00
IOS7: Add dpad actions to gamepad controller
Some game engines requires the dpad to control a character. The GRIM engine is an example of this where the user steer the character by the arrow keys or dpad controller.
This commit is contained in:
parent
fac7008914
commit
045ddca927
@ -91,6 +91,14 @@
|
||||
[self handleJoystickAxisMotionX:x andY:0-y forJoystick:kGameControllerJoystickRight];
|
||||
};
|
||||
|
||||
_controller.extendedGamepad.dpad.valueChangedHandler = ^(GCControllerDirectionPad * _Nonnull dpad, float xValue, float yValue) {
|
||||
// Negative values are left/down, positive are right/up, 0 is no press
|
||||
[self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_LEFT isPressed:(xValue < 0)];
|
||||
[self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_RIGHT isPressed:(xValue > 0)];
|
||||
[self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_UP isPressed:(yValue > 0)];
|
||||
[self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_DPAD_DOWN isPressed:(yValue < 0)];
|
||||
};
|
||||
|
||||
_controller.extendedGamepad.buttonA.valueChangedHandler = ^(GCControllerButtonInput * _Nonnull button, float value, BOOL pressed) {
|
||||
[self handleJoystickButtonAction:Common::JOYSTICK_BUTTON_A isPressed:pressed];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user