From ee0936dade3753dc876710b87c6a30297fae60d5 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 1 May 2020 19:41:58 +0200 Subject: Store original velocity after the powermap has been applied. --- src/inputprocessor.cc | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index 1054539..2da5dbc 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -39,6 +39,25 @@ #include "cpp11fix.h" +class VelocityStorer + : public InputFilter +{ +public: + VelocityStorer(float& original_velocity) + : original_velocity(original_velocity) + { + } + + bool filter(event_t& event, std::size_t pos) override + { + original_velocity = event.velocity; + return true; + } + +private: + float& original_velocity; +}; + class Reporter : public InputFilter { @@ -55,7 +74,7 @@ public: return true; } - +private: Settings& settings; float& original_velocity; }; @@ -70,10 +89,11 @@ InputProcessor::InputProcessor(Settings& settings, { // Build filter list filters.emplace_back(std::make_unique(settings)); + filters.emplace_back(std::make_unique(original_velocity)); filters.emplace_back(std::make_unique(settings)); filters.emplace_back(std::make_unique(settings, random)); - filters.emplace_back(std::make_unique(settings, original_velocity)); filters.emplace_back(std::make_unique(settings, random)); + filters.emplace_back(std::make_unique(settings, original_velocity)); } bool InputProcessor::process(std::vector& events, -- cgit v1.2.3