diff options
| author | Jacob Palecki <[email protected]> | 2020-07-28 02:44:09 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-07-28 02:44:09 -0700 |
| commit | b1ef35050600978318581586691f5a8f119abf5b (patch) | |
| tree | 1a096e8c6d5ceff50ca169fb2295118184d629f5 /common | |
| parent | Remove extra mode from variables (diff) | |
| download | rawaccel-b1ef35050600978318581586691f5a8f119abf5b.tar.xz rawaccel-b1ef35050600978318581586691f5a8f119abf5b.zip | |
Rename variables and add modify functions
Diffstat (limited to 'common')
| -rw-r--r-- | common/rawaccel-userspace.hpp | 4 | ||||
| -rw-r--r-- | common/rawaccel.hpp | 19 |
2 files changed, 18 insertions, 5 deletions
diff --git a/common/rawaccel-userspace.hpp b/common/rawaccel-userspace.hpp index bca6997..d0722b6 100644 --- a/common/rawaccel-userspace.hpp +++ b/common/rawaccel-userspace.hpp @@ -16,7 +16,7 @@ void error(const char* s) { throw std::domain_error(s); } -variables parse(int argc, char** argv) { +mouse_modifier parse(int argc, char** argv) { double degrees = 0; vec2d sens = { 1, 1 }; args_t accel_args{}; @@ -121,7 +121,7 @@ variables parse(int argc, char** argv) { std::exit(0); } - return variables(-degrees, sens, accel_args); + return mouse_modifier(-degrees, sens, accel_args); } } // rawaccel diff --git a/common/rawaccel.hpp b/common/rawaccel.hpp index 28d9ee2..9b35568 100644 --- a/common/rawaccel.hpp +++ b/common/rawaccel.hpp @@ -309,14 +309,14 @@ namespace rawaccel { accel_function() = default; }; - struct variables { + struct mouse_modifier { bool apply_rotate = false; bool apply_accel = false; rotator rotate; accel_function accel_fn; vec2d sensitivity = { 1, 1 }; - variables(double degrees, vec2d sens, args_t accel_args) + mouse_modifier(double degrees, vec2d sens, args_t accel_args) : accel_fn(accel_args) { apply_rotate = degrees != 0; @@ -330,7 +330,20 @@ namespace rawaccel { sensitivity = sens; } - variables() = default; + vec2d modify(vec2d input) + { + if (apply_rotate) + { + return rotate(input); + } + } + + vec2d modify(vec2d input, milliseconds time) + { + return accel_fn(modify(input), time); + } + + mouse_modifier() = default; }; } // rawaccel
\ No newline at end of file |