mirror of
https://github.com/RawAccelOfficial/rawaccel.git
synced 2025-05-11 10:26:58 +02:00
other changes: modifier_args type name is now settings, which is now the type passed in driver ioctl remove most settings/args verification from driver, plan to let gui handle most of it add another accel arg, rate, which is used to set the 'accel' parameter of types which call exp (nat/sig), might want to cap it add (update) serializable DriverSettings (ModifierArgs) class to gui and static methods for interop remove properties from ManagedAccel, its now just a black box for accessing modifier methods add exception handling in wrapper_io to throw proper managed types change SettingsManager::Startup to make a new settings file if an error occurs during deserialization change structure of accel types; how offset and weight are applied now depend on additivity of types remove tagged_union and add a handrolled variant/visit impl AccelGui::UpdateActiveValueLabels currently broken for caps and a few other args remove gui default layout and initial natural accel setup cli not updated
29 lines
540 B
C++
29 lines
540 B
C++
#pragma once
|
|
|
|
#include <math.h>
|
|
|
|
#include "accel-base.hpp"
|
|
|
|
namespace rawaccel {
|
|
|
|
/// <summary> Struct to hold "natural" (vanishing difference) acceleration implementation. </summary>
|
|
struct natural_impl {
|
|
double rate;
|
|
double limit;
|
|
|
|
natural_impl(const accel_args& args) :
|
|
rate(args.accel), limit(args.limit - 1)
|
|
{
|
|
rate /= limit;
|
|
}
|
|
|
|
inline double operator()(double speed) const {
|
|
// f(x) = k(1-e^(-mx))
|
|
return limit - (limit * exp(-rate * speed));
|
|
}
|
|
|
|
};
|
|
|
|
using accel_natural = additive_accel<natural_impl>;
|
|
|
|
}
|