From c3761f14bb5f9dca54e36435cbab6ce7b43c8612 Mon Sep 17 00:00:00 2001 From: kdx Date: Mon, 17 Jul 2023 07:39:42 +0200 Subject: fix mouse/joy getters --- src/FLD.hpp | 20 ++++++++++---------- src/joyGet.cpp | 20 ++++++++++---------- src/mouseGet.cpp | 20 ++++++++++---------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/FLD.hpp b/src/FLD.hpp index 958a724..ecc88a8 100644 --- a/src/FLD.hpp +++ b/src/FLD.hpp @@ -124,17 +124,17 @@ public: [[nodiscard]] bool keyPressed(SDL_Scancode sc) const; [[nodiscard]] bool keyReleased(SDL_Scancode sc) const; - [[nodiscard]] InputState mouseGet(SDL_Scancode sc) const; - [[nodiscard]] bool mouseDown(SDL_Scancode sc) const; - [[nodiscard]] bool mouseUp(SDL_Scancode sc) const; - [[nodiscard]] bool mousePressed(SDL_Scancode sc) const; - [[nodiscard]] bool mouseReleased(SDL_Scancode sc) const; + [[nodiscard]] InputState mouseGet(Uint8 btn) const; + [[nodiscard]] bool mouseDown(Uint8 btn) const; + [[nodiscard]] bool mouseUp(Uint8 btn) const; + [[nodiscard]] bool mousePressed(Uint8 btn) const; + [[nodiscard]] bool mouseReleased(Uint8 btn) const; - [[nodiscard]] InputState joyGet(SDL_Scancode sc) const; - [[nodiscard]] bool joyDown(SDL_Scancode sc) const; - [[nodiscard]] bool joyUp(SDL_Scancode sc) const; - [[nodiscard]] bool joyPressed(SDL_Scancode sc) const; - [[nodiscard]] bool joyReleased(SDL_Scancode sc) const; + [[nodiscard]] InputState joyGet(Uint8 btn) const; + [[nodiscard]] bool joyDown(Uint8 btn) const; + [[nodiscard]] bool joyUp(Uint8 btn) const; + [[nodiscard]] bool joyPressed(Uint8 btn) const; + [[nodiscard]] bool joyReleased(Uint8 btn) const; private: bool shouldQuit = false; struct { diff --git a/src/joyGet.cpp b/src/joyGet.cpp index f48c783..0de5cc0 100644 --- a/src/joyGet.cpp +++ b/src/joyGet.cpp @@ -1,32 +1,32 @@ #include "FLD.hpp" FLD::InputState -FLD::joyGet(SDL_Scancode sc) const +FLD::joyGet(Uint8 btn) const { - return joystates[sc]; + return joystates[btn]; } bool -FLD::joyDown(SDL_Scancode sc) const +FLD::joyDown(Uint8 btn) const { - const auto state = joyGet(sc); + const auto state = joyGet(btn); return (state == InputState::Down || state == InputState::Press); } bool -FLD::joyUp(SDL_Scancode sc) const +FLD::joyUp(Uint8 btn) const { - return !joyDown(sc); + return !joyDown(btn); } bool -FLD::joyPressed(SDL_Scancode sc) const +FLD::joyPressed(Uint8 btn) const { - return (joyGet(sc) == InputState::Press); + return (joyGet(btn) == InputState::Press); } bool -FLD::joyReleased(SDL_Scancode sc) const +FLD::joyReleased(Uint8 btn) const { - return (joyGet(sc) == InputState::Release); + return (joyGet(btn) == InputState::Release); } diff --git a/src/mouseGet.cpp b/src/mouseGet.cpp index 503757e..f26e800 100644 --- a/src/mouseGet.cpp +++ b/src/mouseGet.cpp @@ -1,32 +1,32 @@ #include "FLD.hpp" FLD::InputState -FLD::mouseGet(SDL_Scancode sc) const +FLD::mouseGet(Uint8 btn) const { - return mousestates[sc]; + return mousestates[btn]; } bool -FLD::mouseDown(SDL_Scancode sc) const +FLD::mouseDown(Uint8 btn) const { - const auto state = mouseGet(sc); + const auto state = mouseGet(btn); return (state == InputState::Down || state == InputState::Press); } bool -FLD::mouseUp(SDL_Scancode sc) const +FLD::mouseUp(Uint8 btn) const { - return !mouseDown(sc); + return !mouseDown(btn); } bool -FLD::mousePressed(SDL_Scancode sc) const +FLD::mousePressed(Uint8 btn) const { - return (mouseGet(sc) == InputState::Press); + return (mouseGet(btn) == InputState::Press); } bool -FLD::mouseReleased(SDL_Scancode sc) const +FLD::mouseReleased(Uint8 btn) const { - return (mouseGet(sc) == InputState::Release); + return (mouseGet(btn) == InputState::Release); } -- cgit v1.2.3