r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
flappyBirdClientSolo.cpp
Go to the documentation of this file.
6
7void gme::FlappyBirdClientSolo::update(float deltaTime, unsigned int width, unsigned int height) {}
8
9void gme::FlappyBirdClientSolo::setupScenes(bool &showDebug, eng::id menuSceneId)
10{
11 auto configFlappyId = m_engine->getSceneManager()->generateNextId();
12 auto configFlappy = std::make_unique<ConfigFlappy>(configFlappyId, m_engine->getRenderer());
13 configFlappy->addSystem(std::make_unique<ecs::AudioSystem>(m_engine->getAudio(), m_appConfig->audioVolume,
14 configFlappy->getRegistry(), configFlappy->playMusic()));
15 configFlappy->addSystem(std::make_unique<ecs::DebugSystem>(m_engine->getRenderer(), showDebug));
16 configFlappy->addSystem(std::make_unique<ecs::SpriteSystem>(m_engine->getRenderer()));
17 configFlappy->addSystem(std::make_unique<ecs::TextSystem>(m_engine->getRenderer()));
18 configFlappy->addSystem(std::make_unique<ecs::StarfieldSystem>(m_engine->getRenderer(), configFlappy->getRegistry()));
19
20 auto gameSoloId = m_engine->getSceneManager()->generateNextId();
21 auto gameSolo = std::make_unique<Game>(gameSoloId, m_engine->getRenderer(), m_engine->getAudio(), showDebug);
22 gameSolo->addSystem(std::make_unique<ecs::AudioSystem>(m_engine->getAudio(), m_appConfig->audioVolume,
23 gameSolo->getRegistry(), gameSolo->playMusic()));
24 gameSolo->addSystem(std::make_unique<ecs::StarfieldSystem>(m_engine->getRenderer(), gameSolo->getRegistry()));
25 gameSolo->addSystem(std::make_unique<ecs::SpriteSystem>(m_engine->getRenderer()));
26 gameSolo->addSystem(std::make_unique<ecs::TextSystem>(m_engine->getRenderer()));
27 gameSolo->addSystem(std::make_unique<FlappyDebugSystem>(m_engine->getRenderer(), showDebug));
28
29 m_mainSceneId = configFlappyId;
30
31 configFlappy->onOptionSelected = [this, gameSoloId, menuSceneId](const std::string &option, const std::string &playerName, int skinIndex)
32 {
33 if (option == "Player Name")
34 {
35 m_engine->getSceneManager()->switchToScene(menuSceneId);
36 }
37 else if (option == "Skin")
38 {
39 auto &sceneManager = m_engine->getSceneManager();
40 auto newGame = std::make_unique<Game>(gameSoloId, m_engine->getRenderer(), m_engine->getAudio(), *m_showDebug, skinIndex, playerName);
41 newGame->addSystem(std::make_unique<ecs::AudioSystem>(m_engine->getAudio(), m_appConfig->audioVolume,
42 newGame->getRegistry(), newGame->playMusic()));
43 newGame->addSystem(std::make_unique<ecs::StarfieldSystem>(m_engine->getRenderer(), newGame->getRegistry()));
44 newGame->addSystem(std::make_unique<ecs::SpriteSystem>(m_engine->getRenderer()));
45 newGame->addSystem(std::make_unique<ecs::TextSystem>(m_engine->getRenderer()));
46 newGame->addSystem(std::make_unique<FlappyDebugSystem>(m_engine->getRenderer(), *m_showDebug));
47 sceneManager->addScene(std::move(newGame));
48 sceneManager->switchToScene(gameSoloId);
49 }
50 else if (option == "Start Game")
51 {
52 }
53 else if (option == "Go back to menu")
54 {
55 }
56 };
57
58 m_engine->getSceneManager()->addScene(std::move(configFlappy));
59 m_engine->getSceneManager()->addScene(std::move(gameSolo));
60}
This file contains the FlappyBird configuration scene.
This file contains the FlappyBirdClientSolo class declaration.
This file contains the FlappyBird debug system definition.
This file contains the solo Game scene.
void setupScenes(bool &showDebug, eng::id menuSceneId)
void update(float deltaTime, unsigned int width, unsigned int height) override
This file contains the system definitions.
unsigned int id
Definition IScene.hpp:20