diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2021-03-13 07:25:23 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2021-03-13 15:34:50 -0500 |
commit | 142e00794097dfb78c4b758a2d39d26fae070092 (patch) | |
tree | 72ca6327cf5d1658573ab112b397f2f28992062a /src/interpolation.h | |
parent | 3c505f6f7fa5d4fab7c2a2864a45c8f5d0b4d329 (diff) | |
download | tanetane-142e00794097dfb78c4b758a2d39d26fae070092.tar.gz tanetane-142e00794097dfb78c4b758a2d39d26fae070092.tar.bz2 tanetane-142e00794097dfb78c4b758a2d39d26fae070092.zip |
Created Interpolation abstraction
This simplifies EffectSystem quite a bit, and will be useful in other classes.
Diffstat (limited to 'src/interpolation.h')
-rw-r--r-- | src/interpolation.h | 26 |
1 files changed, 26 insertions, 0 deletions
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 @@ | |||
1 | #ifndef INTERPOLATION_H_861230A8 | ||
2 | #define INTERPOLATION_H_861230A8 | ||
3 | |||
4 | class Interpolation { | ||
5 | public: | ||
6 | |||
7 | void start(int length, double amount); | ||
8 | |||
9 | void tick(double dt); | ||
10 | |||
11 | // Info | ||
12 | |||
13 | double getProgress() const { return progress_; } | ||
14 | |||
15 | bool isComplete() const { return progress_ == dest_; } | ||
16 | |||
17 | private: | ||
18 | |||
19 | double progress_ = 0.0; | ||
20 | double dest_ = 0.0; | ||
21 | double start_ = 0.0; | ||
22 | double length_ = 0.0; | ||
23 | double thus_ = 0.0; | ||
24 | }; | ||
25 | |||
26 | #endif /* end of include guard: INTERPOLATION_H_861230A8 */ | ||