RType
IScene.hpp
Go to the documentation of this file.
1 /*
2 ** EPITECH PROJECT, 2023
3 ** R-type
4 ** File description:
5 ** R-type
6 */
7 
8 #pragma once
9 
10 #include "../Components/IComponent.hpp"
11 #include "../Components/Music/MusicComponent.hpp"
12 #include "../Components/Sound/SoundComponent.hpp"
13 #include <memory>
14 #include <sys/time.h>
15 #include <vector>
16 
17 class IScene
18 {
19  public:
20 
21  /**
22  * @brief IScene, constructor of IScene
23  *
24  * @param clientCore
25  */
26  explicit IScene(ClientCore *clientCore) :
27  _clientCore(clientCore)
28  {
29  }
30 
31  /**
32  * @brief ~IScene, destructor of IScene
33  */
34  virtual ~IScene() = default;
35 
36  /**
37  * @brief addComponent, add a component
38  *
39  * @param component
40  */
41  virtual void addComponent(std::shared_ptr<IComponent> component) = 0;
42 
43  /**
44  * @brief getComponents, get all the components
45  *
46  * @return std::vector<std::shared_ptr<IComponent>>
47  */
49 
50  /**
51  * @brief display, display the scene
52  *
53  * @param window
54  */
55  virtual void display(sf::RenderWindow &window) = 0;
56 
57  /**
58  * @brief update, update the scene
59  */
60  virtual void update() = 0;
61 
62  /**
63  * @brief handleEvent, handle the event
64  *
65  * @param event
66  * @param window
67  */
68  virtual void handleEvent(const sf::Event &event, sf::RenderWindow &window) = 0;
69 
70  /**
71  * @brief receiveData, receive the data
72  */
73  virtual void receiveData() = 0;
74 
75  /**
76  * @brief pauseScene, pause the scene
77  */
78  virtual void pauseScene() = 0;
79 
80  /**
81  * @brief resumeScene, resume the scene
82  */
83  virtual void resumeScene() = 0;
84 
85  /**
86  * @brief stopScene, stop the scene
87  */
88  virtual void stopScene() = 0;
89 
90  bool continueScene = true;
91 
92  private:
93  std::vector<std::shared_ptr<IComponent>> _components;
94 
95  protected:
97  timeval _pingTime{};
98 };