/  ChuGL GUI

UI_Element

UI_Window

UI_Button

UI_SliderFloatBase

UI_SliderFloat

UI_SliderFloat2

UI_SliderFloat3

UI_SliderFloat4

UI_SliderIntBase

UI_SliderInt

UI_SliderInt2

UI_SliderInt3

UI_SliderInt4

UI_Checkbox

UI_Color3

UI_Dropdown

UI_Text

API methods for creating widgets such as buttons, sliders, dropdowns, etc. Use widgets to control parameter values during runtime. Great for experimentation and fine-tuning values. Also usable for building application user-interfaces.

UI_Element

inherits : Event : Object

Base class for all GUI elements. Do not instantiate directlyAll GUI elements are Chuck Events, and can be used as such.

examples

constructors

UI_Element()

Default constructor for UI_Element.

member functions

string text(string text)

Set the text label of this element.

string text()

Get the text label of this element.


UI_Window

inherits : UI_Element : Event : Object

Window element. Each instance will create a separate GUI window.Add elements to the window via .add() to display them.

examples

constructors

UI_Window()

Default constructor for UI_Window.

member functions

void add(UI_Element element)

Adds an element to this window, will be displayed in the order they are added.


UI_Button

inherits : UI_Element : Event : Object

Button widget, clicking will trigger the button instance, which itself is a Chuck Event.

examples

constructors

UI_Button()

Default constructor for UI_Button.


UI_SliderFloatBase

inherits : UI_Element : Event : Object

Base class for float slider widgetDon't instaniate directly, use one of the subclasses e.g. UI_SliderFloat or UI_SliderFloat2CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.

examples

constructors

UI_SliderFloatBase()

Default constructor for UI_SliderFloatBase.

member functions

void power(float power)

Set the power of the slider, e.g. 2.0 for an exponential domain. Defaults to 1.0.

float power()

Get the power of the slider.

void range(float min, float max)

Set the range of the slider.

vec2 range()

Get the range of the slider.


UI_SliderFloat

inherits : UI_SliderFloatBase : UI_Element : Event : Object

Float slider widget.

constructors

UI_SliderFloat()

Default constructor for UI_SliderFloat.

member functions

float val()

Get the current value of the slider.

float val(float val)

Set the current value of the slider.


UI_SliderFloat2

inherits : UI_SliderFloatBase : UI_Element : Event : Object

Float2 slider widget. 2 float sliders side by side.

examples

constructors

UI_SliderFloat2()

Default constructor for UI_SliderFloat2.

member functions

vec2 val()

Get the current value of the slider.

vec2 val(vec2 val)

Set the current value of the slider.


UI_SliderFloat3

inherits : UI_SliderFloatBase : UI_Element : Event : Object

Float3 slider widget. 3 float sliders side by side.

constructors

UI_SliderFloat3()

Default constructor for UI_SliderFloat3.

member functions

vec3 val()

Get the current value of the slider.

vec3 val(vec3 val)

Set the current value of the slider.


UI_SliderFloat4

inherits : UI_SliderFloatBase : UI_Element : Event : Object

Float4 slider widget. 4 float sliders side by side.

constructors

UI_SliderFloat4()

Default constructor for UI_SliderFloat4.

member functions

vec4 val()

Get the current value of the slider.

vec4 val(vec4 val)

Set the current value of the slider.


UI_SliderIntBase

inherits : UI_Element : Event : Object

Int slider Base class widgetCTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.

examples

constructors

UI_SliderIntBase()

Default constructor for UI_SliderIntBase.

member functions

void range(int min, int max)

Set the range of the slider.

vec2 range()

Get the range of the slider.


UI_SliderInt

inherits : UI_SliderIntBase : UI_Element : Event : Object

Int slider widgetCTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.

constructors

UI_SliderInt()

Default constructor for UI_SliderInt.

member functions

int val()

Get the current value of the slider.

int val(int val)

Set the current value of the slider.


UI_SliderInt2

inherits : UI_SliderIntBase : UI_Element : Event : Object

Int2 slider widget. 2 int sliders side by side.

constructors

UI_SliderInt2()

Default constructor for UI_SliderInt2.

member functions

vec2 val()

Get the current value of the slider.

vec2 val(vec2 val)

Set the current value of the slider.


UI_SliderInt3

inherits : UI_SliderIntBase : UI_Element : Event : Object

Int3 slider widget. 3 int sliders side by side.

constructors

UI_SliderInt3()

Default constructor for UI_SliderInt3.

member functions

vec3 val()

Get the current value of the slider.

vec3 val(vec3 val)

Set the current value of the slider.


UI_SliderInt4

inherits : UI_SliderIntBase : UI_Element : Event : Object

Int4 slider widget. 4 int sliders side by side.

constructors

UI_SliderInt4()

Default constructor for UI_SliderInt4.

member functions

vec4 val()

Get the current value of the slider.

vec4 val(vec4 val)

Set the current value of the slider.


UI_Checkbox

inherits : UI_Element : Event : Object

Checkbox widget.

examples

constructors

UI_Checkbox()

Default constructor for UI_Checkbox.

member functions

int val()

Get the current state of the checkbox, 1 for checked, 0 for unchecked.

int val(int val)

Set the current state of the checkbox, 1 for checked, 0 for unchecked.


UI_Color3

inherits : UI_Element : Event : Object

Color picker widgetTtip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.

examples

constructors

UI_Color3()

Default constructor for UI_Color3.

member functions

vec3 val()

Get the current value of the color picker.

vec3 val(vec3 color)

Set the current value of the color picker.


UI_Dropdown

inherits : UI_Element : Event : Object

Dropdown widgetCreate a dropdown menu with the given list of itemsOn select, the widget will store the selected items *index* and will trigger an event.

examples

constructors

UI_Dropdown()

Default constructor for UI_Dropdown.

member functions

void options(string[] options)

Set the list of options for the dropdown menu.

int val()

Get the integer index of the curerntly selected dropdown item.

int val(int idx)

Set the integer index of the selected dropdown item.


UI_Text

inherits : UI_Element : Event : Object

Text widgetAdd text to the UI windowSupports options such as color, style, and wrapping.

examples

constructors

UI_Text()

Default constructor for UI_Text.

member functions

vec3 color()

Get the text color.

vec3 color(vec3 color)

Set the text color, defaults to alpha of 1.0 ie fully opaque.

int mode()

Get the text mode. Default is MODE_DEFAULT, meaning no additional formattingMODE_BULLET will display text as a bullet pointMODE_SEPARATOR will display text with a horizontal separator line.

int mode(int mode)

Set the text mode. Default is MODE_DEFAULT, meaning no additional formattingMODE_BULLET will display text as a bullet pointMODE_SEPARATOR will display text with a horizontal separator line.

string text(string text)

Get the text string.

string text()

Set the text string.

int wrap()

Get the text wrapping mode. Default True, meaning text will wrap to end of window.

int wrap(int wrap)

Set the text wrapping mode. Default True, meaning text will wrap to end of windowIf false, text will extend past the window bounds, and the user will need to scroll horizontally to see it.

static member variables

int MODE_BULLET

Display text as a bullet point.

int MODE_DEFAULT

Default text mode, no additional formatting.

int MODE_SEPARATOR

Display text with a horizontal separator line.