diff options
Diffstat (limited to 'src/joyGet.cpp')
-rw-r--r-- | src/joyGet.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/joyGet.cpp b/src/joyGet.cpp new file mode 100644 index 0000000..f48c783 --- /dev/null +++ b/src/joyGet.cpp @@ -0,0 +1,32 @@ +#include "FLD.hpp" + +FLD::InputState +FLD::joyGet(SDL_Scancode sc) const +{ + return joystates[sc]; +} + +bool +FLD::joyDown(SDL_Scancode sc) const +{ + const auto state = joyGet(sc); + return (state == InputState::Down || state == InputState::Press); +} + +bool +FLD::joyUp(SDL_Scancode sc) const +{ + return !joyDown(sc); +} + +bool +FLD::joyPressed(SDL_Scancode sc) const +{ + return (joyGet(sc) == InputState::Press); +} + +bool +FLD::joyReleased(SDL_Scancode sc) const +{ + return (joyGet(sc) == InputState::Release); +} |