Skip to content

option_box

Anthony Samms edited this page Jun 2, 2026 · 1 revision

Option boxes are the individual controls inside each settings_box. Every option maps to a single entry in the config via a ConfigRef and renders as a labelled control with a flicker animation when highlighted. There are seven concrete types, each tailored to a specific kind of value.

All option box types share a common visual layout:

  • The option name is drawn in the title area.
  • A description string is displayed at position (450, 270).
  • The current value or button group is rendered below the title.
  • A 400 ms fade flicker animation plays while the option is highlighted.

ConfigRef

ConfigRef is a lightweight struct that identifies which config field an option box reads from and writes to. Settings are grouped into the following categories:

Category Examples
General fps_counter, audio_offset, visual_offset, language, song_timer, score_method, display_bpm
Nameplate (1P & 2P) name, title, title_bg, dan, gold_dan, rainbow
Keybinds exit_key, fullscreen_key, pause_key, player left_kat / left_don / right_don / right_kat
Controller (1P & 2P) left_kat, left_don, right_don, right_kat
Audio device_type, sample_rate, buffer_size
Volume sound, music, voice, hitsound, attract_mode
Video fullscreen, borderless, target_fps, vsync

BaseOptionBox

BaseOptionBox(const json& option_data, ConfigRef ref);

Abstract base. Loads the option's localised name and description from the JSON data, stores the ConfigRef, and creates the flicker animation.

Members

Member Type Description
name string Localised option name
description string Localised description displayed below the option
config_ref ConfigRef Points to the config field this option controls
highlighted bool Whether the flicker animation is active
flicker_anim Animation* 400 ms fade loop played while highlighted

Interface

virtual void move_left() = 0;
virtual void move_right() = 0;
virtual void confirm() = 0;
virtual void draw() = 0;

BoolOptionBox

A toggle with two states: on and off.

Input Behaviour
Move left Sets the config value to false
Move right Sets the config value to true

Rendered as two side-by-side OPTION::BUTTON_ON / OPTION::BUTTON_OFF textures.


IntOptionBox

An integer value, either displayed as a raw number or mapped to a predefined label string.

Input Behaviour
Move left Decrements the value (clamped to the defined minimum)
Move right Increments the value (clamped to the defined maximum)

When a label list is provided in the JSON, the current integer index is used to look up a display string instead of showing the raw number.


StrOptionBox

A string value chosen from a predefined list or entered as free-form text.

Input Behaviour
Move left / right Cycles through the list of allowed values
Character input (highlighted) Appends a character for free-form entry
Backspace (highlighted) Removes the last character
Enter (highlighted) Confirms the typed value

KeybindOptionBox

A keyboard keybind. While highlighted, the box listens for the next key press and stores it as the new binding.

Input Behaviour
Any key (highlighted) Replaces the current binding with the pressed key
Move left / right No effect

Supports both single-key (int) and multi-key (vector<int>) storage. Multiple bindings are displayed as a comma-separated list of key names.


KeyBindControllerOptionBox

A gamepad button binding. Behaves identically to #KeybindOptionBox but reads from ray::GetGamepadButtonPressed() rather than the keyboard.


FloatOptionBox

A floating-point value in the range 0.0–1.0, displayed as a percentage (0–100 %).

Input Behaviour
Move left Decrements by 0.01 (1 %)
Move right Increments by 0.01 (1 %)

Used for all volume controls (sound, music, voice, hitsound, attract_mode).


AudioOffsetOptionBox

A specialised two-button control combining a numeric offset field and a calibration shortcut.

Sub-control Input Behaviour
Offset value Move left / right Adjusts the audio offset in milliseconds
Calibrate button Confirm Sets pending_screen to Screens::INPUT_CALI, opening the calibration screen

Left/right navigation moves focus between the two sub-controls. The offset value is saved to config_ref when focus leaves the option or the screen exits. There is no way to currently move the audio offset right.

Clone this wiki locally