Peoplemon  0.1.0
Peoplemon 3 game source documentation
MainMenu.hpp
Go to the documentation of this file.
1 #ifndef GAME_STATES_MAINMENU_HPP
2 #define GAME_STATES_MAINMENU_HPP
3 
4 #include <BLIB/Graphics.hpp>
5 #include <BLIB/Interfaces/Menu.hpp>
6 #include <BLIB/Resources.hpp>
8 #include <Game/States/State.hpp>
9 
10 namespace game
11 {
12 namespace state
13 {
20 class MainMenu
21 : public State
22 , public bl::input::Listener {
23 public:
28  static bl::engine::State::Ptr create(core::system::Systems& systems);
29 
31  virtual ~MainMenu() = default;
32 
37  virtual const char* name() const override;
38 
43  virtual void activate(bl::engine::Engine& engine) override;
44 
49  virtual void deactivate(bl::engine::Engine& engine) override;
50 
55  virtual void update(bl::engine::Engine&, float dt, float) override;
56 
57 private:
58  bl::rc::res::TextureRef backgroundTxtr;
59  bl::gfx::Sprite background;
60 
61  bl::menu::Menu menu;
62  core::input::MenuDriver inputDriver;
63  bl::menu::TextItem::Ptr newGame;
64  bl::menu::TextItem::Ptr loadGame;
65  bl::menu::TextItem::Ptr settings;
66  bl::menu::TextItem::Ptr quit;
67 
68  float hintTimer;
69  bl::gfx::Rectangle hintBox;
70  bl::gfx::Text hint;
71 
73 
74  virtual bool observe(const bl::input::Actor&, unsigned int activatedControl,
75  bl::input::DispatchType, bool eventTriggered) override;
76 };
77 
78 } // namespace state
79 } // namespace game
80 
81 #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.
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47
Provides the main menu as an engine state.
Definition: MainMenu.hpp:22
virtual void deactivate(bl::engine::Engine &engine) override
Unsubscribes the menu to the engine event bus.
Definition: MainMenu.cpp:133
virtual void update(bl::engine::Engine &, float dt, float) override
Does nothing.
Definition: MainMenu.cpp:138
virtual ~MainMenu()=default
Cleans up all resources.
virtual const char * name() const override
Returns "MainMenu";.
Definition: MainMenu.cpp:26
static bl::engine::State::Ptr create(core::system::Systems &systems)
Creates a new MainMenu state.
Definition: MainMenu.cpp:18
virtual void activate(bl::engine::Engine &engine) override
Subscribes the menu to the engine event bus.
Definition: MainMenu.cpp:28
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