Jazz2::UI::Menu::MenuSection class

Base class of a menu section.

A single screen ("section") in the menu stack hosted by an IMenuContainer. Subclasses implement the update, layered draw, and input callbacks to define what an individual screen shows and does.

Derived classes

class AboutSection
About menu section.
class BeginSection
Main menu root section.
class CreateServerOptionsSection
Create server options menu section.
class CustomLevelSelectSection
Custom level selection menu section.
class ImportSection
Import Episodes menu section (Emscripten only).
class InputDiagnosticsSection
Input diagnostics menu section.
class PauseSection
In-game menu root section.
class RefreshCacheSection
Refresh cache menu section.
class ScoreboardSection
In-game multiplayer scoreboard.
class ServerSelectSection
Server selection menu section.
class SimpleMessageSection
Section showing a simple message.
class StartGameOptionsSection
Start game options menu section.
class TouchControlsOptionsSection
Touch controls options menu section.
class WidgetSection
Base class of a declarative menu section.

Constructors, destructors, conversion operators

MenuSection()
~MenuSection() virtual

Public functions

auto GetClipRectangle(const Recti& contentBounds) -> Recti virtual
Allows to override clip rectangle of the middle layer.
void OnShow(IMenuContainer* root) virtual
Called when the section is shown.
void OnHide() virtual
Called when the section is hidden.
void OnUpdate(float timeMult) pure virtual
Called when the section should be updated.
void OnDraw(Canvas* canvas) pure virtual
Called when the section should be drawn — the bottom background layer.
void OnDrawClipped(Canvas* canvas) virtual
Called when the section should be drawn — the middle clipped layer.
void OnDrawOverlay(Canvas* canvas) virtual
Called when the section should be drawn — the top overlay layer.
void OnKeyPressed(const nCine::KeyboardEvent& event) virtual
Called when a key is pressed.
void OnKeyReleased(const nCine::KeyboardEvent& event) virtual
Called when a key is released.
void OnTextInput(const nCine::TextInputEvent& event) virtual
Called when a text input is detected.
void OnTouchEvent(const nCine::TouchEvent& event, Vector2i viewSize) pure virtual
Called when a touch event is triggered.
auto GetNavigationFlags() const -> NavigationFlags virtual
Allows to override navigation behavior.
auto GetTransition() const -> TransitionInfo virtual
Allows to override the animated transition played when this section is shown or hidden.

Protected functions

void UpdateNavigation(float timeMult, bool& outUp, bool& outDown, bool& outPlaySound)
Advances the hold-to-repeat navigation timer and reports whether Up/Down should fire this frame.

Protected static variables

static float TouchKineticDivider constexpr
Kinetic divider for smooth touch controls.
static float TouchKineticFriction constexpr
Kinetic friction for smooth touch controls.
static float TouchKineticDamping constexpr
Kinetic damping for smooth touch controls.

Function documentation

void Jazz2::UI::Menu::MenuSection::UpdateNavigation(float timeMult, bool& outUp, bool& outDown, bool& outPlaySound) protected

Advances the hold-to-repeat navigation timer and reports whether Up/Down should fire this frame.

Fires once on the initial press, then repeatedly at a steady rate after a short delay while the key/button is held (outPlaySound follows each fire). Lets any section give its Up/Down list navigation a continuous hold-to-scroll. Must be called once per frame while the section is active.