From 183e8a1f93fb4e0158d43c55413e551042ba752e Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 13 Jan 2024 19:44:42 +0100 Subject: [PATCH] (Android) Added shoulder and trigger buttons to the touch overlay --- es-app/src/main.cpp | 1 - es-core/src/InputManager.cpp | 6 ++++-- .../graphics/overlay/button_shoulder_l.svg | 20 +++++++++++++++++++ .../graphics/overlay/button_shoulder_r.svg | 20 +++++++++++++++++++ .../graphics/overlay/button_trigger_l.svg | 20 +++++++++++++++++++ .../graphics/overlay/button_trigger_r.svg | 20 +++++++++++++++++++ 6 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 resources/graphics/overlay/button_shoulder_l.svg create mode 100644 resources/graphics/overlay/button_shoulder_r.svg create mode 100644 resources/graphics/overlay/button_trigger_l.svg create mode 100644 resources/graphics/overlay/button_trigger_r.svg diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index c5ccb0043..eb13be996 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -38,7 +38,6 @@ #include #if defined(__ANDROID__) -#include "InputOverlay.h" #include "utils/PlatformUtilAndroid.h" #endif diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index 32738e611..8a9d947ff 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -731,6 +731,7 @@ void InputManager::loadDefaultControllerConfig(SDL_JoystickID deviceIndex) void InputManager::loadTouchConfig() { +#if defined(__ANDROID__) InputConfig* cfg {mTouchInputConfig.get()}; if (cfg->isConfigured()) @@ -749,9 +750,10 @@ void InputManager::loadTouchConfig() cfg->mapInput("Y", Input(DEVICE_TOUCH, TYPE_TOUCH, SDL_CONTROLLER_BUTTON_Y, 1, true)); cfg->mapInput("LeftShoulder", Input(DEVICE_TOUCH, TYPE_TOUCH, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, 1, true)); cfg->mapInput("RightShoulder", Input(DEVICE_TOUCH, TYPE_TOUCH, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, 1, true)); - cfg->mapInput("LeftTrigger", Input(DEVICE_TOUCH, TYPE_TOUCH, SDL_CONTROLLER_AXIS_TRIGGERLEFT, 1, true)); - cfg->mapInput("RightTrigger", Input(DEVICE_TOUCH, TYPE_TOUCH, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, 1, true)); + cfg->mapInput("LeftTrigger", Input(DEVICE_TOUCH, TYPE_TOUCH, InputOverlay::TriggerButtons::TRIGGER_LEFT, 1, true)); + cfg->mapInput("RightTrigger", Input(DEVICE_TOUCH, TYPE_TOUCH, InputOverlay::TriggerButtons::TRIGGER_RIGHT, 1, true)); // clang-format on +#endif } void InputManager::addControllerByDeviceIndex(Window* window, int deviceIndex) diff --git a/resources/graphics/overlay/button_shoulder_l.svg b/resources/graphics/overlay/button_shoulder_l.svg new file mode 100644 index 000000000..9f69a46e4 --- /dev/null +++ b/resources/graphics/overlay/button_shoulder_l.svg @@ -0,0 +1,20 @@ + + + + + + diff --git a/resources/graphics/overlay/button_shoulder_r.svg b/resources/graphics/overlay/button_shoulder_r.svg new file mode 100644 index 000000000..504987886 --- /dev/null +++ b/resources/graphics/overlay/button_shoulder_r.svg @@ -0,0 +1,20 @@ + + + + + + diff --git a/resources/graphics/overlay/button_trigger_l.svg b/resources/graphics/overlay/button_trigger_l.svg new file mode 100644 index 000000000..51c9e0a94 --- /dev/null +++ b/resources/graphics/overlay/button_trigger_l.svg @@ -0,0 +1,20 @@ + + + + + + diff --git a/resources/graphics/overlay/button_trigger_r.svg b/resources/graphics/overlay/button_trigger_r.svg new file mode 100644 index 000000000..530eb0cb6 --- /dev/null +++ b/resources/graphics/overlay/button_trigger_r.svg @@ -0,0 +1,20 @@ + + + + + +