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/effect_system.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/effect_system.h')
-rw-r--r-- | src/effect_system.h | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/src/effect_system.h b/src/effect_system.h index 904e6cb..b2b4669 100644 --- a/src/effect_system.h +++ b/src/effect_system.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef EFFECT_SYSTEM_H_0B497B39 | 1 | #ifndef EFFECT_SYSTEM_H_0B497B39 |
2 | #define EFFECT_SYSTEM_H_0B497B39 | 2 | #define EFFECT_SYSTEM_H_0B497B39 |
3 | 3 | ||
4 | #include "interpolation.h" | ||
4 | #include "system.h" | 5 | #include "system.h" |
5 | #include "timer.h" | 6 | #include "timer.h" |
6 | #include "vector.h" | 7 | #include "vector.h" |
@@ -41,54 +42,40 @@ public: | |||
41 | 42 | ||
42 | /* Information */ | 43 | /* Information */ |
43 | 44 | ||
44 | bool isScreenFaded() const { return screenFade_ > 0.0; } | 45 | bool isScreenFaded() const { return screenFade_.getProgress() > 0.0; } |
45 | 46 | ||
46 | double getScreenFadeProgress() const { return screenFade_; } | 47 | double getScreenFadeProgress() const { return screenFade_.getProgress(); } |
47 | 48 | ||
48 | bool isScreenFadeComplete() const { return screenFade_ == screenFadeDest_; } | 49 | bool isScreenFadeComplete() const { return screenFade_.isComplete(); } |
49 | 50 | ||
50 | bool isMapFaded() const { return mapFade_ > 0.0; } | 51 | bool isMapFaded() const { return mapFade_.getProgress() > 0.0; } |
51 | 52 | ||
52 | double getMapFadeProgress() const { return mapFade_; } | 53 | double getMapFadeProgress() const { return mapFade_.getProgress(); } |
53 | 54 | ||
54 | bool isMapFadeComplete() const { return mapFade_ == mapFadeDest_; } | 55 | bool isMapFadeComplete() const { return mapFade_.isComplete(); } |
55 | 56 | ||
56 | const vec2i& getCameraShakeOffset() const { return cameraShakeOffset_; } | 57 | const vec2i& getCameraShakeOffset() const { return cameraShakeOffset_; } |
57 | 58 | ||
58 | bool isCameraShaking() const { return cameraShaking_; } | 59 | bool isCameraShaking() const { return cameraShaking_; } |
59 | 60 | ||
60 | bool isCircleTransitionActive() const { return circleEffect_ > 0.0; } | 61 | bool isCircleTransitionActive() const { return circleEffect_.getProgress() > 0.0; } |
61 | 62 | ||
62 | double getCircleTransitionProgress() const { return circleEffect_; } | 63 | double getCircleTransitionProgress() const { return circleEffect_.getProgress(); } |
63 | 64 | ||
64 | bool isCircleTransitionComplete() const { return circleEffect_ == circleEffectDest_; } | 65 | bool isCircleTransitionComplete() const { return circleEffect_.isComplete(); } |
65 | 66 | ||
66 | private: | 67 | private: |
67 | 68 | ||
68 | Game& game_; | 69 | Game& game_; |
69 | 70 | ||
70 | double screenFade_ = 0.0; | 71 | Interpolation screenFade_; |
71 | double screenFadeDest_ = 0.0; | 72 | Interpolation mapFade_; |
72 | double screenFadeStart_ = 0.0; | 73 | Interpolation circleEffect_; |
73 | double screenFadeLength_ = 0; | ||
74 | double screenFadeThus_ = 0; | ||
75 | |||
76 | double mapFade_ = 0.0; | ||
77 | double mapFadeDest_ = 0.0; | ||
78 | double mapFadeStart_ = 0.0; | ||
79 | double mapFadeLength_ = 0.0; | ||
80 | double mapFadeThus_ = 0.0; | ||
81 | 74 | ||
82 | bool cameraShaking_ = false; | 75 | bool cameraShaking_ = false; |
83 | vec2i cameraShakeOffset_ { 0, 0 }; | 76 | vec2i cameraShakeOffset_ { 0, 0 }; |
84 | bool cameraShakeOn_ = false; | 77 | bool cameraShakeOn_ = false; |
85 | Timer cameraShakeTimer_ { 0 }; | 78 | Timer cameraShakeTimer_ { 0 }; |
86 | |||
87 | double circleEffect_ = 0.0; | ||
88 | double circleEffectDest_ = 0.0; | ||
89 | double circleEffectStart_ = 0.0; | ||
90 | double circleEffectLength_ = 0.0; | ||
91 | double circleEffectThus_ = 0.0; | ||
92 | }; | 79 | }; |
93 | 80 | ||
94 | #endif /* end of include guard: EFFECT_SYSTEM_H_0B497B39 */ | 81 | #endif /* end of include guard: EFFECT_SYSTEM_H_0B497B39 */ |