IScreen implementation for the main menu; hosts the server join form.
More...
#include <Home.hpp>
|
| bool | init (NewRenderer *rendererPtr, SDL_Window *windowPtr) |
| | 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.
|
| std::optional< JoinRequest > | consumeJoinRequest () |
| | Take the pending join request set when the user clicks "Join", clearing it.
|
| void | setJoinError (const std::string &error) |
| | Display an error string on the join form (e.g. from a failed connection attempt).
|
| virtual | ~IScreen ()=default |
| virtual void | shutdownAfterRenderer () |
| | Perform cleanup that must happen after the App-owned renderer shuts down.
|
IScreen implementation for the main menu; hosts the server join form.
◆ consumeJoinRequest()
| std::optional< JoinRequest > Home::consumeJoinRequest |
( |
| ) |
|
Take the pending join request set when the user clicks "Join", clearing it.
- Returns
- The request, or nullopt if none is pending.
◆ event()
| SDL_AppResult Home::event |
( |
SDL_Event * | event | ) |
|
|
overridevirtual |
Handle an incoming SDL event.
- Parameters
-
| event | The SDL event to process. |
- Returns
- SDL_APP_CONTINUE to keep running, SDL_APP_FAILURE to exit.
Implements IScreen.
◆ init()
| bool Home::init |
( |
NewRenderer * | rendererPtr, |
|
|
SDL_Window * | windowPtr ) |
Bind renderer and window; must be called before iterate().
- Returns
- False if either pointer is null.
◆ iterate()
| SDL_AppResult Home::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.
◆ quit()
Perform any necessary cleanup before the screen is destroyed.
Implements IScreen.
◆ setJoinError()
| void Home::setJoinError |
( |
const std::string & | error | ) |
|
Display an error string on the join form (e.g. from a failed connection attempt).
◆ joinError
| std::string Home::joinError |
|
private |
Error message shown on the join form; empty when no error.
◆ joinMenuState
Mutable state backing the join form widgets.
◆ pendingJoinRequest
Set when the user clicks "Join", cleared on App transition to Lobby.
◆ renderer
◆ window
| SDL_Window* Home::window = nullptr |
|
private |
Application window; not owned.
The documentation for this class was generated from the following files: