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

IScreen implementation for the first landing menu. More...

#include <TitleScreen.hpp>

Inheritance diagram for TitleScreen:
[legend]
Collaboration diagram for TitleScreen:
[legend]

Public Member Functions

bool init (AppContext &ctx)
 Bind renderer and window; must be called before iterate().
SDL_AppResult event (SDL_Event *event) override
 Handle an incoming SDL event.
SDL_AppResult iterate () override
 Update the screen state and render the next frame.
void quit () override
 Perform any necessary cleanup before the screen is destroyed.
bool consumePlayRequest ()
 True if the user requested opening the main menu/join screen, then clear that request.
bool consumeHostRequest ()
 True if the user requested opening the host configuration screen, then clear that request.
bool consumeSettingsRequest ()
 True if the user requested opening the settings screen, then clear that request.
bool consumeExitRequest ()
 True if the user requested closing the application, then clear that request.
Public Member Functions inherited from IScreen
virtual ~IScreen ()=default
virtual void shutdownAfterRenderer ()
 Perform cleanup that must happen after the App-owned renderer shuts down.

Private Attributes

NewRendererrenderer = nullptr
 Renderer; not owned.
SDL_Window * window = nullptr
 Application window; not owned.
bool pendingPlay = false
 Set when the user clicks "Play", cleared by App.
bool pendingHost = false
 Set when the user clicks "Host", cleared by App.
bool pendingSettings = false
 Set when the user clicks "Settings", cleared by App.
bool pendingExit = false
 Set when the user clicks "Exit", cleared by App.

Additional Inherited Members

Static Protected Member Functions inherited from IScreen
static SDL_AppResult processCommonImguiEvent (SDL_Event *event)
 Forward event to ImGui and detect SDL_EVENT_QUIT.
static bool handleSystemMenuEvent (SDL_Event *event, SystemMenuOverlay &menu, UserSettings *settings)
 Handle Escape-toggle of a SystemMenuOverlay and forward consumed events.
static void beginMenuFrame (NewRenderer *renderer)
 Start a new ImGui frame and paint the shared menu background.
static void presentMenuFrame (NewRenderer &renderer)
 Render the ImGui draw data and present a default-camera frame.

Detailed Description

IScreen implementation for the first landing menu.

Member Function Documentation

◆ consumeExitRequest()

bool TitleScreen::consumeExitRequest ( )

True if the user requested closing the application, then clear that request.

◆ consumeHostRequest()

bool TitleScreen::consumeHostRequest ( )

True if the user requested opening the host configuration screen, then clear that request.

◆ consumePlayRequest()

bool TitleScreen::consumePlayRequest ( )

True if the user requested opening the main menu/join screen, then clear that request.

◆ consumeSettingsRequest()

bool TitleScreen::consumeSettingsRequest ( )

True if the user requested opening the settings screen, then clear that request.

◆ event()

SDL_AppResult TitleScreen::event ( SDL_Event * event)
overridevirtual

Handle an incoming SDL event.

Parameters
eventThe SDL event to process.
Returns
SDL_APP_CONTINUE to keep running, SDL_APP_FAILURE to exit.

Implements IScreen.

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

◆ init()

bool TitleScreen::init ( AppContext & ctx)

Bind renderer and window; must be called before iterate().

Returns
False if either pointer is null.
Here is the call graph for this function:

◆ iterate()

SDL_AppResult TitleScreen::iterate ( )
overridevirtual

Update the screen state and render the next frame.

Returns
SDL_APP_CONTINUE to keep running, SDL_APP_FAILURE to exit.

Implements IScreen.

Here is the call graph for this function:

◆ quit()

void TitleScreen::quit ( )
overridevirtual

Perform any necessary cleanup before the screen is destroyed.

Implements IScreen.

Member Data Documentation

◆ pendingExit

bool TitleScreen::pendingExit = false
private

Set when the user clicks "Exit", cleared by App.

◆ pendingHost

bool TitleScreen::pendingHost = false
private

Set when the user clicks "Host", cleared by App.

◆ pendingPlay

bool TitleScreen::pendingPlay = false
private

Set when the user clicks "Play", cleared by App.

◆ pendingSettings

bool TitleScreen::pendingSettings = false
private

Set when the user clicks "Settings", cleared by App.

◆ renderer

NewRenderer* TitleScreen::renderer = nullptr
private

Renderer; not owned.

◆ window

SDL_Window* TitleScreen::window = nullptr
private

Application window; not owned.


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