Peoplemon  0.1.0
Peoplemon 3 game source documentation
Evolution.hpp
Go to the documentation of this file.
1 #ifndef GAME_STATE_EVOLUTION_HPP
2 #define GAME_STATE_EVOLUTION_HPP
3 
4 #include <BLIB/Graphics.hpp>
5 #include <BLIB/Particles.hpp>
7 #include <Game/States/State.hpp>
8 
9 namespace game
10 {
11 namespace state
12 {
18 class Evolution
19 : public State
20 , public bl::input::Listener {
21 public:
22  static bl::engine::State::Ptr create(core::system::Systems& systems,
24 
28  virtual ~Evolution() = default;
29 
33  const char* name() const override;
34 
40  virtual void activate(bl::engine::Engine& engine) override;
41 
47  virtual void deactivate(bl::engine::Engine& engine) override;
48 
55  virtual void update(bl::engine::Engine& engine, float dt, float) override;
56 
57  struct Spark {
58  glm::vec2 position;
59  glm::vec2 velocity;
60  float radius;
61  float time;
62  float lifetime;
63  };
64 
65 private:
67 
68  bl::rc::res::TextureRef bgndTxtr;
69  bl::rc::res::TextureRef oldTxtr;
70  bl::rc::res::TextureRef newTxtr;
71  bl::gfx::Sprite background;
72  bl::gfx::Sprite oldThumb;
73  bl::gfx::Sprite newThumb;
74 
75  enum struct AnimState {
76  IntroMsg,
77  OldFadeOut,
78  SizeOscillating,
79  NewFadeIn,
80  EvolvedMsg,
81  CancelConfirm,
82  CancelMsg
83  };
84 
85  AnimState state;
86  AnimState cancelPriorState;
87  bl::pcl::ParticleManager<Spark>* sparks;
88  union {
89  float fadeColor;
91  };
92 
94 
95  void messageDone();
96  void onCancelConfirm(const std::string& choice);
97  virtual bool observe(const bl::input::Actor&, unsigned int ctrl, bl::input::DispatchType,
98  bool fromEvent) override;
99 };
100 
101 } // namespace state
102 } // namespace game
103 
104 #endif
Parent namespace for all functionality unique to the game.
Represents an instance of a peoplemon. Can be a wild peoplemon, trainer, or player peoplemon....
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47
Game state for when a Peoplemon evolves into another one.
Definition: Evolution.hpp:20
virtual void activate(bl::engine::Engine &engine) override
Subscribes to player input.
Definition: Evolution.cpp:106
static bl::engine::State::Ptr create(core::system::Systems &systems, core::pplmn::OwnedPeoplemon &ppl)
Definition: Evolution.cpp:68
const char * name() const override
Returns "Evolution".
Definition: Evolution.cpp:104
virtual ~Evolution()=default
Destroy the Evolution state.
virtual void update(bl::engine::Engine &engine, float dt, float) override
Updates the evolution process.
Definition: Evolution.cpp:138
virtual void deactivate(bl::engine::Engine &engine) override
Unsubscribes from player input.
Definition: Evolution.cpp:132
Parent to all game states. Provides some commonly required data like core game systems.
Definition: State.hpp:29
core::system::Systems & systems
Definition: State.hpp:66