diff options
| author | Jacob Palecki <[email protected]> | 2020-07-29 15:51:53 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-07-29 15:51:53 -0700 |
| commit | 0a91af55f79d9a9d5bda600e8eee7e17c65bd0b6 (patch) | |
| tree | 642659b6ed96b00bc4e9bf6d3152978889ea0079 /wrapper | |
| parent | add sum types (diff) | |
| parent | Use modifier object in wrapper (diff) | |
| download | rawaccel-0a91af55f79d9a9d5bda600e8eee7e17c65bd0b6.tar.xz rawaccel-0a91af55f79d9a9d5bda600e8eee7e17c65bd0b6.zip | |
Merge remote-tracking branch 'downstream/Inheritance' into st-refactor
Diffstat (limited to 'wrapper')
| -rw-r--r-- | wrapper/wrapper.cpp | 4 | ||||
| -rw-r--r-- | wrapper/wrapper.hpp | 38 |
2 files changed, 21 insertions, 21 deletions
diff --git a/wrapper/wrapper.cpp b/wrapper/wrapper.cpp index df3f796..c1cc570 100644 --- a/wrapper/wrapper.cpp +++ b/wrapper/wrapper.cpp @@ -5,10 +5,10 @@ using namespace rawaccel; using namespace System; -Tuple<double, double>^ ManagedAccel::Accelerate(int x, int y, double time, double mode) +Tuple<double, double>^ ManagedAccel::Accelerate(int x, int y, double time) { vec2d input_vec2d = {x, y}; - vec2d output = (*accel_instance)(input_vec2d, (accel_function::milliseconds)time, (rawaccel::mode)mode); + vec2d output = (*modifier_instance).modify_with_accel(input_vec2d, (milliseconds)time); return gcnew Tuple<double, double>(output.x, output.y); }
\ No newline at end of file diff --git a/wrapper/wrapper.hpp b/wrapper/wrapper.hpp index 24bcadb..19b0987 100644 --- a/wrapper/wrapper.hpp +++ b/wrapper/wrapper.hpp @@ -1,7 +1,7 @@ #pragma once #include "..\common\rawaccel.hpp"; -#include "..\common\rawaccel-userspace.hpp"; +#include "..\common\error.hpp"; #include <iostream> using namespace rawaccel; using namespace System; @@ -9,44 +9,44 @@ using namespace System; public ref class ManagedAccel { protected: - accel_function* accel_instance; + mouse_modifier* modifier_instance; public: - ManagedAccel(accel_function* accel) - : accel_instance(accel) + ManagedAccel(mouse_modifier* accel) + : modifier_instance(accel) { } - ManagedAccel(double mode, double offset, double accel, double lim_exp, double midpoint) + ManagedAccel(int mode, double offset, double accel, double lim_exp, double midpoint) { - accel_function::args_t args{}; - args.accel = accel; - args.lim_exp = lim_exp; - args.midpoint = midpoint; - args.accel_mode = (rawaccel::mode)mode; - args.offset = offset; + modifier_args args{}; + args.acc_fn_args.acc_args.accel = accel; + args.acc_fn_args.acc_args.lim_exp = lim_exp; + args.acc_fn_args.acc_args.midpoint = midpoint; + args.acc_fn_args.accel_mode = mode; + args.acc_fn_args.acc_args.offset = offset; - accel_instance = new accel_function(args); + modifier_instance = new mouse_modifier(args); } virtual ~ManagedAccel() { - if (accel_instance != nullptr) + if (modifier_instance!= nullptr) { - delete accel_instance; + delete modifier_instance; } } !ManagedAccel() { - if (accel_instance != nullptr) + if (modifier_instance!= nullptr) { - delete accel_instance; + delete modifier_instance; } } - accel_function* GetInstance() + mouse_modifier* GetInstance() { - return accel_instance; + return modifier_instance; } - Tuple<double, double>^ Accelerate(int x, int y, double time, double mode); + Tuple<double, double>^ Accelerate(int x, int y, double time); };
\ No newline at end of file |