r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
GameSolo.hpp
Go to the documentation of this file.
1///
2/// @file GameSolo.hpp
3/// @brief This file contains the solo Game scene
4/// @namespace gme
5///
6
7#pragma once
8
9#include <memory>
10#include <unordered_map>
11#include <unordered_set>
12
14#include "Interfaces/IAudio.hpp"
16
17namespace gme
18{
19 ///
20 /// @class GameSolo
21 /// @brief GameSolo scene
22 /// @namespace gme
23 ///
24 class GameSolo final : public eng::AScene
25 {
26 public:
27 GameSolo(eng::id assignedId, const std::shared_ptr<eng::IRenderer> &renderer,
28 const std::shared_ptr<eng::IAudio> &audio, int skinIndex, bool &showDebug);
29 ~GameSolo() override = default;
30
31 GameSolo(const GameSolo &other) = delete;
32 GameSolo &operator=(const GameSolo &other) = delete;
33 GameSolo(GameSolo &&other) = delete;
34 GameSolo &operator=(GameSolo &&other) = delete;
35
36 void update(float dt, const eng::WindowSize &size) override;
37 void event(const eng::Event &event) override;
38
39 bool &playMusic() { return m_playmusic; }
40 void updatePlayerSkin();
41
42 private:
43 void handlePlayerInputs(ecs::Registry &registry, float dt);
45 static ecs::Entity createPlayer(ecs::Registry &registry);
46
47 const std::shared_ptr<eng::IRenderer> &m_renderer;
48 const std::shared_ptr<eng::IAudio> &m_audio;
49 std::unordered_map<eng::Key, bool> m_keysPressed;
54 bool m_playmusic = false;
55 std::unique_ptr<StageManager> m_stageManager;
56
57 // Cache to avoid recreating textures/fonts
58 std::unordered_set<std::string> m_loadedTextures;
59 std::unordered_set<std::string> m_loadedFonts;
60 }; // class GameSolo
61} // namespace gme
This file contains the Audio interface.
Stage Manager for handling floor and ceiling spawning.
Class for managing entities and their components.
Definition Registry.hpp:25
Abstract class for scene.
Definition IScene.hpp:52
GameSolo scene.
Definition GameSolo.hpp:25
int m_lastAppliedSkinIndex
Definition GameSolo.hpp:52
void event(const eng::Event &event) override
Definition gameSolo.cpp:202
GameSolo & operator=(GameSolo &&other)=delete
bool & m_showDebug
Definition GameSolo.hpp:53
void update(float dt, const eng::WindowSize &size) override
Definition gameSolo.cpp:195
std::unique_ptr< StageManager > m_stageManager
Definition GameSolo.hpp:55
void handlePlayerInputs(ecs::Registry &registry, float dt)
Definition gameSolo.cpp:129
void updatePlayerSkin()
Definition gameSolo.cpp:249
std::unordered_set< std::string > m_loadedTextures
Definition GameSolo.hpp:58
static ecs::Entity createPlayer(ecs::Registry &registry)
Definition gameSolo.cpp:260
GameSolo & operator=(const GameSolo &other)=delete
void preloadCommonTextures()
Definition gameSolo.cpp:107
ecs::Entity m_playerEntity
Definition GameSolo.hpp:50
~GameSolo() override=default
GameSolo(eng::id assignedId, const std::shared_ptr< eng::IRenderer > &renderer, const std::shared_ptr< eng::IAudio > &audio, int skinIndex, bool &showDebug)
Definition gameSolo.cpp:8
GameSolo(const GameSolo &other)=delete
GameSolo(GameSolo &&other)=delete
bool & playMusic()
Definition GameSolo.hpp:39
const std::shared_ptr< eng::IRenderer > & m_renderer
Definition GameSolo.hpp:47
const std::shared_ptr< eng::IAudio > & m_audio
Definition GameSolo.hpp:48
std::unordered_set< std::string > m_loadedFonts
Definition GameSolo.hpp:59
std::unordered_map< eng::Key, bool > m_keysPressed
Definition GameSolo.hpp:49
This file contains the IScene class.
std::uint32_t Entity
Definition Entity.hpp:13
unsigned int id
Definition IScene.hpp:20