Peoplemon  0.1.0
Peoplemon 3 game source documentation
Rain.hpp
Go to the documentation of this file.
1 #ifndef CORE_MAPS_WEATHER_RAIN_HPP
2 #define CORE_MAPS_WEATHER_RAIN_HPP
3 
4 #include "Base.hpp"
5 #include "Thunder.hpp"
6 
7 #include <BLIB/Audio.hpp>
8 #include <BLIB/Particles.hpp>
9 #include <BLIB/Resources.hpp>
10 #include <BLIB/Util/Random.hpp>
11 #include <SFML/Graphics/RectangleShape.hpp>
12 #include <SFML/Graphics/Sprite.hpp>
13 #include <SFML/Graphics/Texture.hpp>
14 #include <SFML/System/Vector3.hpp>
15 
16 namespace core
17 {
18 namespace map
19 {
20 namespace weather
21 {
22 namespace rain
23 {
24 struct Raindrop;
25 class TimeEmitter;
26 } // namespace rain
27 
34 class Rain : public Base {
35 public:
42  Rain(bool hard, bool thunder);
43 
47  virtual ~Rain();
48 
52  virtual Weather::Type type() const override;
53 
61  virtual void start(bl::engine::Engine& engine, bl::rc::RenderTarget& renderTarget,
62  Map& map) override;
63 
67  virtual void stop() override;
68 
74  virtual bool stopped() const override;
75 
81  virtual void update(float dt) override;
82 
83 private:
84  bl::engine::Engine* engine;
85  bl::pcl::ParticleManager<rain::Raindrop>* particles;
86  rain::TimeEmitter* emitter;
87  const Weather::Type _type;
88  const unsigned int targetParticleCount;
89  const glm::vec2 velocity;
90  const float fallSpeed;
91  const float rotation;
92  float stopFactor;
93 
94  bl::rc::res::TextureRef dropTxtr;
95  bl::rc::res::TextureRef splash1Txtr;
96  bl::rc::res::TextureRef splash2Txtr;
97 
98  bl::audio::AudioSystem::Handle rainSoundHandle;
99 
100  Thunder thunder;
101 };
102 
103 } // namespace weather
104 } // namespace map
105 } // namespace core
106 
107 #endif
Core classes and functionality for both the editor and game.
core::map::weather::rain::Raindrop Raindrop
Definition: Rain.cpp:77
The primary map class that represents a usable map in the game.
Definition: Map.hpp:49
Type
The type of weather.
Definition: Weather.hpp:38
Base class for all weather types.
Definition: Base.hpp:28
Weather type for rainy days. Handles light and hard rain and owns thunder if need be.
Definition: Rain.hpp:34
virtual void stop() override
Stop the rain.
Definition: Rain.cpp:257
virtual bool stopped() const override
Returns true when all rain is fallen after stop() is called.
Definition: Rain.cpp:263
virtual void start(bl::engine::Engine &engine, bl::rc::RenderTarget &renderTarget, Map &map) override
Start the rain.
Definition: Rain.cpp:220
virtual Weather::Type type() const override
One of LightRain, LightRainThunder, HardRain, or HardRainThunder.
Definition: Rain.cpp:218
Rain(bool hard, bool thunder)
Construct a new Rain system.
Definition: Rain.cpp:196
virtual ~Rain()
Destroy the Rain.
Definition: Rain.cpp:212
virtual void update(float dt) override
Updates the rain.
Definition: Rain.cpp:265
Simple helper class for creating thunder in different weather types.
Definition: Thunder.hpp:19