MenuContainerBase class
#include <Jazz2/UI/Menu/MenuContainerBase.h>
Shared base of the menu containers.
Common implementation behind both MainMenu and InGameMenu. It owns the stack of MenuSection screens, the section MenuTransition, the three drawing layers (background, scissor-clipped middle, and overlay), input state, and content bounds, and implements all of the shared IMenuContainer drawing, string, sound and navigation primitives in a single place. Subclasses provide only what genuinely differs through a small set of hooks (GetUpscalePass, GetPressedKeys) and keep their own backdrop, logo and per-container behavior.
Base classes
- class IMenuContainer
- Base interface of a menu container.
Derived classes
- class InGameMenu
- In-game menu.
- class MainMenu
- Main menu.
Constructors, destructors, conversion operators
- MenuContainerBase()
- ~MenuContainerBase() override
Public functions
-
auto SwitchToSectionDirect(std::
unique_ptr<MenuSection> section) -> MenuSection* override - Switches to already created section.
- void LeaveSection() override
- Leaves current section.
- auto GetCurrentSection() const -> MenuSection* override
- Returns the current section.
- auto GetUnderlyingSection() const -> MenuSection* override
- Returns the next section after the top one.
- auto ActionPressed(PlayerAction action) -> bool override
- Returns
trueif specified action is pressed. - auto ActionHit(PlayerAction action) -> bool override
- Returns
trueif specified action is hit (newly pressed). - auto GetContentBounds() const -> Recti override
- Returns content bounds.
-
void DrawElement(AnimState state,
std::
int32_t frame, float x, float y, std:: uint16_t z, Alignment align, const Colorf& color, float scaleX = 1.0f, float scaleY = 1.0f, bool additiveBlending = false, bool unaligned = false) override - Draws a textured element.
-
void DrawElement(AnimState state,
float x,
float y,
std::
uint16_t z, Alignment align, const Colorf& color, Vector2f size, const Vector4f& texCoords, bool unaligned = false) override -
void DrawSolid(float x,
float y,
std::
uint16_t z, Alignment align, Vector2f size, const Colorf& color, bool additiveBlending = false) override - Draws a solid rectangle.
-
void DrawTexture(const Texture& texture,
float x,
float y,
std::
uint16_t z, Alignment align, Vector2f size, const Colorf& color, bool unaligned = false) override - Draws a textured rectangle.
- auto MeasureString(StringView text, float scale = 1.0f, float charSpacing = 1.0f, float lineSpacing = 1.0f) -> Vector2f override
- Measures a string.
-
void DrawStringShadow(StringView text,
std::
int32_t& charOffset, float x, float y, std:: uint16_t z, Alignment align, const Colorf& color, float scale = 1.0f, float angleOffset = 0.0f, float varianceX = 4.0f, float varianceY = 4.0f, float speed = 0.4f, float charSpacing = 1.0f, float lineSpacing = 1.0f) override - Draws a string with shadow.
-
void DrawStringGlow(StringView text,
std::
int32_t& charOffset, float x, float y, std:: uint16_t z, Alignment align, const Colorf& color, float scale = 1.0f, float angleOffset = 0.0f, float varianceX = 4.0f, float varianceY = 4.0f, float speed = 0.4f, float charSpacing = 1.0f, float lineSpacing = 1.0f) override - Draw a string with underglow and shadow.
- void PlaySfx(StringView identifier, float gain = 1.0f) override
- Plays a common sound effect.
Protected functions
-
auto GetUpscalePass() -> Rendering::
UpscaleRenderPassWithClipping& pure virtual - Returns the upscale render pass used to present the menu (and to set the clip rectangle).
- auto GetPressedKeys() const -> const BitArray& pure virtual
- Returns the set of currently pressed keys used for navigation.
Function documentation
void Jazz2:: UI:: Menu:: MenuContainerBase:: DrawElement(AnimState state,
float x,
float y,
std:: uint16_t z,
Alignment align,
const Colorf& color,
Vector2f size,
const Vector4f& texCoords,
bool unaligned = false) override
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.