group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
App Class Reference

Root application class; owns shared resources and manages screen transitions. More...

#include <App.hpp>

Collaboration diagram for App:
[legend]

Public Types

enum class  Screen { Home , Lobby , InGame }
 Named screens the application can display. More...

Public Member Functions

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.

Private Member Functions

void cleanup ()
 Destroy all subsystems without asserting on partial-init state.

Private Attributes

SDL_Window * window = nullptr
 Main application window.
NewRenderer renderer
 SDL_GPU PBR renderer, shared across screens.
NetworkConfig networkConfig
 Host/port/transport loaded from config.toml.
DeveloperConfig developerConfig
 Developer toggles loaded from config.toml.
Client client
 Network client connected to the authoritative server.
Screen current = Screen::Home
 Which screen is currently active.
std::unique_ptr< IScreenscreen_
 Active screen instance.
bool imguiContextOwned = false
 True once App has created the ImGui context.

Detailed Description

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 between Lobby and InGame.

Member Enumeration Documentation

◆ Screen

enum class App::Screen
strong

Named screens the application can display.

Enumerator
Home 

Main menu screen.

Lobby 

Pre-match lobby waiting room.

InGame 

Active match session.

Member Function Documentation

◆ cleanup()

void App::cleanup ( )
private

Destroy all subsystems without asserting on partial-init state.

Here is the caller graph for this function:

◆ event()

SDL_AppResult App::event ( SDL_Event * event)

Forward an SDL event to the active screen.

Returns
SDL_APP_CONTINUE or SDL_APP_FAILURE.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

bool App::init ( )

Initialize SDL, the GPU renderer, ImGui, and the network client.

Returns
True on success; false if any subsystem fails to initialize.
Here is the call graph for this function:

◆ iterate()

SDL_AppResult App::iterate ( )

Tick the active screen and check for pending screen transitions.

Returns
SDL_APP_CONTINUE or SDL_APP_FAILURE.
Here is the call graph for this function:

◆ quit()

void App::quit ( )

Shut down all subsystems and release resources.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ transitionTo()

void App::transitionTo ( Screen next)

Destroy the current screen and activate the requested one.

Parameters
nextThe screen to transition to.
Here is the caller graph for this function:

Member Data Documentation

◆ client

Client App::client
private

Network client connected to the authoritative server.

◆ current

Screen App::current = Screen::Home
private

Which screen is currently active.

◆ developerConfig

DeveloperConfig App::developerConfig
private

Developer toggles loaded from config.toml.

◆ imguiContextOwned

bool App::imguiContextOwned = false
private

True once App has created the ImGui context.

◆ networkConfig

NetworkConfig App::networkConfig
private

Host/port/transport loaded from config.toml.

◆ renderer

NewRenderer App::renderer
private

SDL_GPU PBR renderer, shared across screens.

◆ screen_

std::unique_ptr<IScreen> App::screen_
private

Active screen instance.

◆ window

SDL_Window* App::window = nullptr
private

Main application window.


The documentation for this class was generated from the following files: