play around with faders, WIP

This commit is contained in:
2026-03-03 19:41:20 -05:00
parent da6e868b0f
commit 2927335975
7 changed files with 4416 additions and 375 deletions

View File

@@ -110,6 +110,11 @@ struct AppState {
F32 demo_knob_unsigned;
F32 demo_knob_signed;
// Slider/fader demo state
F32 demo_slider_h;
F32 demo_slider_v;
F32 demo_fader;
// Audio device selection
S32 audio_device_sel; // dropdown index: 0 = None, 1+ = device
S32 audio_device_prev; // previous selection for change detection
@@ -300,6 +305,34 @@ static void build_main_panel(AppState *app) {
.backgroundColor = g_theme.border
) {}
// Section: Sliders
ui_label("LblSliders", "Sliders");
CLAY(CLAY_ID("SliderHRow"),
.layout = {
.sizing = { .width = CLAY_SIZING_FIT(), .height = CLAY_SIZING_FIT() },
.childGap = uip(16),
.layoutDirection = CLAY_LEFT_TO_RIGHT,
}
) {
ui_slider_h("SliderH", "Horizontal", &app->demo_slider_h, 100.0f, 0, 50.0f, 1);
}
CLAY(CLAY_ID("SliderVRow"),
.layout = {
.sizing = { .width = CLAY_SIZING_FIT(), .height = CLAY_SIZING_FIT() },
.childGap = uip(24),
.childAlignment = { .y = CLAY_ALIGN_Y_TOP },
.layoutDirection = CLAY_LEFT_TO_RIGHT,
}
) {
ui_slider_v("SliderV", "Vertical", &app->demo_slider_v, 100.0f, 0, 75.0f, 1);
ui_fader("Fader1", "Fader", &app->demo_fader, 50.0f, 1, 0.0f, 1);
}
CLAY(CLAY_ID("Sep7"),
.layout = { .sizing = { .width = CLAY_SIZING_GROW(), .height = CLAY_SIZING_FIXED(1) } },
.backgroundColor = g_theme.border
) {}
// Section: Windows & Modals
ui_label("LblWindows", "Windows & Modals");
CLAY(CLAY_ID("WindowBtnRow"),
@@ -900,6 +933,9 @@ int main(int argc, char **argv) {
app.show_midi_devices = 1;
app.demo_knob_unsigned = 75.0f;
app.demo_knob_signed = 0.0f;
app.demo_slider_h = 50.0f;
app.demo_slider_v = 75.0f;
app.demo_fader = 0.0f;
app.demo_dropdown_sel = 1; // default to 48000 Hz
app.radius_sel = 1; // default to "Small" (4.0f)
snprintf(app.demo_text_a, sizeof(app.demo_text_a), "My Instrument");