diff options
| author | Jacob Palecki <[email protected]> | 2021-01-10 23:49:28 -0800 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2021-01-10 23:49:28 -0800 |
| commit | de6b18db8226650cee9726c4694931bdc4b89fad (patch) | |
| tree | c5bffd4d1eaad53842394c92d4907acb65c6ff84 /common | |
| parent | Add to stigma, directional to settings (diff) | |
| download | rawaccel-de6b18db8226650cee9726c4694931bdc4b89fad.tar.xz rawaccel-de6b18db8226650cee9726c4694931bdc4b89fad.zip | |
Implement direcitonality UI
Diffstat (limited to 'common')
| -rw-r--r-- | common/accel-base.hpp | 5 | ||||
| -rw-r--r-- | common/rawaccel-settings.h | 2 | ||||
| -rw-r--r-- | common/rawaccel.hpp | 11 |
3 files changed, 9 insertions, 9 deletions
diff --git a/common/accel-base.hpp b/common/accel-base.hpp index b15d695..f98a36d 100644 --- a/common/accel-base.hpp +++ b/common/accel-base.hpp @@ -17,6 +17,11 @@ namespace rawaccel { double speed_cap = 0; }; + struct stigma_args { + vec2d sigmas = { 1, 1 }; + double lp_norm = 2; + }; + template <typename Func> struct accel_val_base { bool legacy_offset = false; diff --git a/common/rawaccel-settings.h b/common/rawaccel-settings.h index 2c5b86f..8dd446f 100644 --- a/common/rawaccel-settings.h +++ b/common/rawaccel-settings.h @@ -23,7 +23,7 @@ namespace rawaccel { vec2d sens = { 1, 1 }; vec2d dir_multipliers = {}; vec2d directional_weights = { 1, 1 }; - stigma_args args_stigma; + stigma_args args_stigma = stigma_args(); milliseconds time_min = DEFAULT_TIME_MIN; }; diff --git a/common/rawaccel.hpp b/common/rawaccel.hpp index 4a9dc90..d1cafdd 100644 --- a/common/rawaccel.hpp +++ b/common/rawaccel.hpp @@ -225,11 +225,6 @@ namespace rawaccel { accelerator() = default; }; - struct stigma_args { - vec2d sigmas = { 1, 1 }; - double lp_norm = 2; - }; - struct stigma_distance { double p = 2.0; double p_inverse = 0.5; @@ -255,7 +250,7 @@ namespace rawaccel { } } - double calculate(int x, int y) + double calculate(double x, double y) { double x_scaled = x * sigma_x; double y_scaled = y * sigma_y; @@ -285,7 +280,7 @@ namespace rawaccel { } } - inline int atan_scale(double x, double y) + inline double atan_scale(double x, double y) { return M_2_PI * atan2(fabs(y), fabs(x)); } @@ -361,7 +356,7 @@ namespace rawaccel { if (directional.should_apply) { - scale *= directional.apply(movement.x, movement.y); + scale = (scale - 1)*directional.apply(movement.x, movement.y) + 1; } movement.x *= scale; |