44 SDL_AppResult
event(SDL_Event*
event)
override;
45 SDL_AppResult
iterate()
override;
129 std::optional<JoinRequest>
Borrowed dependencies shared by client screens.
Runtime host-controlled discovery advertisement settings.
Client-side global server browser and NAT-assist helper.
Abstract interface for top-level application screens (lobby, in-game).
ImGui widget for the main menu server join form.
ServerBrowserTab
Tabs available on the server browser screen.
Definition MainMenuUI.hpp:16
@ LocalListing
Definition MainMenuUI.hpp:17
Network configuration loaded from config.toml at startup.
Work-in-progress SDL3 GPU renderer.
TCP stream client — sends input to the server and receives state updates.
Definition Client.hpp:69
Definition ConfirmModal.hpp:22
Starts, monitors, and shuts down a server process spawned by the client.
Definition HostedServer.hpp:37
Interface implemented by each full-screen mode (Lobby, Game).
Definition IScreen.hpp:16
IScreen implementation for the main menu/join screen; hosts the server join form.
Definition MainMenu.hpp:38
HostConfigState draftConfig() const
Current host-screen draft settings, clamped and sanitized.
Definition MainMenu.cpp:524
uint64_t lastBrowserRefreshMs
SDL tick timestamp of the last global refresh.
Definition MainMenu.hpp:156
std::thread browserThread
Worker used for global server-browser requests.
Definition MainMenu.hpp:154
std::unique_ptr< DiscoveryClient > localDiscoveryClient
Definition MainMenu.hpp:142
bool hasUnsavedServerChanges() const
True if the current draft differs from the last settings sent to or received from the server.
Definition MainMenu.cpp:509
bool consumeExitRequest()
True if the user requested closing the application, then clear that request.
Definition MainMenu.cpp:454
std::atomic< bool > browserRefreshing
True while browserThread is fetching.
Definition MainMenu.hpp:155
std::vector< net::discovery::ServerInfo > globalServers
Latest directory-server browser snapshot.
Definition MainMenu.hpp:150
bool updateServerSettings()
Send the current host-managed settings to the hosted server.
Definition MainMenu.cpp:551
SDL_AppResult iterate() override
Update the screen state and render the next frame.
Definition MainMenu.cpp:207
HostConfigState consumeDraftConfig() const
Current host-screen draft settings.
Definition MainMenu.cpp:489
std::optional< DiscoverySettings > lastSyncedDiscoverySettings
Last discovery settings acknowledged locally.
Definition MainMenu.hpp:126
SDL_Window * window
Application window; not owned.
Definition MainMenu.hpp:114
bool consumeHostRequest()
Take the pending host request set when the user clicks "Host", clearing it.
Definition MainMenu.cpp:407
HostedServer * hostedServer
Hosted server owned by App; not owned.
Definition MainMenu.hpp:116
bool pendingHostRequest
Set when the user clicks "Host", cleared on App transition.
Definition MainMenu.hpp:131
PendingConfirmAction
Definition MainMenu.hpp:89
@ ShutdownServer
Definition MainMenu.hpp:92
@ DiscardMatchChanges
Definition MainMenu.hpp:91
@ None
Definition MainMenu.hpp:90
void setPopupMessage(const std::string &message)
Display a modal message on the next main menu screen frame.
Definition MainMenu.cpp:483
void requestDiscardMatchChangesConfirm()
Ask the host whether to discard unsaved match setting changes before leaving this screen.
Definition MainMenu.cpp:586
void setJoinInProgress(bool joining, const std::string &label={})
Show or clear the in-progress connection indicator.
Definition MainMenu.cpp:477
std::string popupMessage
Modal message shown once after returning to the main menu.
Definition MainMenu.hpp:139
bool canManageCurrentServer() const
True if the client is connected and is the current lobby host.
Definition MainMenu.cpp:494
bool pendingGoToLobby
Set when the user clicks "Go to Lobby", cleared by App.
Definition MainMenu.hpp:134
HostConfigState * draft
Persistent draft state owned by App; not owned.
Definition MainMenu.hpp:117
UserSettings * settings
Live user settings; not owned.
Definition MainMenu.hpp:119
bool pendingShutdown
Set when the user clicks "Shutdown", cleared by App.
Definition MainMenu.hpp:133
std::optional< JoinRequest > consumeJoinRequest()
Take the pending join request set when the user clicks "Join", clearing it.
Definition MainMenu.cpp:396
std::mutex browserMutex
Guards global browser results from worker thread.
Definition MainMenu.hpp:153
std::optional< MatchConfig > lastSyncedMatchConfig
Last match config acknowledged locally as server state.
Definition MainMenu.hpp:125
bool consumeGoToLobbyRequest()
True if the user requested entering the hosted lobby, then clear that request.
Definition MainMenu.cpp:435
SystemMenuOverlay systemMenu_
Shared Escape menu for front-end screens.
Definition MainMenu.hpp:121
NewRenderer * renderer
Renderer; not owned.
Definition MainMenu.hpp:113
GlobalDiscoveryConfig discoveryConfig
Definition MainMenu.hpp:122
bool pendingReturnToTitleScreenRequest
Set when the user clicks "Return to Title Screen", cleared on transition.
Definition MainMenu.hpp:135
NetworkConfig * networkConfig
Runtime network config owned by App; not owned.
Definition MainMenu.hpp:118
bool pendingExitRequest
Set when the user confirms "Exit to Desktop", cleared by App.
Definition MainMenu.hpp:137
bool pendingLaunch
Set when the user clicks "Launch", cleared by App.
Definition MainMenu.hpp:132
bool openPopupMessage
True when the modal should be opened next frame.
Definition MainMenu.hpp:140
void setLaunchError(const std::string &error)
Display a launch or connection error on the host tab.
Definition MainMenu.cpp:470
void requestShutdownConfirm()
Ask the host to confirm server shutdown.
Definition MainMenu.cpp:596
ConfirmModal confirm_
Reusable confirmation modal for host tab actions.
Definition MainMenu.hpp:127
void quit() override
Perform any necessary cleanup before the screen is destroyed.
Definition MainMenu.cpp:196
SDL_AppResult event(SDL_Event *event) override
Handle an incoming SDL event.
Definition MainMenu.cpp:187
JoinMenuState joinMenuState
Mutable state backing the join form widgets.
Definition MainMenu.hpp:123
bool consumeReturnToTitleScreenRequest()
Take the pending title-screen request set when the user clicks "Return to Title Screen",...
Definition MainMenu.cpp:444
std::string_view settingsPath
Save path for user settings.
Definition MainMenu.hpp:120
Client * client
Network client owned by App; not owned.
Definition MainMenu.hpp:115
bool consumeLaunchRequest()
True if the user requested server launch, then clear that request.
Definition MainMenu.cpp:417
void setJoinError(const std::string &error)
Display an error string on the join form (e.g. from a failed connection attempt).
Definition MainMenu.cpp:463
bool consumeShutdownRequest()
True if the user requested hosted-server shutdown, then clear that request.
Definition MainMenu.cpp:426
std::vector< DiscoveryClient::DiscoveredServer > localServers
Latest LAN browser snapshot.
Definition MainMenu.hpp:151
std::string joinError
Error message shown on the join form; empty when no error.
Definition MainMenu.hpp:138
PendingConfirmAction pendingConfirmAction
Action to run after modal confirm.
Definition MainMenu.hpp:128
void joinRefreshThreadIfFinished()
Join the global browser worker once it has finished.
Definition MainMenu.cpp:642
std::string browserError
Last global browser error, empty when none.
Definition MainMenu.hpp:152
void startGlobalRefresh(bool force=false)
Start an asynchronous global server-browser refresh when allowed by throttling.
Definition MainMenu.cpp:606
bool init(AppContext &ctx, ServerBrowserTab initialTab=ServerBrowserTab::LocalListing)
Bind renderer, window, and discovery configuration; must be called before iterate().
Definition MainMenu.cpp:144
std::optional< JoinRequest > pendingJoinRequest
Set when the user clicks "Join", cleared on App transition to Lobby.
Definition MainMenu.hpp:130
std::string lastHostError
Error message shown on the host form; empty when no error.
Definition MainMenu.hpp:124
Graphics-team's work-in-progress SDL3 GPU renderer.
Definition NewRenderer.hpp:83
Non-owning view of App-owned services and configuration.
Definition AppContext.hpp:20
Global server browser / directory-service settings.
Definition NetworkConfig.hpp:121
Persistent host-screen options used when launching a local server.
Definition HostedServer.hpp:17
Server address and port entered by the user on the main menu screen.
Definition MainMenu.hpp:29
uint32_t globalServerId
Directory server id, or 0 for manual join.
Definition MainMenu.hpp:32
uint16_t serverPort
TCP port of the target server.
Definition MainMenu.hpp:31
std::string serverName
Display name shown in the lobby after joining.
Definition MainMenu.hpp:33
std::string serverIp
Hostname or IP address of the target server.
Definition MainMenu.hpp:30
Runtime network connection parameters.
Definition NetworkConfig.hpp:141
Per-user gameplay settings loaded from SDL's pref-path TOML file.
Definition UserSettings.hpp:25