InGameMenu class
#include <Jazz2/UI/Menu/InGameMenu.h>
In-game menu.
MenuContainerBase attached to a running LevelHandler that hosts the menu sections shown while a game is paused, starting from PauseSection. It draws over the live level and provides actions such as resuming the game, returning to the main menu, and (in multiplayer) spectating or reselecting a character.
Base classes
- class MenuContainerBase
- Shared base of the menu containers.
Constructors, destructors, conversion operators
- InGameMenu(LevelHandler* root)
- Creates a new instance attached to the specified level handler.
- ~InGameMenu()
Public functions
-
void OnKeyPressed(const nCine::
KeyboardEvent& event) - Called when a key is pressed.
-
void OnKeyReleased(const nCine::
KeyboardEvent& event) - Called when a key is released.
-
void OnTouchEvent(const nCine::
TouchEvent& event) - Called when a touch event is triggered.
-
void OnInitializeViewport(std::
int32_t width, std:: int32_t height) - Called when the viewport needs to be initialized (e.g., when the resolution is changed).
- void ChangeLevel(LevelInitialization&& levelInit) override
- Changes current level.
- auto HasResumableState() const -> bool override
- Returns
trueif a saved state can be resumed. - void ResumeSavedState() override
- Resumes a saved state.
-
void ConnectToServer(StringView endpoint,
std::
uint16_t defaultPort) override - Connects to a multiplayer server asynchronously.
-
auto CreateServer(Jazz2::
Multiplayer:: ServerInitialization&& serverInit) -> bool override - Creates a multiplayer server.
- void ApplyPreferencesChanges(ChangedPreferencesType type) override
- Applies changes to preferences.
- auto GetViewSize() const -> Vector2i override
- Returns viewport size of the menu.
- auto IsLocalSession() const -> bool
- Returns
trueif the level handler is on a local session. - void ResumeGame()
- Hides the in-game menu and resumes paused game.
- void GoToMainMenu()
- Leaves the paused game and switches back to the main menu.
Protected functions
-
auto GetUpscalePass() -> Rendering::
UpscaleRenderPassWithClipping& override - Returns the upscale render pass used to present the menu (and to set the clip rectangle).
- auto GetPressedKeys() const -> const BitArray& override
- Returns the set of currently pressed keys used for navigation.
Constants
-
static std::
int32_t DefaultWidth constexpr - Default width of viewport.
-
static std::
int32_t DefaultHeight constexpr - Default height of viewport.