diff options
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; +} |