12 #define NOGDI // All GDI defines and routines
13 #define NOUSER// All USER defines and routines
19 #include "UdpCommunication.hpp"
22 #include "System/NetworkSystem/NetworkSystem.hpp"
23 #include "System/DrawTextSystem/DrawTextSystem.hpp"
24 #include "System/DrawSpriteSystem/DrawSpriteSystem.hpp"
25 #include "System/EndGameSystem/EndGameSystem.hpp"
26 #include "System/RectSystem/RectSystem.hpp"
27 #include "System/ControlSystem/ControlSystem.hpp"
28 #include "System/NewEntitySystem/NewEntitySystem.hpp"
29 #include "System/ParallaxSystem/ParallaxSystem.hpp"
30 #include "System/PositionSystem/PositionSystem.hpp"
31 #include "System/MoveSystem/MoveSystem.hpp"
32 #include "System/KillSystem/KillSystem.hpp"
33 #include "System/GetInfoInLobbySystem/GetInfoInLobbySystem.hpp"
34 #include "System/KillEntityTypeSystem/KillEntityTypeSystem.hpp"
35 #include "System/GetInfoInLobbySystem/GetInfoInLobbySystem.hpp"
36 #include "System/GetLobbiesSystem/GetLobbiesSystem.hpp"
37 #include "System/SetNbPlayerInLobbySystem/SetNbPlayerInLobbySystem.hpp"
38 #include "System/NewClientResponseSystem/NewClientResponseSystem.hpp"
39 #include "System/MouseSystem/MouseSystem.hpp"
40 #include "System/UpdateEntityInfosSystem/UpdateEntityInfosSystem.hpp"
41 #include "System/NewLevelSystem/NewLevelSystem.hpp"
54 Client(std::map<std::string, std::string> &configurationFiles);
112 void loadTexts(std::string
const &filepath);
122 void createText(nlohmann::json
const &oneData, std::array<float, 2> pos,
int scene, std::string
const &ref);
139 void handleReceive();
152 void pushNewPacketsToQueue(asio::error_code
const &e, std::size_t nbBytes);
159 void sendNewDirection(std::vector<byte> &
byte);
166 void sendNewShoot(std::vector<byte> &
byte);
172 void connectToServer();
180 void backToOptions();
184 void downgradeMusic();
209 void noCallback() {};
227 void backToConnection();
239 void backToMainMenu();
257 void joinRoomThree();
268 asio::io_context _context;
270 std::unique_ptr<rtype::GraphicalLib> _graphicLib;
271 std::unique_ptr<UdpCommunication> _com;
275 std::vector<byte> _bufferToGet;
277 std::map<std::string, std::string> _configurationFiles;
279 bool _isConnected =
false;
void setUpSystems()
Set the Up Systems object.
Definition: Client.cpp:144
Class that handle Element of type Component like a vector which can be holed.
Definition: SparseArray.hpp:22
GetInfoInLobbySystem class that handles the dynamic info of the entities.
Definition: GetInfoInLobbySystem.hpp:28
DrawSpriteSystem class that handles the drawing of all the sprite entities.
Definition: DrawSpriteSystem.hpp:35
void createImage(nlohmann::json const &oneData, std::array< float, 2 > pos, int scene, const std::string &ref, Sparse_array< component::casset_t > &assets)
Create a Image object.
Definition: Client.cpp:239
System to handle when a new level is reached.
Definition: NewLevelSystem.hpp:26
System that draws a part of all entities.
Definition: RectSystem.hpp:27
NetworkSystem class that handles the communication using queues with the server to send it tasks as p...
Definition: NetworkSystem.hpp:29
void setUpEcs()
Set the Up Ecs object.
Definition: Client.cpp:115
MouseSystem class that handles the mouse.
Definition: MouseSystem.hpp:39
~Client()
Destroy the Client object.
Definition: Client.cpp:44
void machineRun()
A method to launch the core features of a client.
Definition: Client.cpp:59
Client(std::map< std::string, std::string > &configurationFiles)
Construct a new Client object.
Definition: Client.cpp:32
Class that handle ECS.
Definition: Registry.hpp:22
void createText(nlohmann::json const &oneData, std::array< float, 2 > pos, int scene, std::string const &ref)
Create a Text object.
Definition: Client.cpp:216
ParallaxSystem class that handles the parallax effect.
Definition: ParallaxSystem.hpp:27
The Move System class, it handles all packets related to movement by the clients.
Definition: MoveSystem.hpp:30
The End Game System class, it handles the end of the game of lobbies.
Definition: EndGameSystem.hpp:27
KillEntityTypeSystem class that handles the killing of entities type.
Definition: KillEntityTypeSystem.hpp:24
void disconnect()
A method to call juste before a client is deconected.
Definition: Client.cpp:79
Update entity info system class that handles the update of an entity.
Definition: UpdateEntityInfosSystem.hpp:28
void loadImages(std::string const &filepath, Sparse_array< component::casset_t > &assets)
A method to load the assets of the images.
Definition: Client.cpp:266
void loadTexts(std::string const &filepath)
A method to load the assets of the text.
Definition: Client.cpp:198
GetLobbiesSystem class that handles the request to send to Server to get lobbies.
Definition: GetLobbiesSystem.hpp:26
void loadButtons(std::string const &filepath, Sparse_array< component::casset_t > &assets)
A method to load the assets of the buttons.
Definition: Client.cpp:284
NewEntitySystem class that handles the creation of an entity.
Definition: NewEntitySystem.hpp:40
ControlSystem class that handles the control of all the entities.
Definition: ControlSystem.hpp:27
KillSystem class that handles the killing of entities.
Definition: KillSystem.hpp:30
DrawTextSystem class that handles the drawing of all the sprite entities.
Definition: DrawTextSystem.hpp:29
System that set number of player in Lobby.
Definition: SetNbPlayerInLobbySystem.hpp:24
void tryToConnect()
A method to try to connect to a target server.
Definition: Client.cpp:52
The Client class, it defines a client and its interactions with the server.
Definition: Client.hpp:47
NewClientResponseSystem class that handles the creation of a client.
Definition: NewClientResponseSystem.hpp:25
PositionSystem class that handles the position of the entities.
Definition: PositionSystem.hpp:26
void setUpComponents()
Set the Up Components object.
Definition: Client.cpp:167