From 142e00794097dfb78c4b758a2d39d26fae070092 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 13 Mar 2021 07:25:23 -0500 Subject: Created Interpolation abstraction This simplifies EffectSystem quite a bit, and will be useful in other classes. --- src/interpolation.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/interpolation.h (limited to 'src/interpolation.h') diff --git a/src/interpolation.h b/src/interpolation.h new file mode 100644 index 0000000..d89602d --- /dev/null +++ b/src/interpolation.h @@ -0,0 +1,26 @@ +#ifndef INTERPOLATION_H_861230A8 +#define INTERPOLATION_H_861230A8 + +class Interpolation { +public: + + void start(int length, double amount); + + void tick(double dt); + + // Info + + double getProgress() const { return progress_; } + + bool isComplete() const { return progress_ == dest_; } + +private: + + double progress_ = 0.0; + double dest_ = 0.0; + double start_ = 0.0; + double length_ = 0.0; + double thus_ = 0.0; +}; + +#endif /* end of include guard: INTERPOLATION_H_861230A8 */ -- cgit 1.4.1