From 8328148f1dd379439f6b598584268e896d93b494 Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:19:28 +0100 Subject: [PATCH] Added touchpad button handling --- src/sdl_window.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 2b885baea..2b42ad84e 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -215,11 +215,17 @@ void WindowSDL::OnKeyboardMouseInput(const SDL_Event* event) { void WindowSDL::OnGamepadEvent(const SDL_Event* event) { bool input_down = event->type == SDL_EVENT_GAMEPAD_AXIS_MOTION || - event->type == SDL_EVENT_GAMEPAD_BUTTON_DOWN || - event->type == SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN || - event->type == SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION; + event->type == SDL_EVENT_GAMEPAD_BUTTON_DOWN; u32 input_id = Input::InputBinding::GetInputIDFromEvent(*event); + // the touchpad button shouldn't be rebound to anything else, + // as it would break the entire touchpad handling + // You can still bind other things to it though + if (event->gbutton.button == SDL_GAMEPAD_BUTTON_TOUCHPAD) { + controller->CheckButton(0, OrbisPadButtonDataOffset::TouchPad, input_down); + return; + } + bool inputs_changed = Input::UpdatePressedKeys(input_id, input_down); if (inputs_changed) {