Interface Params
- All Known Implementing Classes:
Params.NoopParams
public interface Params
Interface for interactive runtime parameters (sliders, toggles, buttons,
etc.).
Parameters are identified by path strings using "/" as a folder separator
(e.g., "osc/y-scale"). Use at(String) to set a common prefix
so that related controls are grouped together in the GUI.
Every method that accepts a defaultValue returns that default when
the parameter has not been changed by the user, or when running in COMPAT
render mode (NO_OP).
All params elements are lazily initialized at the first call site.
Example usage
// Inside render(Graphics g, Frame f, Params p, Input in):
double scale = p.slider("y-scale", 0.45, 0.1, 1.0);
int count = p.sliderInt("bars", 50, 10, 200);
boolean on = p.toggle("glow", true);
// Grouping related controls under a folder:
Params osc = p.at("osc");
double thick = osc.slider("thickness", 1.5, 0.5, 5.0);
int window = osc.sliderInt("window", 50, 5, 800);
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classNo-op implementation for compatibility rendering mode. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns a newParamsthat prepends the given prefix to all paths.booleanA momentary button that returnstruefor exactly one frame when clicked.voidDisplays a read-only text label in the GUI.A radio button group.A radio button group with an explicit default selection.A radio button group with options supplied as a list.A radio button group with an explicit default selection.doubleA floating-point slider with a default value and no explicit bounds.doubleA floating-point slider with a default value and explicit bounds.intAn integer slider with a default value and no explicit bounds.intAn integer slider with a default value and explicit bounds.booleanA boolean toggle (checkbox).
-
Field Details
-
NO_OP
A no-op implementation that always returns default values. Used when the GUI is disabled or unavailable.
-
-
Method Details
-
at
-
slider
A floating-point slider with a default value and no explicit bounds.- Parameters:
path- parameter pathdefaultValue- initial value- Returns:
- the current slider value
-
slider
A floating-point slider with a default value and explicit bounds.- Parameters:
path- parameter pathdefaultValue- initial valuemin- minimum boundmax- maximum bound- Returns:
- the current slider value, clamped to [
min,max]
-
sliderInt
An integer slider with a default value and no explicit bounds.- Parameters:
path- parameter pathdefaultValue- initial value- Returns:
- the current slider value
-
sliderInt
An integer slider with a default value and explicit bounds.- Parameters:
path- parameter pathdefaultValue- initial valuemin- minimum boundmax- maximum bound- Returns:
- the current slider value, clamped to [
min,max]
-
toggle
A boolean toggle (checkbox).- Parameters:
path- parameter pathdefaultValue- initial state- Returns:
trueif the toggle is on
-
button
A momentary button that returnstruefor exactly one frame when clicked.- Parameters:
path- parameter path- Returns:
trueon the frame the button is pressed
-
info
-
radio
-
radio
A radio button group with an explicit default selection.If
defaultOptionis null/blank, or not present inoptions, the first option is used as the default.- Parameters:
path- parameter pathoptions- available choicesdefaultOption- initially selected option- Returns:
- the currently selected option
-
radio
-
radio
-