Peoplemon  0.1.0
Peoplemon 3 game source documentation
FlyMap.hpp
Go to the documentation of this file.
1 #ifndef GAME_STATES_FLYMAP_HPP
2 #define GAME_STATES_FLYMAP_HPP
3 
4 #include <BLIB/Graphics.hpp>
5 #include <BLIB/Interfaces/Menu.hpp>
6 #include <BLIB/Resources.hpp>
7 #include <Core/Maps/Town.hpp>
8 #include <Game/States/State.hpp>
9 #include <SFML/Graphics.hpp>
10 
11 namespace game
12 {
13 namespace state
14 {
20 class FlyMap
21 : public State
22 , public bl::input::Listener {
23 public:
31  static bl::engine::State::Ptr create(core::system::Systems& systems, bool& unpause);
32 
36  virtual ~FlyMap() = default;
37 
41  virtual const char* name() const override;
42 
48  virtual void activate(bl::engine::Engine& engine) override;
49 
55  virtual void deactivate(bl::engine::Engine& engine) override;
56 
63  virtual void update(bl::engine::Engine& engine, float dt, float) override;
64 
65 private:
66  bool& unpause;
67 
68  bl::rc::res::TextureRef mapTxtr;
69  bl::rc::res::TextureRef townTxtr;
70  bl::rc::res::TextureRef cursorTxtr;
71  bl::rc::res::TextureRef playerTxtr;
72  bl::gfx::Sprite map;
73  bl::gfx::BatchedSprites towns;
74  bl::gfx::Sprite player;
75  bl::gfx::Sprite cursor;
76 
77  bl::rc::res::TextureRef panelTxtr;
78  bl::gfx::Sprite panel;
79  bl::gfx::Text townName;
80  bl::gfx::Text townDesc;
81 
82  bl::menu::Menu townMenu;
83  core::input::MenuDriver inputDriver;
84  unsigned int selected;
85 
86  FlyMap(core::system::Systems& systems, bool& unpause);
87  void clearHover();
88  void hoverTown(unsigned int i);
89  void selectTown(unsigned int i);
90  void onFlyChoice(const std::string& choice, const core::map::Town& town);
91  void messageDone();
92  void close();
93 
94  virtual bool observe(const bl::input::Actor&, unsigned int activatedControl,
95  bl::input::DispatchType, bool eventTriggered) override;
96 };
97 
98 } // namespace state
99 } // namespace game
100 
101 #endif
bl::menu::TriggerDriver< Control::MoveUp, Control::MoveRight, Control::MoveDown, Control::MoveLeft, Control::Interact > MenuDriver
Helper typedef for Peoplemon specific menu driving.
Definition: MenuDriver.hpp:18
Parent namespace for all functionality unique to the game.
Represents a town, route, or region within a map. Maps may have many towns. Individual tiles are asso...
Definition: Town.hpp:22
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47
Engine state for the fly map.
Definition: FlyMap.hpp:22
virtual ~FlyMap()=default
Destroy the FlyMap state.
virtual void update(bl::engine::Engine &engine, float dt, float) override
Updates the state and menus and whatnot.
Definition: FlyMap.cpp:136
virtual void deactivate(bl::engine::Engine &engine) override
Deactivates the state.
Definition: FlyMap.cpp:131
virtual const char * name() const override
Returns "FlyMap".
Definition: FlyMap.cpp:112
virtual void activate(bl::engine::Engine &engine) override
Activates the state.
Definition: FlyMap.cpp:114
static bl::engine::State::Ptr create(core::system::Systems &systems, bool &unpause)
Creates the fly map state.
Definition: FlyMap.cpp:17
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