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