diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-14 16:13:08 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-14 16:13:08 -0500 |
| commit | ce0628c5ad96e094db12a67d4e98b445fa873ad3 (patch) | |
| tree | 94a67903059685969085f7ee5724b9960c74d3f6 /src/effect_system.h | |
| parent | 73c9b0fb4eb35e73d0005f896462e748a207d2b1 (diff) | |
| download | tanetane-ce0628c5ad96e094db12a67d4e98b445fa873ad3.tar.gz tanetane-ce0628c5ad96e094db12a67d4e98b445fa873ad3.tar.bz2 tanetane-ce0628c5ad96e094db12a67d4e98b445fa873ad3.zip | |
Added map fadeouts
Screen fadeouts and map fadeouts are now handled by the effect system.
Diffstat (limited to 'src/effect_system.h')
| -rw-r--r-- | src/effect_system.h | 60 |
1 files changed, 60 insertions, 0 deletions
| diff --git a/src/effect_system.h b/src/effect_system.h new file mode 100644 index 0000000..2cdcb10 --- /dev/null +++ b/src/effect_system.h | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | #ifndef EFFECT_SYSTEM_H_0B497B39 | ||
| 2 | #define EFFECT_SYSTEM_H_0B497B39 | ||
| 3 | |||
| 4 | #include "system.h" | ||
| 5 | |||
| 6 | class Game; | ||
| 7 | |||
| 8 | class EffectSystem : public System { | ||
| 9 | public: | ||
| 10 | |||
| 11 | static constexpr SystemKey Key = SystemKey::Effect; | ||
| 12 | |||
| 13 | explicit EffectSystem(Game& game) : game_(game) {} | ||
| 14 | |||
| 15 | void tick(double dt) override; | ||
| 16 | |||
| 17 | /* Commands */ | ||
| 18 | |||
| 19 | // Fades the entire screen in or out | ||
| 20 | // - length is in milliseconds | ||
| 21 | // - amount is [0,1] | ||
| 22 | void fadeScreen(int length, double amount); | ||
| 23 | |||
| 24 | // Fades just the map, leaving the sprites, messages, etc unfaded. | ||
| 25 | // - length is in milliseconds | ||
| 26 | // - amount is [0,1] | ||
| 27 | void fadeMap(int length, double amount); | ||
| 28 | |||
| 29 | /* Information */ | ||
| 30 | |||
| 31 | bool isScreenFaded() const { return screenFade_ > 0.0; } | ||
| 32 | |||
| 33 | double getScreenFadeProgress() const { return screenFade_; } | ||
| 34 | |||
| 35 | bool isScreenFadeComplete() const { return screenFade_ == screenFadeDest_; } | ||
| 36 | |||
| 37 | bool isMapFaded() const { return mapFade_ > 0.0; } | ||
| 38 | |||
| 39 | double getMapFadeProgress() const { return mapFade_; } | ||
| 40 | |||
| 41 | bool isMapFadeComplete() const { return mapFade_ == mapFadeDest_; } | ||
| 42 | |||
| 43 | private: | ||
| 44 | |||
| 45 | Game& game_; | ||
| 46 | |||
| 47 | double screenFade_ = 0.0; | ||
| 48 | double screenFadeDest_ = 0.0; | ||
| 49 | double screenFadeStart_ = 0.0; | ||
| 50 | double screenFadeLength_ = 0; | ||
| 51 | double screenFadeThus_ = 0; | ||
| 52 | |||
| 53 | double mapFade_ = 0.0; | ||
| 54 | double mapFadeDest_ = 0.0; | ||
| 55 | double mapFadeStart_ = 0.0; | ||
| 56 | double mapFadeLength_ = 0.0; | ||
| 57 | double mapFadeThus_ = 0.0; | ||
| 58 | }; | ||
| 59 | |||
| 60 | #endif /* end of include guard: EFFECT_SYSTEM_H_0B497B39 */ | ||
