summaryrefslogtreecommitdiff
path: root/common/accel-jump.hpp
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-08-28 01:19:18 -0400
committera1xd <[email protected]>2021-09-23 22:28:44 -0400
commit5b659e1cfbc4b8fbbd2f2bf41dc716929976c77d (patch)
tree4bffba32fa508494a268b6f53513fb3c7b1e3e5c /common/accel-jump.hpp
parentMerge pull request #107 from a1xd/1.5.0-fix (diff)
downloadrawaccel-5b659e1cfbc4b8fbbd2f2bf41dc716929976c77d.tar.xz
rawaccel-5b659e1cfbc4b8fbbd2f2bf41dc716929976c77d.zip
add per-device configuration
adds input and [in, out] cap for classic mode adds input cap for power mode change wrapper/input, now gets useful device names change (now dev specific) dpi to adjust sensitivity change y sensitivity to y/x ratio remove spaced LUTs grapher and convert do not build
Diffstat (limited to 'common/accel-jump.hpp')
-rw-r--r--common/accel-jump.hpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/common/accel-jump.hpp b/common/accel-jump.hpp
index 95fa461..c036810 100644
--- a/common/accel-jump.hpp
+++ b/common/accel-jump.hpp
@@ -2,6 +2,8 @@
#include "rawaccel-base.hpp"
+#include <math.h>
+
namespace rawaccel {
struct jump_base {
@@ -12,7 +14,7 @@ namespace rawaccel {
// requirements: args.smooth in range [0, 1]
jump_base(const accel_args& args) :
- step({ args.offset, args.cap - 1 })
+ step({ args.cap.x, args.cap.y - 1 })
{
double rate_inverse = args.smooth * step.x;
@@ -43,12 +45,16 @@ namespace rawaccel {
{
return step.y * (x + log(1 + decay(x)) / smooth_rate);
}
+
};
- struct jump_legacy : jump_base {
+ template <bool Gain> struct jump;
+
+ template<>
+ struct jump<LEGACY> : jump_base {
using jump_base::jump_base;
- double operator()(double x) const
+ double operator()(double x, const accel_args&) const
{
if (is_smooth()) return smooth(x) + 1;
else if (x < step.x) return 1;
@@ -56,14 +62,15 @@ namespace rawaccel {
}
};
- struct jump : jump_base {
+ template<>
+ struct jump<GAIN> : jump_base {
double C;
jump(const accel_args& args) :
jump_base(args),
C(-smooth_antideriv(0)) {}
- double operator()(double x) const
+ double operator()(double x, const accel_args&) const
{
if (x <= 0) return 1;
@@ -72,6 +79,7 @@ namespace rawaccel {
if (x < step.x) return 1;
else return 1 + step.y * (x - step.x) / x;
}
+
};
}