Jazz2::UI::Menu::Slider class

Setting row with a value bar adjusted left/right.

Draws a label above a 33-block bar showing a [0, 1] value. Left/Right (held, with hold-to-accelerate) adjust the value through the OnAdjust callback; touching the left/right half of the bar nudges it. Used for the audio volume sliders.

Base classes

class Widget
Base class of a menu widget.

Constructors, destructors, conversion operators

Slider(StringView label, Function<float()> value, Function<void(float)> onAdjust)

Public functions

auto GetHeight() const -> float override
Returns the height the widget occupies in a vertical layout.
void OnUpdate(float timeMult) override
Advances the widget's animations.
void Draw(IMenuContainer* root, Canvas* canvas, const Rectf& bounds, std::int32_t& charOffset) override
Draws the widget within the given bounds.
auto OnNavigate(const WidgetInput& input, IMenuContainer* root) -> bool override
Handles navigation input; returns true if it was consumed.
auto OnTouchEvent(const nCine::TouchEvent& event, Vector2i viewSize, IMenuContainer* root) -> bool override
Handles a touch event; returns true if it was consumed.
void OnSelected() override
Called when the widget becomes selected.

Public variables

String Label
Setting label.
Function<float()> Value
Returns the current value in the [0, 1] range.
Function<void(float)> OnAdjust
Applies a clamped delta to the value (the callback persists/applies the change).
AnimatedValue Animation
Selection animation progress.