1#ifndef _BOMBERMAN_GAME_H_
2#define _BOMBERMAN_GAME_H_
8#include "Managers/AssetManager.h"
9#include "Managers/SceneManager.h"
14 namespace net {
class NetClient; }
18 bool predictionEnabled =
true;
19 bool remoteSmoothingEnabled =
true;
36 Game(
const std::string& windowName,
int windowWidth,
int windowHeight,
105 SDL_Window* window =
nullptr;
106 SDL_Renderer* renderer =
nullptr;
108 std::unique_ptr<SceneManager> sceneManager =
nullptr;
109 std::unique_ptr<AssetManager> assetManager =
nullptr;
113 int windowHeight = 0;
115 bool isRunning =
false;
116 bool isInitialized =
false;
117 std::chrono::steady_clock::time_point lastTickTime{};
118 std::chrono::duration<double> accumulator{};
123 bool hasKeyboardFocus_ =
true;
124 bool renderVsyncEnabled_ =
true;
126 bool suppressBombInputUntilRelease_ =
false;
130 void handleWindowFocusChanged(
bool hasFocus);
Shared client/server wire contract for the multiplayer protocol.
Asset Manager.
Definition AssetManager.h:73
bool tryGetLatestSnapshot(net::MsgSnapshot &out) const
Fills out with the most recent server snapshot and returns true.
Definition Game.cpp:392
void suppressBombInputUntilReleased()
Suppresses bomb input until the space key is released once.
Definition Game.cpp:313
int getWindowWidth() const
Returns current window width in pixels.
Definition Game.cpp:362
SceneManager * getSceneManager() const
Returns the scene manager.
Definition Game.cpp:377
bool isRemoteSmoothingEnabled() const
Returns true when remote smoothing/interpolation is enabled.
Definition Game.cpp:414
void disconnectNetClientIfActive(bool blockUntilComplete=true)
Disconnects the multiplayer client if one is active.
Definition Game.cpp:335
void run()
Runs the main loop until stop() is requested.
Definition Game.cpp:142
void stop()
Requests the main loop to stop.
Definition Game.cpp:330
net::NetClient * getNetClient() const
Returns the network client, or nullptr if not in multiplayer mode.
Definition Game.cpp:387
uint16_t getServerPort() const
Returns the server port (from CLI or default).
Definition Game.cpp:399
AssetManager * getAssetManager() const
Returns the asset manager.
Definition Game.cpp:382
SDL_Renderer * getRenderer() const
Returns the SDL renderer.
Definition Game.cpp:372
~Game()
Releases runtime resources and shuts down SDL subsystems.
Definition Game.cpp:121
bool isPredictionEnabled() const
Returns true when local multiplayer prediction is enabled.
Definition Game.cpp:409
int getWindowHeight() const
Returns current window height in pixels.
Definition Game.cpp:367
const MultiplayerClientConfig & getMultiplayerClientConfig() const
Returns the multiplayer client configuration used for this run.
Definition Game.cpp:404
Scene Manager.
Definition SceneManager.h:18
ENet client connection and protocol endpoint.
Definition NetClient.h:75
constexpr uint16_t kDefaultServerPort
Default server port used by both client and server.
Definition NetCommon.h:43
Snapshot payload broadcast by the server to all clients.
Definition NetCommon.h:673