diff options
| author | Jacob Palecki <[email protected]> | 2020-08-11 23:06:39 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-11 23:06:39 -0700 |
| commit | 65a74b97c0c9ac8ca10312c0749e33df9e64b3d9 (patch) | |
| tree | d15dbadb2497ae5df3d734b534d73ea613a0e943 /common | |
| parent | Merge branch 'master' into GainCap (diff) | |
| download | rawaccel-65a74b97c0c9ac8ca10312c0749e33df9e64b3d9.tar.xz rawaccel-65a74b97c0c9ac8ca10312c0749e33df9e64b3d9.zip | |
Disallow differing x and y weights with gain cap
Diffstat (limited to 'common')
| -rw-r--r-- | common/accel-base.hpp | 2 | ||||
| -rw-r--r-- | common/rawaccel.hpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/common/accel-base.hpp b/common/accel-base.hpp index 91510a4..60b7362 100644 --- a/common/accel-base.hpp +++ b/common/accel-base.hpp @@ -24,6 +24,7 @@ namespace rawaccel { double exponent = 2; double midpoint = 0; double power_scale = 1; + double gain_cap = 0; vec2d weight = { 1, 1 }; }; @@ -68,6 +69,7 @@ namespace rawaccel { /// <param name="args">Arguments to verified.</param> void verify(const accel_args& args) const { if (args.accel < 0) bad_arg("accel can not be negative, use a negative weight to compensate"); + if (args.gain_cap > 0 && weight.x != weight.y) bad_arg("weight x and y values must be equal with a gain cap"); } accel_base() = default; diff --git a/common/rawaccel.hpp b/common/rawaccel.hpp index fc06731..8dc4825 100644 --- a/common/rawaccel.hpp +++ b/common/rawaccel.hpp @@ -160,7 +160,6 @@ namespace rawaccel { int accel_mode = accel_impl_t::id<accel_noaccel>; milliseconds time_min = 0.4; vec2d cap = { 0, 0 }; - double gain_cap = 0; }; /// <summary> Struct for holding acceleration application details. </summary> @@ -196,7 +195,7 @@ namespace rawaccel { speed_offset = args.acc_args.offset; clamp.x = accel_scale_clamp(args.cap.x); clamp.y = accel_scale_clamp(args.cap.y); - gain_cap = velocity_gain_cap(args.gain_cap, speed_offset, accel); + gain_cap = velocity_gain_cap(args.acc_args.gain_cap, speed_offset, accel); } /// <summary> |