Root application class; owns shared resources and manages screen transitions.
More...
#include <App.hpp>
|
| bool | init () |
| | Initialize SDL, the GPU renderer, ImGui, and the network client.
|
| SDL_AppResult | event (SDL_Event *event) |
| | Forward an SDL event to the active screen.
|
| SDL_AppResult | iterate () |
| | Tick the active screen and check for pending screen transitions.
|
| void | quit () |
| | Shut down all subsystems and release resources.
|
| void | transitionTo (Screen next) |
| | Destroy the current screen and activate the requested one.
|
Root application class; owns shared resources and manages screen transitions.
Implements the SDL3 app-callback contract (init/event/iterate/quit). Exactly one IScreen is active at a time; App drives transitions among TitleScreen, MainMenu, host configuration, Lobby, and InGame screens.
◆ Screen
Named screens the application can display.
| Enumerator |
|---|
| TitleScreen | Top-level landing/title screen.
|
| Settings | Dedicated front-end settings screen.
|
| MainMenu | Join/server-browser main menu screen.
|
| HostConfig | Deprecated alias for opening the server browser host tab.
|
| Lobby | Pre-match lobby waiting room.
|
| Loading | Match-loading screen shown before synchronous game init.
|
| PostMatch | Dedicated scoreboard shown after a completed match.
|
| InGame | Active match session.
|
◆ applyAudioSettings()
| void App::applyAudioSettings |
( |
| ) |
|
|
private |
Push saved volume settings into the shared audio system.
◆ cleanup()
Destroy all subsystems without asserting on partial-init state.
◆ event()
| SDL_AppResult App::event |
( |
SDL_Event * | event | ) |
|
Forward an SDL event to the active screen.
- Returns
- SDL_APP_CONTINUE or SDL_APP_FAILURE.
◆ init()
Initialize SDL, the GPU renderer, ImGui, and the network client.
- Returns
- True on success; false if any subsystem fails to initialize.
◆ iterate()
| SDL_AppResult App::iterate |
( |
| ) |
|
Tick the active screen and check for pending screen transitions.
- Returns
- SDL_APP_CONTINUE or SDL_APP_FAILURE.
◆ pollJoinAttempt()
| void App::pollJoinAttempt |
( |
| ) |
|
|
private |
Apply a completed join worker result, if one is ready.
◆ quit()
Shut down all subsystems and release resources.
◆ screenContext()
Build a borrowed context for screen initialisation.
◆ showMainMenuPopupMessage()
| void App::showMainMenuPopupMessage |
( |
const std::string & | message | ) |
|
|
private |
Show a modal message on the active main menu screen, if it is active.
◆ shutdownHostedServerGracefully()
| bool App::shutdownHostedServerGracefully |
( |
| ) |
|
|
private |
Ask a locally hosted server to shut down before falling back to process termination.
◆ startJoinAttempt()
| void App::startJoinAttempt |
( |
const JoinRequest & | request | ) |
|
|
private |
Start the non-blocking join worker for a main-menu join request.
◆ transitionTo()
| void App::transitionTo |
( |
Screen | next | ) |
|
Destroy the current screen and activate the requested one.
- Parameters
-
| next | The screen to transition to. |
◆ updateBackgroundMusic()
| void App::updateBackgroundMusic |
( |
| ) |
|
|
private |
Start the correct looping background music for the active screen.
◆ waitForJoinAttempt()
| void App::waitForJoinAttempt |
( |
| ) |
|
|
private |
Wait for any active join worker before shutdown.
◆ client
Network client connected to the authoritative server when in a session.
◆ current
Which screen is currently active.
◆ currentServerIp
| std::string App::currentServerIp |
|
private |
Address used for the current server connection, if known.
◆ currentServerName
| std::string App::currentServerName |
|
private |
Display name for the connected server, if known.
◆ currentServerPort
| uint16_t App::currentServerPort = 0 |
|
private |
Port used for the current server connection, if known.
◆ developerConfig
Developer toggles loaded from config.toml.
◆ hostConfigState
Initial value:{
.port = 9999,
.useSpecificPort = false,
.useLegacyTcp = false,
.persistAfterClientExit = false,
.advertiseGlobal = true,
.advertiseLan = true,
.serverName = "Server",
.killsToWin = 25,
.maxPlayers = 8,
.powerupInitialSpawnDelaySeconds = 60.0f,
.powerupRespawnCooldownSeconds = 30.0f,
}
Persistent host screen draft state.
◆ hostedServer
Optional local server process launched by the host screen.
◆ imguiContextOwned
| bool App::imguiContextOwned = false |
|
private |
True once App has created the ImGui context.
◆ joinAttempt_
Background direct/global join attempt, if active.
◆ joinAttemptLabel_
| std::string App::joinAttemptLabel_ |
|
private |
Target label displayed by the main menu while joining.
◆ networkConfig
Host/port/transport loaded from config.toml.
◆ nextMainMenuTab_
◆ pendingPostMatchResult_
Result data used to open the post-match screen.
◆ previousAudioCounter_
| Uint64 App::previousAudioCounter_ = 0 |
|
private |
Performance counter used to tick menu audio.
◆ renderer
SDL_GPU PBR renderer, shared across screens.
◆ screen_
| std::unique_ptr<IScreen> App::screen_ |
|
private |
◆ settingsReturnScreen_
Front-end screen to restore after Settings closes.
◆ sfxSystem
Shared audio system for menus, music, and gameplay sounds.
◆ userSettings
User-specific input and gameplay settings.
◆ userSettingsPath
| std::string App::userSettingsPath |
|
private |
Path used to load and save user settings.
◆ window
| SDL_Window* App::window = nullptr |
|
private |
The documentation for this class was generated from the following files: