diff options
author | Antti Hölttä <AHoelttae@luxoft.com> | 2018-07-23 14:53:11 +0200 |
---|---|---|
committer | Antti Hölttä <AHoelttae@luxoft.com> | 2019-03-18 16:29:30 +0100 |
commit | ffd151ecf3971fd8601d8b1d4e2f04fb5793e364 (patch) | |
tree | cd3b947f04781d59bc61306dd34ef15f8c3a24fd /plugin/inputtypes.cpp |
Initial commit, demoable poc
Sort of working with 4 dir navigation, check demoapp
Diffstat (limited to 'plugin/inputtypes.cpp')
-rw-r--r-- | plugin/inputtypes.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugin/inputtypes.cpp b/plugin/inputtypes.cpp new file mode 100644 index 0000000..770b03d --- /dev/null +++ b/plugin/inputtypes.cpp @@ -0,0 +1,23 @@ +#include "inputtypes.h" + +const CursorNavigationCommand CursorNavigationCommand::Up(1.0, 270.0); +const CursorNavigationCommand CursorNavigationCommand::Down(1.0, 90.0); +const CursorNavigationCommand CursorNavigationCommand::Left(1.0, 180.0); +const CursorNavigationCommand CursorNavigationCommand::Right(1.0, 0.0); + +CursorNavigationCommand::CursorNavigationCommand() + :magnitude(-1), angle(-1), action(NoAction) +{} + +CursorNavigationCommand::CursorNavigationCommand(float magnitude, int angle) + :magnitude(magnitude), angle(angle), action(NoAction) +{} + +//test if this commands angle is between given angles. clockwise from begin to end +bool CursorNavigationCommand::angleIsBetween(int begin, int end) const +{ + if (begin > end) + return angle >= begin || angle <= end; + else + return angle >= begin && angle <= end; +} |