group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
App.hpp
Go to the documentation of this file.
1
3
4#pragma once
5#include "DeveloperConfig.hpp"
6#include "IScreen.hpp"
7#include "network/Client.hpp"
10
11#include <SDL3/SDL.h>
12
13#include <memory>
14
19class App
20{
21public:
24 bool init();
25
28 SDL_AppResult event(SDL_Event* event);
29
32 SDL_AppResult iterate();
33
35 void quit();
36
38 enum class Screen
39 {
43 };
44
47 void transitionTo(Screen next);
48
49private:
50 SDL_Window* window = nullptr;
55
57 std::unique_ptr<IScreen> screen_;
58 bool imguiContextOwned = false;
59
61 void cleanup();
62};
TCP client for connecting to the game server.
Developer-mode configuration loaded from config.toml.
Abstract interface for top-level application screens (lobby, in-game).
Network configuration loaded from config.toml at startup.
Work-in-progress SDL3 GPU renderer.
Root application class; owns shared resources and manages screen transitions.
Definition App.hpp:20
Screen current
Which screen is currently active.
Definition App.hpp:56
SDL_Window * window
Main application window.
Definition App.hpp:50
bool init()
Initialize SDL, the GPU renderer, ImGui, and the network client.
Definition App.cpp:59
DeveloperConfig developerConfig
Developer toggles loaded from config.toml.
Definition App.hpp:53
std::unique_ptr< IScreen > screen_
Active screen instance.
Definition App.hpp:57
void transitionTo(Screen next)
Destroy the current screen and activate the requested one.
Definition App.cpp:230
void cleanup()
Destroy all subsystems without asserting on partial-init state.
Definition App.cpp:276
Screen
Named screens the application can display.
Definition App.hpp:39
@ InGame
Active match session.
Definition App.hpp:42
@ Home
Main menu screen.
Definition App.hpp:40
NetworkConfig networkConfig
Host/port/transport loaded from config.toml.
Definition App.hpp:52
void quit()
Shut down all subsystems and release resources.
Definition App.cpp:225
Client client
Network client connected to the authoritative server.
Definition App.hpp:54
SDL_AppResult event(SDL_Event *event)
Forward an SDL event to the active screen.
Definition App.cpp:155
SDL_AppResult iterate()
Tick the active screen and check for pending screen transitions.
Definition App.cpp:162
bool imguiContextOwned
True once App has created the ImGui context.
Definition App.hpp:58
NewRenderer renderer
SDL_GPU PBR renderer, shared across screens.
Definition App.hpp:51
TCP stream client — sends input to the server and receives state updates.
Definition Client.hpp:60
IScreen implementation for the main menu; hosts the server join form.
Definition Home.hpp:20
IScreen implementation for the pre-match lobby.
Definition Lobby.hpp:18
Graphics-team's work-in-progress SDL3 GPU renderer.
Definition NewRenderer.hpp:27
Developer-only runtime toggles shared by client and server.
Definition DeveloperConfig.hpp:8
Runtime network connection parameters.
Definition NetworkConfig.hpp:103