Peoplemon  0.1.0
Peoplemon 3 game source documentation
MainGame.hpp
Go to the documentation of this file.
1 #ifndef GAME_STATES_MAINGAME_HPP
2 #define GAME_STATES_MAINGAME_HPP
3 
4 #include <Core/Events/Battle.hpp>
5 #include <Core/Events/Maps.hpp>
8 #include <Core/Events/Store.hpp>
9 #include <Core/Maps/Map.hpp>
10 #include <Game/States/State.hpp>
11 
12 namespace game
13 {
14 namespace state
15 {
22 class MainGame
23 : public State
24 , public bl::event::Listener<sf::Event, core::event::StateChange, core::event::SwitchMapTriggered,
25  core::event::BattleStarted, core::event::StoreOpened,
26  core::event::StorageSystemOpened> {
27 public:
35  static bl::engine::State::Ptr create(core::system::Systems& systems);
36 
41  virtual ~MainGame();
42 
47  virtual const char* name() const override;
48 
54  virtual void activate(bl::engine::Engine& engine) override;
55 
61  virtual void deactivate(bl::engine::Engine& engine) override;
62 
69  virtual void update(bl::engine::Engine& engine, float dt, float) override;
70 
71 private:
72  enum GameState { SwitchMapFadeout, MapFadein, Running };
73 
74  GameState state;
75  bl::rc::rgi::FadeEffectTask* fadeout;
76 
77  std::string replacementMap;
78  int spawnId;
79 
81 
82  virtual void observe(const sf::Event& event) override;
83  virtual void observe(const core::event::StateChange& event) override;
84  virtual void observe(const core::event::SwitchMapTriggered& event) override;
85  virtual void observe(const core::event::BattleStarted& event) override;
86  virtual void observe(const core::event::StoreOpened& event) override;
87  virtual void observe(const core::event::StorageSystemOpened& event) override;
88 };
89 
90 } // namespace state
91 } // namespace game
92 
93 #endif
Parent namespace for all functionality unique to the game.
Fired when a battle should start. This does not actually start a battle, but communicates to the curr...
Definition: Battle.hpp:17
Fired when the map should be switched to something else.
Definition: Maps.hpp:79
Fired when the game should switch states. This event type is primarily for decoupling input code in C...
Definition: StateChange.hpp:15
Fired when the storage system should be opened.
Event that is fired by the Core module to signal to the game to open a store.
Definition: Store.hpp:17
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47
The big honcho. This is the primary state that runs a majority of the time.
Definition: MainGame.hpp:26
virtual const char * name() const override
Returns "MainGame".
Definition: MainGame.cpp:47
virtual void deactivate(bl::engine::Engine &engine) override
Deactivates the game state.
Definition: MainGame.cpp:62
virtual void activate(bl::engine::Engine &engine) override
Activates the state.
Definition: MainGame.cpp:49
virtual ~MainGame()
Destroy the Main Game state.
Definition: MainGame.cpp:45
virtual void update(bl::engine::Engine &engine, float dt, float) override
Updates all of the primary systems.
Definition: MainGame.cpp:67
static bl::engine::State::Ptr create(core::system::Systems &systems)
Creates the main game state. The game state must be initialized before invoking the main game state.
Definition: MainGame.cpp:35
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