From cf0374363107d81eb3f9075253e35e0c6cbe69b8 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Wed, 17 Jul 2024 04:01:28 -0700 Subject: [PATCH] Restore old keybindings for Windows and Linux. --- src/sdl_window.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 7e46fd6f..c4fcbcfa 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -105,6 +105,20 @@ void WindowSDL::onResize() { void WindowSDL::onKeyPress(const SDL_Event* event) { using Libraries::Pad::OrbisPadButtonDataOffset; +#ifdef __APPLE__ + // Use keys that are more friendly for keyboards without a keypad. + // Once there are key binding options this won't be necessary. + constexpr SDL_Keycode CrossKey = SDLK_N; + constexpr SDL_Keycode CircleKey = SDLK_B; + constexpr SDL_Keycode SquareKey = SDLK_V; + constexpr SDL_Keycode TriangleKey = SDLK_C; +#else + constexpr SDL_Keycode CrossKey = SDLK_KP_2; + constexpr SDL_Keycode CircleKey = SDLK_KP_6; + constexpr SDL_Keycode SquareKey = SDLK_KP_4; + constexpr SDL_Keycode TriangleKey = SDLK_KP_8; +#endif + u32 button = 0; Input::Axis axis = Input::Axis::AxisMax; int axisvalue = 0; @@ -122,16 +136,16 @@ void WindowSDL::onKeyPress(const SDL_Event* event) { case SDLK_RIGHT: button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_RIGHT; break; - case SDLK_C: + case TriangleKey: button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_TRIANGLE; break; - case SDLK_B: + case CircleKey: button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_CIRCLE; break; - case SDLK_N: + case CrossKey: button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_CROSS; break; - case SDLK_V: + case SquareKey: button = OrbisPadButtonDataOffset::ORBIS_PAD_BUTTON_SQUARE; break; case SDLK_RETURN: