Jazz2::UI::Menu::IMenuContainer class

Base interface of a menu container.

Interface for the host that owns the stack of MenuSection screens. It manages switching between and leaving sections, exposes the drawing, string measurement, input, and sound primitives that sections build on, and bridges to higher-level actions such as changing levels or connecting to multiplayer servers.

Derived classes

class InGameMenu
In-game menu.
class MainMenu
Main menu.

Public static functions

static auto EaseOutElastic(float t) -> float
Returns elastic ease-out interpolation of the specified value.
static auto EaseOutCubic(float t) -> float
Returns cubic ease-out interpolation of the specified value.

Constructors, destructors, conversion operators

~IMenuContainer() virtual

Public functions

template<typename T, typename... Params>
auto SwitchToSection(Params && ... args) -> T*
Creates a section by type and switches to it.
auto SwitchToSectionDirect(std::unique_ptr<MenuSection> section) -> MenuSection* pure virtual
Switches to already created section.
void LeaveSection() pure virtual
Leaves current section.
auto GetCurrentSection() const -> MenuSection* pure virtual
Returns the current section.
auto GetUnderlyingSection() const -> MenuSection* pure virtual
Returns the next section after the top one.
void ChangeLevel(LevelInitialization&& levelInit) pure virtual
Changes current level.
auto HasResumableState() const -> bool pure virtual
Returns true if a saved state can be resumed.
void ResumeSavedState() pure virtual
Resumes a saved state.
void ConnectToServer(StringView endpoint, std::uint16_t defaultPort) pure virtual
Connects to a multiplayer server asynchronously.
auto CreateServer(Jazz2::Multiplayer::ServerInitialization&& serverInit) -> bool pure virtual
Creates a multiplayer server.
void ApplyPreferencesChanges(ChangedPreferencesType type) pure virtual
Applies changes to preferences.
auto ActionPressed(PlayerAction action) -> bool pure virtual
Returns true if specified action is pressed.
auto ActionHit(PlayerAction action) -> bool pure virtual
Returns true if specified action is hit (newly pressed).
auto GetViewSize() const -> Vector2i pure virtual
Returns viewport size of the menu.
auto GetContentBounds() const -> Recti pure virtual
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) pure virtual
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) pure virtual
void DrawSolid(float x, float y, std::uint16_t z, Alignment align, Vector2f size, const Colorf& color, bool additiveBlending = false) pure virtual
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) pure virtual
Draws a textured rectangle.
auto MeasureString(StringView text, float scale = 1.0f, float charSpacing = 1.0f, float lineSpacing = 1.0f) -> Vector2f pure virtual
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) pure virtual
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) pure virtual
Draw a string with underglow and shadow.
void PlaySfx(StringView identifier, float gain = 1.0f) pure virtual
Plays a common sound effect.

Function documentation

void Jazz2::UI::Menu::IMenuContainer::DrawElement(AnimState state, float x, float y, std::uint16_t z, Alignment align, const Colorf& color, Vector2f size, const Vector4f& texCoords, bool unaligned = false) pure virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.