R-Type  2
Doom but in better
Loading...
Searching...
No Matches
Orchestrator.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2024
3** rtype (Workspace)
4** File description:
5** Orchestrator.hpp
6*/
7
16#pragma once
17#include <any>
18#include <vector>
19#include <memory>
20#include <random>
21#include <unordered_map>
22#include "Log.hpp"
23#include "Recoded.hpp"
24#include "SoundLib.hpp"
25#include "LogMacros.hpp"
26#include "Utilities.hpp"
27#include "CustomExceptions.hpp"
32#include "GUI/ECS/Systems.hpp"
34
35namespace GUI
36{
37 namespace ECS
38 {
39 namespace Demo
40 {
47 class Orchestrator : public EntityNode {
48 public:
54 Orchestrator(const std::uint32_t entityId = 0);
55
59 ~Orchestrator() = default;
60
66 void initialiseClass(std::unordered_map<std::type_index, std::vector<std::any>> &ecsEntities);
67
71 void start();
72
76 void stop();
77
81 void reset();
82
86 void tick();
87
91 void render();
92
98 const bool isGameOver() const;
99
105 const bool isGameWon() const;
106
107
117 const std::string getInfo(const unsigned int indent = 0) const;
118
119 private:
120
124 void _shootSound();
128 void _damageSound();
132 void _deadSound();
136 void _buttonSound();
140 void _gameOverSound();
144 void _winSound();
145
149 void _spawn();
150
154 void _kill();
155
161 void _spawnEnemy(const std::pair<float, float> pos);
162
171 const int _randInt(int min = 0, int max = 5);
172
176 void _setTheScene();
177
181 void _setTextComponents();
182
183 bool _playing = false;
184 bool _gameWon = false;
185 bool _gameOver = false;
186 int _stepUp = -10;
187 int _stepDown = 10;
188 int _stepLeft = -10;
189 int _stepRight = 10;
190 float _screenPosXOffset = 75;
191 float _screenPosYOffset = 45;
192 long int _activeEnemies = 0;
193 std::optional<std::shared_ptr<GUI::ECS::Components::TextComponent>> _titleHealth;
194 std::optional<std::shared_ptr<GUI::ECS::Components::TextComponent>> _remainingEnemies;
195 std::optional<std::shared_ptr<GUI::ECS::Components::ImageComponent>> _backgroundItem;
196 std::shared_ptr<GUI::ECS::Components::SpriteComponent> _spriteBullet;
197 std::shared_ptr<GUI::ECS::Components::SpriteComponent> _spriteBulletEnemy;
198 std::shared_ptr<GUI::ECS::Components::SpriteComponent> _spritePlayer;
199 std::shared_ptr<GUI::ECS::Components::SpriteComponent> _spriteEnemy;
200 std::vector<GUI::ECS::Demo::Bullet> _bullets;
201 std::shared_ptr<GUI::ECS::Systems::Window> _window;
202 std::shared_ptr<GUI::ECS::Systems::EventManager> _event;
203 std::shared_ptr<GUI::ECS::Demo::PlayerBrain> _playerBrain;
204 std::vector<std::shared_ptr<GUI::ECS::Demo::EnemyBrain>> _enemyBrain;
205 std::unordered_map<std::type_index, std::vector<std::any>> _ecsEntities;
206 };
207
216 std::ostream &operator<<(std::ostream &os, const Orchestrator &item);
217 }
218 }
219}
File in charge of containing the custom errors that are going to be used for custom description error...
File in charge of containing the logic for the bullet class.
Declaration of the EnemyBrain class and its related functionality.
Declaration of the PlayerBrain class and related functionality.
This is the file that links the EntityNode children.
Macro definitions for logging messages with varying levels of detail and formatting.
This is the file in charge of containing the Log class (the one in charge of outputing info only when...
This is an agglomerator in which all the files from Recoded folder will be included.
Declaration of the SoundLib class for managing sounds in the ECS architecture.
The Orchestrator class manages the overall game state, including entity creation, updates,...
void render()
Renders the game entities to the window.
void tick()
Updates the game state for the current frame.
void stop()
Stops the game logic and resets the playing state.
~Orchestrator()=default
Destructor.
const bool isGameOver() const
Checks if the game is over.
const bool isGameWon() const
Checks if the game has been won.
void start()
Starts the game logic and sets the game to a playing state.
void initialiseClass(std::unordered_map< std::type_index, std::vector< std::any > > &ecsEntities)
Initializes the ECS entities managed by the orchestrator.
const std::string getInfo(const unsigned int indent=0) const
This is a function meant for debugging purposes It will dump the current state of the variables upon ...
Orchestrator(const std::uint32_t entityId=0)
Default constructor.
void reset()
Resets the game state, clearing all entities and resetting conditions.
This is the file that links the Components children.
This is the file that links the utility children ressources.
std::ostream & operator<<(std::ostream &os, const Bullet &item)
Outputs the sprite's info to a stream.
Definition Bullet.cpp:259