r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
RTypeClientMulti.hpp
Go to the documentation of this file.
1///
2/// @file RTypeClientMulti.hpp
3/// @brief R-Type multiplayer game client plugin implementation
4/// @details This file contains the main game client class for R-Type multiplayer mode.
5/// It manages game scenes, network integration, and multiplayer gameplay logic.
6/// The plugin implements lobby system, player synchronization, and multiplayer-specific
7/// game mechanics for the R-Type game.
8/// @namespace gme
9/// @author R-Type Team
10/// @date 2025
11///
12
13#pragma once
14
16
17namespace gme
18{
19
20 ///
21 /// @class RTypeClientMulti
22 /// @brief Main multiplayer game client plugin for R-Type
23 /// @details This class serves as the entry point for the R-Type multiplayer client plugin.
24 /// It manages:
25 /// - Game scene initialization and transitions
26 /// - Network client integration
27 /// - Lobby system UI and logic
28 /// - Multiplayer game state
29 /// - Player synchronization
30 ///
31 /// The plugin integrates with the engine's plugin system and provides a complete
32 /// multiplayer game experience including server browser, lobby system, and networked gameplay.
33 ///
34 /// @namespace gme
35 ///
36 class RTypeClientMulti final : public IGameClient
37 {
38
39 public:
40 ///
41 /// @brief Default constructor
42 ///
43 RTypeClientMulti() = default;
44
45 ///
46 /// @brief Destructor
47 ///
48 ~RTypeClientMulti() override = default;
49
50 ///
51 /// @brief Deleted copy constructor (non-copyable)
52 ///
54
55 ///
56 /// @brief Deleted copy assignment operator (non-copyable)
57 ///
59
60 ///
61 /// @brief Deleted move constructor (non-movable)
62 ///
64
65 ///
66 /// @brief Deleted move assignment operator (non-movable)
67 ///
69
70 ///
71 /// @brief Get plugin name
72 /// @return Plugin name identifier
73 ///
74 [[nodiscard]] const std::string getName() const override { return "RType_Client_Multi"; }
75
76 ///
77 /// @brief Get plugin type
78 /// @return Plugin type (GAME_CLIENT)
79 ///
80 [[nodiscard]] utl::PluginType getType() const override { return utl::PluginType::GAME_CLIENT; }
81
82 ///
83 /// @brief Initialize the multiplayer client plugin
84 /// @param engine Reference to the game engine
85 /// @param appConfig Application configuration
86 /// @param showDebug Debug mode flag
87 /// @param menuSceneId ID of the main menu scene to return to
88 /// @details Sets up all multiplayer-specific scenes including:
89 /// - Server connection scene
90 /// - Lobby browser
91 /// - Lobby creation
92 /// - Waiting room
93 /// - Multiplayer game scene
94 /// - Game over scene
95 ///
96 void init(eng::Engine &engine, utl::cli::AppConfig &appConfig, bool &showDebug, const eng::id menuSceneId,
97 const eng::id winSceneId) override
98 {
99 m_engine = &engine;
100 m_appConfig = &appConfig;
101 m_showDebug = showDebug;
102 setupScenes(showDebug, menuSceneId);
103 }
104 ///
105 /// @brief Update the multiplayer client plugin (called each frame)
106 /// @param deltaTime Time elapsed since last frame (in seconds)
107 /// @param width Current window width
108 /// @param height Current window height
109 /// @details Performs frame-by-frame updates for multiplayer functionality
110 ///
111 void update(float deltaTime, unsigned int width, unsigned int height) override;
112
113 ///
114 /// @brief Get the main scene ID
115 /// @return ID of the main multiplayer scene
116 ///
117 [[nodiscard]] unsigned int getMainSceneId() const override { return m_mainSceneId; }
118
119 private:
120 ///
121 /// @brief Setup all multiplayer game scenes
122 /// @param showDebug Debug mode flag
123 /// @param menuSceneId ID of the main menu scene
124 /// @details Creates and registers all scenes required for multiplayer gameplay:
125 /// - Server connection and configuration
126 /// - Lobby system (browse, create, join)
127 /// - Waiting room
128 /// - Game scene
129 /// - Game over screen
130 ///
131 void setupScenes(bool &showDebug, eng::id menuSceneId);
132
133 eng::Engine *m_engine = nullptr; ///< Pointer to the game engine
134 utl::cli::AppConfig *m_appConfig = nullptr; ///< Pointer to application configuration
135 bool m_showDebug = false; ///< Debug mode flag
136 eng::id m_mainSceneId = 1; ///< ID of the main multiplayer scene
137
138 }; // class RTypeClientMulti
139
140} // namespace gme
This file contains the Game interface.
Class for the engine.
Definition Engine.hpp:34
Interface for the games.
Main multiplayer game client plugin for R-Type.
eng::id m_mainSceneId
ID of the main multiplayer scene.
const std::string getName() const override
Get plugin name.
bool m_showDebug
Debug mode flag.
RTypeClientMulti(RTypeClientMulti &&)=delete
Deleted move constructor (non-movable)
~RTypeClientMulti() override=default
Destructor.
RTypeClientMulti & operator=(RTypeClientMulti &&)=delete
Deleted move assignment operator (non-movable)
void init(eng::Engine &engine, utl::cli::AppConfig &appConfig, bool &showDebug, const eng::id menuSceneId, const eng::id winSceneId) override
Initialize the multiplayer client plugin.
RTypeClientMulti(const RTypeClientMulti &)=delete
Deleted copy constructor (non-copyable)
eng::Engine * m_engine
Pointer to the game engine.
void update(float deltaTime, unsigned int width, unsigned int height) override
Update the multiplayer client plugin (called each frame)
utl::PluginType getType() const override
Get plugin type.
RTypeClientMulti()=default
Default constructor.
RTypeClientMulti & operator=(const RTypeClientMulti &)=delete
Deleted copy assignment operator (non-copyable)
utl::cli::AppConfig * m_appConfig
Pointer to application configuration.
unsigned int getMainSceneId() const override
Get the main scene ID.
void setupScenes(bool &showDebug, eng::id menuSceneId)
Setup all multiplayer game scenes.
unsigned int id
Definition IScene.hpp:20
PluginType
Definition IPlugin.hpp:22