r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
ConfigFlappy.hpp
Go to the documentation of this file.
1///
2/// @file ConfigFlappy.hpp
3/// @brief This file contains the FlappyBird configuration scene
4/// @namespace gme
5///
6
7#pragma once
8
9#include <unordered_map>
10
12
13namespace gme
14{
15 ///
16 /// @class ConfigFlappy
17 /// @brief ConfigFlappy scene
18 /// @namespace gme
19 ///
20 class ConfigFlappy final : public eng::AScene
21 {
22 public:
23 ConfigFlappy(eng::id assignedId, const std::shared_ptr<eng::IRenderer> &renderer);
24 ~ConfigFlappy() override = default;
25
26 ConfigFlappy(const ConfigFlappy &other) = delete;
27 ConfigFlappy &operator=(const ConfigFlappy &other) = delete;
28 ConfigFlappy(ConfigFlappy &&other) = delete;
29 ConfigFlappy &operator=(const ConfigFlappy &&other) = delete;
30
31 void update(float dt, const eng::WindowSize &size) override;
32 void event(const eng::Event &event) override;
33 bool &playMusic() { return m_playMusic; }
34
35 std::function<void(const std::string &option, const std::string &playerName, int skinIndex)> onOptionSelected;
36
37 private:
38 char keyToChar(eng::Key key) const;
39 std::string &getCurrentEditField();
40 void updateValueDisplay();
41
42 std::unordered_map<eng::Key, bool> m_keysPressed;
48 const std::vector<std::string> m_menuOptions = {"Player Name", "Skin", "Start Game", "Go back to menu"};
49
51 float m_animationTime = 0.0f;
52 float m_titlePulseTime = 0.0f;
53 bool m_playMusic = false;
54 std::string m_playerName = "Player";
55 int m_skinIndex = 0;
56 const std::shared_ptr<eng::IRenderer> &m_renderer;
57 }; // class ConfigFlappy
58} // namespace gme
59
Abstract class for scene.
Definition IScene.hpp:52
ConfigFlappy scene.
void event(const eng::Event &event) override
~ConfigFlappy() override=default
ConfigFlappy(ConfigFlappy &&other)=delete
const std::vector< std::string > m_menuOptions
char keyToChar(eng::Key key) const
ConfigFlappy(eng::id assignedId, const std::shared_ptr< eng::IRenderer > &renderer)
ConfigFlappy & operator=(const ConfigFlappy &&other)=delete
std::string & getCurrentEditField()
std::unordered_map< eng::Key, bool > m_keysPressed
ecs::Entity m_skinValueEntity
void update(float dt, const eng::WindowSize &size) override
ecs::Entity m_fpsEntity
ecs::Entity m_titleEntity
ConfigFlappy & operator=(const ConfigFlappy &other)=delete
ConfigFlappy(const ConfigFlappy &other)=delete
std::function< void(const std::string &option, const std::string &playerName, int skinIndex)> onOptionSelected
ecs::Entity m_playerNameValueEntity
const std::shared_ptr< eng::IRenderer > & m_renderer
std::string m_playerName
ecs::Entity m_skinSpriteEntity
This file contains the IScene class.
std::uint32_t Entity
Definition Entity.hpp:13
unsigned int id
Definition IScene.hpp:20