diff options
| author | a1xd <[email protected]> | 2020-12-03 20:00:31 -0500 |
|---|---|---|
| committer | a1xd <[email protected]> | 2020-12-03 20:00:31 -0500 |
| commit | 5657d5a54c0a8e980c9b0cac39e2d16e452f302e (patch) | |
| tree | 03c254c41dba5f64a998ac13c38e36943bf8b942 /common | |
| parent | update writer - use messagebox instead of console (diff) | |
| download | rawaccel-5657d5a54c0a8e980c9b0cac39e2d16e452f302e.tar.xz rawaccel-5657d5a54c0a8e980c9b0cac39e2d16e452f302e.zip | |
add directional multipliers
adds multipliers for movement in negative directions (up & left by default, can be flipped by rot or sens)
avoid division by user input in mousewatcher
Diffstat (limited to 'common')
| -rw-r--r-- | common/rawaccel-settings.h | 1 | ||||
| -rw-r--r-- | common/rawaccel.hpp | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/common/rawaccel-settings.h b/common/rawaccel-settings.h index e9e158c..0f52807 100644 --- a/common/rawaccel-settings.h +++ b/common/rawaccel-settings.h @@ -21,6 +21,7 @@ namespace rawaccel { vec2<accel_mode> modes = { accel_mode::noaccel, accel_mode::noaccel }; vec2<accel_args> argsv; vec2d sens = { 1, 1 }; + vec2d neg_multipliers = {}; milliseconds time_min = DEFAULT_TIME_MIN; }; diff --git a/common/rawaccel.hpp b/common/rawaccel.hpp index b160a42..a7b9144 100644 --- a/common/rawaccel.hpp +++ b/common/rawaccel.hpp @@ -233,6 +233,7 @@ namespace rawaccel { rotator rotate; vec2<accelerator> accels; vec2d sensitivity = { 1, 1 }; + vec2d negative_multipliers = {}; mouse_modifier(const settings& args, vec2<si_pair*> luts = {}) : combine_magnitudes(args.combine_mags) @@ -245,6 +246,9 @@ namespace rawaccel { if (args.sens.x != 0) sensitivity.x = args.sens.x; if (args.sens.y != 0) sensitivity.y = args.sens.y; + negative_multipliers.x = fabs(args.neg_multipliers.x); + negative_multipliers.y = fabs(args.neg_multipliers.y); + if ((combine_magnitudes && args.modes.x == accel_mode::noaccel) || (args.modes.x == accel_mode::noaccel && args.modes.y == accel_mode::noaccel)) { @@ -285,9 +289,16 @@ namespace rawaccel { } } - inline void apply_sensitivity(vec2d& movement) { + inline void apply_sensitivity(vec2d& movement) { movement.x *= sensitivity.x; movement.y *= sensitivity.y; + + if (negative_multipliers.x > 0 && movement.x < 0) { + movement.x *= negative_multipliers.x; + } + if (negative_multipliers.y > 0 && movement.y < 0) { + movement.y *= negative_multipliers.y; + } } mouse_modifier() = default; |