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 Classes
    Modifier and Type
    Interface
    Description
    static final class 
    No-op implementation for compatibility rendering mode.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Params
    A no-op implementation that always returns default values.
  • Method Summary

    Modifier and Type
    Method
    Description
    at(String prefix)
    Returns a new Params that prepends the given prefix to all paths.
    boolean
    button(String path)
    A momentary button that returns true for exactly one frame when clicked.
    void
    info(String path, String message)
    Displays a read-only text label in the GUI.
    radio(String path, String[] options)
    A radio button group.
    radio(String path, String[] options, String defaultOption)
    A radio button group with an explicit default selection.
    radio(String path, List<String> options)
    A radio button group with options supplied as a list.
    radio(String path, List<String> options, String defaultOption)
    A radio button group with an explicit default selection.
    double
    slider(String path, double defaultValue)
    A floating-point slider with a default value and no explicit bounds.
    double
    slider(String path, double defaultValue, double min, double max)
    A floating-point slider with a default value and explicit bounds.
    int
    sliderInt(String path, int defaultValue)
    An integer slider with a default value and no explicit bounds.
    int
    sliderInt(String path, int defaultValue, int min, int max)
    An integer slider with a default value and explicit bounds.
    boolean
    toggle(String path, boolean defaultValue)
    A boolean toggle (checkbox).
  • Field Details

    • NO_OP

      static final Params NO_OP
      A no-op implementation that always returns default values. Used when the GUI is disabled or unavailable.
  • Method Details

    • at

      Params at(String prefix)
      Returns a new Params that prepends the given prefix to all paths.

      Prefixes nest: params.at("a").at("b").slider("x", 1) resolves to the path "a/b/x".

      Parameters:
      prefix - folder prefix (for example "osc" or "colors")
      Returns:
      a prefixed view of this Params
    • slider

      double slider(String path, double defaultValue)
      A floating-point slider with a default value and no explicit bounds.
      Parameters:
      path - parameter path
      defaultValue - initial value
      Returns:
      the current slider value
    • slider

      double slider(String path, double defaultValue, double min, double max)
      A floating-point slider with a default value and explicit bounds.
      Parameters:
      path - parameter path
      defaultValue - initial value
      min - minimum bound
      max - maximum bound
      Returns:
      the current slider value, clamped to [min, max]
    • sliderInt

      int sliderInt(String path, int defaultValue)
      An integer slider with a default value and no explicit bounds.
      Parameters:
      path - parameter path
      defaultValue - initial value
      Returns:
      the current slider value
    • sliderInt

      int sliderInt(String path, int defaultValue, int min, int max)
      An integer slider with a default value and explicit bounds.
      Parameters:
      path - parameter path
      defaultValue - initial value
      min - minimum bound
      max - maximum bound
      Returns:
      the current slider value, clamped to [min, max]
    • toggle

      boolean toggle(String path, boolean defaultValue)
      A boolean toggle (checkbox).
      Parameters:
      path - parameter path
      defaultValue - initial state
      Returns:
      true if the toggle is on
    • button

      boolean button(String path)
      A momentary button that returns true for exactly one frame when clicked.
      Parameters:
      path - parameter path
      Returns:
      true on the frame the button is pressed
    • info

      void info(String path, String message)
      Displays a read-only text label in the GUI. Useful for showing computed values or status messages.
      Parameters:
      path - parameter path
      message - text to display
    • radio

      String radio(String path, String[] options)
      A radio button group. The first option is selected by default.
      Parameters:
      path - parameter path
      options - available choices
      Returns:
      the currently selected option
    • radio

      String radio(String path, String[] options, String defaultOption)
      A radio button group with an explicit default selection.

      If defaultOption is null/blank, or not present in options, the first option is used as the default.

      Parameters:
      path - parameter path
      options - available choices
      defaultOption - initially selected option
      Returns:
      the currently selected option
    • radio

      String radio(String path, List<String> options)
      A radio button group with options supplied as a list.
      Parameters:
      path - parameter path
      options - available choices; the first is selected by default
      Returns:
      the currently selected option
      See Also:
    • radio

      String radio(String path, List<String> options, String defaultOption)
      A radio button group with an explicit default selection.
      Parameters:
      path - parameter path
      options - available choices
      defaultOption - initially selected option
      Returns:
      the currently selected option
      See Also: