R-Type  2
Doom but in better
Loading...
Searching...
No Matches
Game.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <forward_list>
4#include <iostream>
5#include <fstream>
6#include <sstream>
7#include "GameMessage.hpp"
8
9class Registry;
10class EventDispatcher;
11class Queue;
12
20class Game {
21public:
27 Game();
28
34 ~Game();
35
45 void update(float _deltaTime);
46
55 std::forward_list<std::string> getGameEvents(void);
56
65 std::forward_list<std::string> getCurrentGameState(void);
66
74 void onServerEventReceived(std::string &event);
75
84 void onGameEventReceived(const GameMessage& event);
85
86private:
90 Registry *_game;
91
95 EventDispatcher *_dispatcher;
96
100 Queue *_queue;
101
105 std::forward_list<GameMessage> _eventsFromGame;
106
110 std::forward_list<GameMessage> _eventsFromServer;
111};
112
A utility class for dispatching and handling game events.
Represents the main game logic and state management.
Definition Game.hpp:20
std::forward_list< std::string > getGameEvents(void)
Retrieves game messages.
Definition Game.cpp:30
void onGameEventReceived(const GameMessage &event)
Handles an event received during gameplay.
Definition Game.cpp:42
void update(float _deltaTime)
Updates the game state for the current frame.
Definition Game.cpp:24
Game()
Constructs a new Game object.
Definition Game.cpp:7
std::forward_list< std::string > getCurrentGameState(void)
Gets the current game state (syncing)
Definition Game.cpp:47
~Game()
Destroys the Game object.
Definition Game.cpp:17
void onServerEventReceived(std::string &event)
Handles an event received from server.
Definition Game.cpp:58
A thread-safe queue for storing and managing GameMessage objects.
Definition Queue.hpp:17
Manages entities and their associated components, enabling the creation, deletion,...
Definition Registry.hpp:23
A structure representing a game message.