mirror of
https://github.com/RawAccelOfficial/rawaccel.git
synced 2025-05-11 18:36:46 +02:00
add independent xy accel to driver
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
This commit is contained in:
parent
313ab92531
commit
9010cc593a
42 changed files with 626 additions and 993 deletions
|
@ -7,25 +7,23 @@
|
|||
namespace rawaccel {
|
||||
|
||||
/// <summary> Struct to hold "natural" (vanishing difference) acceleration implementation. </summary>
|
||||
struct accel_natural : accel_base {
|
||||
double limit = 1;
|
||||
double midpoint = 0;
|
||||
struct natural_impl {
|
||||
double rate;
|
||||
double limit;
|
||||
|
||||
accel_natural(const accel_args& args) : accel_base(args) {
|
||||
verify(args);
|
||||
|
||||
limit = args.limit - 1;
|
||||
speed_coeff /= limit;
|
||||
natural_impl(const accel_args& args) :
|
||||
rate(args.accel), limit(args.limit - 1)
|
||||
{
|
||||
rate /= limit;
|
||||
}
|
||||
|
||||
inline double accelerate(double speed) const {
|
||||
inline double operator()(double speed) const {
|
||||
// f(x) = k(1-e^(-mx))
|
||||
return limit - (limit * exp(-speed_coeff * speed));
|
||||
return limit - (limit * exp(-rate * speed));
|
||||
}
|
||||
|
||||
void verify(const accel_args& args) const {
|
||||
if (args.limit <= 1) bad_arg("limit must be greater than 1");
|
||||
}
|
||||
};
|
||||
|
||||
using accel_natural = additive_accel<natural_impl>;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue