2#include <SFML/Graphics/Texture.hpp>
3#include <SFML/Graphics/Font.hpp>
4#include <SFML/Graphics/View.hpp>
5#include <SFML/System/Time.hpp>
6#include <SFML/System/Vector2.hpp>
7#include <SFML/Graphics/Text.hpp>
10#include "rollback_manager.h"
11#include "star_background.h"
13#include "graphics/graphics.h"
14#include "graphics/sprite.h"
15#include "engine/system.h"
16#include "engine/transform.h"
21class PacketSenderInterface;
35 [[nodiscard]] Frame GetCurrentFrame()
const {
return currentFrame_; }
36 [[nodiscard]] Frame GetLastValidateFrame()
const {
return rollbackManager_.GetLastValidateFrame(); }
38 [[nodiscard]]
const RollbackManager& GetRollbackManager()
const {
return rollbackManager_; }
43 void Validate(Frame newValidateFrame);
52 std::array<core::Entity, maxPlayerNmb> playerEntityMap_{};
53 Frame currentFrame_ = 0;
64 enum State : std::uint32_t
70 void StartGame(
unsigned long long int startingTime);
71 void Begin()
override;
72 void Update(sf::Time dt)
override;
74 void SetWindowSize(sf::Vector2u windowsSize);
75 [[nodiscard]] sf::Vector2u GetWindowSize()
const {
return windowSize_; }
76 void Draw(sf::RenderTarget& target)
override;
88 void DrawImGui()
override;
89 void ConfirmValidateFrame(Frame newValidateFrame,
const std::array<PhysicsState, maxPlayerNmb>& physicsStates);
90 [[nodiscard]]
PlayerNumber GetPlayerNumber()
const {
return clientPlayer_; }
92 [[nodiscard]] std::uint32_t GetState()
const {
return state_; }
95 void UpdateCameraView();
98 sf::Vector2u windowSize_;
99 sf::View originalView_;
100 sf::View cameraView_;
104 float fixedTimer_ = 0.0f;
105 unsigned long long startingTime_ = 0;
106 std::uint32_t state_ = 0;
108 sf::Texture shipTexture_;
109 sf::Texture bulletTexture_;
112 sf::Text textRenderer_;
Degree is an utility class that describes degree angles (0 to 360). It can be easily converted to Rad...
Definition: angle.h:56
DrawImGuiInterface is an interface used by the Engine to be called when the game loop is drawing ImGu...
Definition: graphics.h:23
DrawInterface is an interface used by the Engine to be called when the game loop is drawing elements ...
Definition: graphics.h:12
Manages the entities in an array using bitwise operations to know if it has components.
Definition: entity.h:35
SpriteManager is a ComponentManager that manages sprites, order by greater entity index,...
Definition: sprite.h:20
SystemInterface is an interface to a game system that needs to begin, update and end by the Engine....
Definition: system.h:13
ClientGameManager is a class that inherits from GameManager by adding the visual part and specific im...
Definition: game_manager.h:62
void SpawnPlayer(PlayerNumber playerNumber, core::Vec2f position, core::Degree rotation) override
SpawnPlayer is method that is called when receiving a SpawnPlayerPacket from the server.
Definition: game_manager.cpp:310
GameManager is a class which manages the state of the game. It is shared between the client and the s...
Definition: game_manager.h:27
void Validate(Frame newValidateFrame)
Validate is a method called by the server to validate a frame.
Definition: game_manager.cpp:56
PacketSenderInterface is a interface for any Server or Client who wants to send and receive packets.
Definition: packet_type.h:363
RollbackManager is a class that manages all the rollback mechanisms of the game. It contains two copi...
Definition: rollback_manager.h:32
StarBackground is a drawable object that draws a starfield on a screen.
Definition: star_background.h:13
std::uint32_t Entity
Entity is the type used to define an game world entity. An Entity is just an index,...
Definition: entity.h:17
constexpr auto INVALID_PLAYER
INVALID_PLAYER is an integer constant that defines an invalid player number.
Definition: game_globals.h:26
std::uint8_t PlayerNumber
PlayerNumber is a type used to define the number of the player. Starting from 0 to maxPlayerNmb.
Definition: game_globals.h:22
std::uint8_t PlayerInput
PlayerInput is a type defining the input data from a player.
Definition: game_globals.h:103
Vec2f is a utility class that represents a mathematical 2d vector.
Definition: vec2.h:12