Peoplemon  0.1.0
Peoplemon 3 game source documentation
SettingsMenu.hpp
Go to the documentation of this file.
1 #ifndef GAME_STATES_SETTINGSMENU_HPP
2 #define GAME_STATES_SETTINGSMENU_HPP
3 
4 #include <BLIB/Interfaces/Menu.hpp>
6 #include <Game/States/State.hpp>
7 
8 namespace game
9 {
10 namespace state
11 {
13 : public State
14 , public bl::input::Listener {
15 public:
22  static bl::engine::State::Ptr create(core::system::Systems& systems);
23 
28  virtual ~SettingsMenu() = default;
29 
34  virtual const char* name() const override;
35 
41  virtual void activate(bl::engine::Engine& engine) override;
42 
48  virtual void deactivate(bl::engine::Engine& engine) override;
49 
56  virtual void update(bl::engine::Engine& engine, float dt, float) override;
57 
58 private:
59  enum struct MenuState {
60  TopMenu,
61 
62  VideoMenu,
63  VideoSelectMode,
64 
65  AudioMenu,
66  AudioSelectVolume,
67 
68  ControlsTopMenu,
69  ControlsKBMMenu,
70  ControlsPadMenu,
71  ControlsBindingControl
72  };
73 
74  MenuState state;
75  bl::rc::res::TextureRef bgndTexture;
76  bl::gfx::Sprite background;
77  bl::gfx::Text hint;
78 
79  core::input::MenuDriver inputDriver;
80  bl::menu::Menu topMenu;
81 
82  bl::menu::Menu videoMenu;
83  bl::menu::TextItem::Ptr windowModeTextItem;
84  bl::menu::SubmenuItem::Ptr windowModeDropdownItem;
85  bl::menu::TextItem::Ptr fullscreenItem;
86  bl::menu::TextItem::Ptr windowedItem;
87  bl::menu::ToggleTextItem::Ptr vsyncItem;
88 
89  bl::menu::Menu audioMenu;
90  bl::menu::ToggleTextItem::Ptr muteItem;
91  bl::menu::TextItem::Ptr volumeItem;
92  core::system::hud::QtyEntry volumeEntry;
93 
94  bl::menu::Menu controlsTopMenu;
95  bl::input::Configurator ctrlConfigurator;
96  unsigned int bindingCtrl;
97  bool bindingKbm;
98  bl::menu::TextItem* ctrlItem;
99 
100  bl::menu::Menu controlsKbmMenu;
101  bl::menu::Menu controlsPadMenu;
102 
104 
105  void enterState(MenuState state);
106  void setHint(const std::string& message);
107 
108  void onWindowModeOpen();
109  bool isFullscreen() const;
110  std::string windowModeString() const;
111  void onWindowModeChange(bool fullscreen);
112  void onVsyncUpdate();
113 
114  void startBindControl(bool kbm, unsigned int ctrl);
115  std::string ctrlString(unsigned int ctrl, bool kbm) const;
116 
117  void back();
118  void close();
119 
120  virtual bool observe(const bl::input::Actor&, unsigned int activatedControl,
121  bl::input::DispatchType, bool eventTriggered) override;
122 };
123 
124 } // namespace state
125 } // namespace game
126 
127 #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.
Helper class to render a number selector.
Definition: QtyEntry.hpp:18
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47
static bl::engine::State::Ptr create(core::system::Systems &systems)
Creates the settings menu state.
virtual ~SettingsMenu()=default
Destroy the Settings Menu state.
virtual const char * name() const override
Returns "SettingsMenu".
virtual void activate(bl::engine::Engine &engine) override
Activates the state.
virtual void update(bl::engine::Engine &engine, float dt, float) override
Updates the state and menus and whatnot.
virtual void deactivate(bl::engine::Engine &engine) override
Deactivates the state.
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