Numeric input

slider and slider_int are a bounded track with a readout, formatted with a printf fmt for the float version. drag changes a value by clicking and dragging, with no track, stepping by step and clamped to its range. Holding shift scrubs at a tenth of the rate. stepper puts minus and plus buttons around a formatted value. Each returns true on the frame its value changes.

Slider, picks a value along a track, drawn by isolenSlider, picks a value along a track, drawn by isolen
widgets_numeric.cpp
#include "isolenui/ui/ui.h"
#include "isolenui/kit/kit.h"

struct mixer_state {
    float gain = 0.0f;
    int32_t crossfade = 0;
    float glow = 0.5f;
    float bpm = 120.0f;
};

static void mixer_controls(ui::ctx* u, mixer_state* s)
{
    // slider, a bounded float with a formatted readout
    ui::slider(u, "gain db", &s->gain, -60.0f, 12.0f, "%.1f db");

    // slider_int, the integer twin of slider
    ui::slider_int(u, "crossfade", &s->crossfade, -100, 100);

    // drag, click and drag to change without opening a track
    ui::drag(u, "glow", &s->glow, 0.01f, 0.0f, 1.0f, "%.2f");

    // stepper, plus and minus buttons around a formatted value
    ui::stepper(u, "bpm", &s->bpm, 1.0f, 40.0f, 300.0f, "%.0f");
}

Last updated 6 October 2026