R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
GameStateManager.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Created by hugo on 06/12/2025
4** File description:
5** GameStateManager.hpp
6*/
7
8#pragma once
9
10#include <memory>
11#include <vector>
14
15namespace server {
16
17 class EventBus;
18
24 public:
25 GameStateManager() = default;
26 ~GameStateManager() override = default;
27
28 // IGameStateManager interface
29 void changeState(int stateID) override;
30 int getCurrentState() const override;
31
37 void registerState(int stateID, std::shared_ptr<GameState> state);
38
43 void update(float dt);
44
49 void setEventBus(std::shared_ptr<EventBus> eventBus);
50
51 private:
52 std::vector<std::shared_ptr<GameState>> _states;
54 std::shared_ptr<EventBus> _eventBus;
55 };
56
57} // namespace server
Type-safe event publication/subscription system.
Definition EventBus.hpp:44
Handles switching between game states.
int getCurrentState() const override
std::vector< std::shared_ptr< GameState > > _states
void registerState(int stateID, std::shared_ptr< GameState > state)
Register a game state.
std::shared_ptr< EventBus > _eventBus
void changeState(int stateID) override
void setEventBus(std::shared_ptr< EventBus > eventBus)
Set EventBus for publishing state change events.
void update(float dt)
Update current state.
~GameStateManager() override=default
Interface for managing game states.