No matching definitions.

raygui/controls

src/raygui/controls.tur

interactive GUI controls for use inside the raylib draw loop.

Since: Phase 1

defn

make-text-buf

(make-text-buf [capacity : int])

allocate a mutable text buffer for a text-box control.

capacitymaximum byte capacity including null terminator

Opaque :int handle; pass to gui-text-box and free with free-text-buf.

(let [buf (make-text-buf 64)] ...)

Since: Phase 1

defn

free-text-buf

(free-text-buf [buf : int])

release a buffer allocated by make-text-buf.

bufopaque handle returned by make-text-buf
(free-text-buf buf)

Since: Phase 1

defn

text-buf->cstr

(text-buf->cstr [buf : int])

read the current contents of a text buffer as :cstr.

bufopaque handle returned by make-text-buf

A :cstr view into the buffer (valid while the buffer is alive).

(println (text-buf->cstr name-buf))

Since: Phase 1

defn

gui-label

(gui-label [r : Rect text : cstr] :)

draw a text label (non-interactive).

rbounding Rect
textlabel text
(gui-label (rect 10.0 10.0 200.0 20.0) "Speed:")

Since: Phase 1

defn

gui-button

(gui-button [r : Rect text : cstr] :)

draw a button; returns 1 the frame it is clicked.

rbounding Rect
textbutton label

1 if the button was clicked this frame, 0 otherwise.

(when (gui-button (rect 10.0 10.0 120.0 30.0) "Go!")
    (println "clicked"))

Since: Phase 1

defn

gui-label-button

(gui-label-button [r : Rect text : cstr] :)

draw a label that acts as a button.

rbounding Rect
textlabel text

1 if clicked this frame, 0 otherwise.

(gui-label-button (rect 10.0 10.0 100.0 20.0) "Click me")

Since: Phase 1

defn

gui-toggle

(gui-toggle [r : Rect text : cstr active : int] :)

draw a toggle button; returns its current active state.

rbounding Rect
textbutton label
activecurrent toggle state (0 = off, 1 = on)

New toggle state after this frame.

(set! muted (gui-toggle (rect 10.0 10.0 80.0 30.0) "Mute" muted))

Since: Phase 1

defn

gui-toggle-group

(gui-toggle-group [r : Rect text : cstr active : int] :)

draw a row of mutually exclusive toggle buttons.

rbounding Rect for the entire group
textsemicolon-separated list of button labels ("A;B;C")
activeindex of the currently selected button

Index of the selected button after this frame.

(set! tab (gui-toggle-group (rect 10.0 10.0 240.0 30.0) "Red;Green;Blue" tab))

Since: Phase 1

defn

gui-check-box

(gui-check-box [r : Rect text : cstr checked : int] :)

draw a checkbox; returns current checked state.

rbounding Rect
textlabel displayed next to the box
checkedcurrent checked state (0 = unchecked, 1 = checked)

New checked state after this frame.

(set! enabled (gui-check-box (rect 10.0 80.0 20.0 20.0) "Enabled" enabled))

Since: Phase 1

defn

gui-slider

(gui-slider [r : Rect lo : cstr hi : cstr val : float min : float max : float] :)

draw a horizontal slider; returns the current value.

rbounding Rect
lolabel shown at the left (min) end
hilabel shown at the right (max) end
valcurrent slider value
minminimum value
maxmaximum value

Updated float value after dragging.

(set! speed (gui-slider (rect 10.0 40.0 200.0 20.0) "0" "10" speed 0.0 10.0))

Since: Phase 1

defn

gui-slider-bar

(gui-slider-bar [r : Rect lo : cstr hi : cstr val : float min : float max : float] :)

draw a filled slider bar; returns the current value.

rbounding Rect
loleft label
hiright label
valcurrent value
minminimum value
maxmaximum value

Updated float value.

(set! vol (gui-slider-bar (rect 10.0 40.0 200.0 20.0) "0" "100" vol 0.0 100.0))

Since: Phase 1

defn

gui-progress-bar

(gui-progress-bar [r : Rect lo : cstr hi : cstr val : float min : float max : float] :)

draw a read-only progress bar.

rbounding Rect
loleft label
hiright label
valcurrent progress value
minminimum value
maxmaximum value

Current value (unchanged).

(gui-progress-bar (rect 10.0 60.0 200.0 20.0) "0" "100" progress 0.0 100.0)

Since: Phase 1

defn

gui-text-box

(gui-text-box [r : Rect buf : int size : int edit : int] :)

draw a single-line text input box.

rbounding Rect
bufmutable text buffer handle (from make-text-buf)
sizebuffer capacity in bytes
editcurrent edit mode state (0 = inactive, 1 = active)

New edit mode state (toggled when the user clicks or presses Enter).

(set! editing (gui-text-box (rect 10.0 10.0 200.0 30.0) name-buf 64 editing))

Since: Phase 1

defn

gui-text-box-multi

(gui-text-box-multi [r : Rect buf : int size : int edit : int] :)

draw a multi-line text input box.

rbounding Rect
bufmutable text buffer handle (from make-text-buf)
sizebuffer capacity in bytes
editcurrent edit mode state

New edit mode state.

(set! editing (gui-text-box-multi (rect 10.0 10.0 300.0 120.0) notes-buf 256 editing))

Since: Phase 3

defn

gui-spinner

(gui-spinner [r : Rect text : cstr val : int min : int max : int edit : int] :)

draw a numeric spinner with increment/decrement buttons.

rbounding Rect
textlabel
valcurrent integer value
minminimum value
maxmaximum value
editcurrent edit mode state

Packed pair: fst = new edit mode, snd = new value.

(let [res (gui-spinner (rect 10.0 10.0 120.0 30.0) "Speed" speed 0 20 speed-edit)]
    (set! speed-edit (pair-fst res))
    (set! speed (pair-snd res)))

Since: Phase 3

defn

gui-value-box

(gui-value-box [r : Rect text : cstr val : int min : int max : int edit : int] :)

draw a numeric value box (type-in field).

rbounding Rect
textlabel
valcurrent integer value
minminimum value
maxmaximum value
editcurrent edit mode state

Packed pair: fst = new edit mode, snd = new value.

(let [res (gui-value-box (rect 10.0 10.0 120.0 30.0) "Count" count 0 100 count-edit)]
    (set! count-edit (pair-fst res))
    (set! count (pair-snd res)))

Since: Phase 3

defn

gui-combo-box

(gui-combo-box [r : Rect text : cstr active : int] :)

draw a combo box (click to cycle through items).

rbounding Rect
textsemicolon-separated item list ("Item1;Item2;Item3")
activeindex of the currently selected item

Index of the selected item after this frame.

(set! mode (gui-combo-box (rect 10.0 10.0 150.0 30.0) "Linear;Ease;Bounce" mode))

Since: Phase 3

defn

gui-dropdown-box

(gui-dropdown-box [r : Rect text : cstr active : int edit : int] :)

draw a dropdown box; expands when clicked.

rbounding Rect
textsemicolon-separated item list
activeindex of the currently selected item
editcurrent open/close state (0 = closed, 1 = open)

New edit (open) state after this frame.

(set! dd-open (gui-dropdown-box (rect 10.0 10.0 150.0 30.0) "A;B;C" dd-sel dd-open))

Since: Phase 3

defn

gui-list-view

(gui-list-view [r : Rect text : cstr scroll : int active : int] :)

draw a scrollable list box.

rbounding Rect
textsemicolon-separated item list
scrollcurrent scroll offset (pixels)
activeindex of the selected item (-1 = none)

Index of the newly selected item, or -1 if none.

(set! sel (gui-list-view (rect 10.0 10.0 200.0 120.0) "Apple;Banana;Cherry" 0 sel))

Since: Phase 3

defn

gui-list-view-ex

(gui-list-view-ex [r : Rect text : cstr count : int scroll : int active : int focus : int] :)

draw a list box with per-item control.

rbounding Rect
textsemicolon-separated item list
countnumber of items in the list
scrollcurrent scroll offset
activeindex of the selected item
focusindex of the focused item

Index of the selected item after this frame.

Since: Phase 3

defn

gui-color-picker

(gui-color-picker [r : Rect text : cstr color : int] :)

draw a full color picker (hue ring + HSV square).

rbounding Rect
textlabel
colorcurrent color as packed RGBA int (0xRRGGBBAA)

New packed RGBA color.

(set! col (gui-color-picker (rect 10.0 10.0 200.0 200.0) "Color" col))

Since: Phase 3

defn

gui-color-bar-alpha

(gui-color-bar-alpha [r : Rect text : cstr alpha : float] :)

draw an alpha channel bar.

rbounding Rect
textlabel
alphacurrent alpha (0.0 to 1.0)

Updated alpha value.

Since: Phase 3

defn

gui-color-bar-hue

(gui-color-bar-hue [r : Rect text : cstr value : float] :)

draw a hue selector bar.

rbounding Rect
textlabel
valuecurrent hue (0.0 to 360.0)

Updated hue value.

Since: Phase 3

defn

gui-message-box

(gui-message-box [r : Rect title : cstr message : cstr buttons : cstr] :)

draw a modal message dialog.

rbounding Rect
titledialog title
messagemessage body text
buttonssemicolon-separated button labels ("OK;Cancel")

Index of the clicked button (0-based), or -1 if none clicked.

(let [btn (gui-message-box (rect 200.0 150.0 300.0 150.0) "Confirm" "Exit?" "Yes;No")]
    (when (= btn 0) (close-window)))

Since: Phase 3

defn

gui-text-input-box

(gui-text-input-box [r : Rect title : cstr message : cstr buttons : cstr buf : int size : int secret : int] :)

draw a modal text input dialog.

rbounding Rect
titledialog title
messageprompt message
buttonssemicolon-separated button labels
bufmutable text buffer handle (from make-text-buf)
sizebuffer capacity in bytes
secret1 to hide typed characters (password mode)

Index of the clicked button, or -1 if none clicked.

Since: Phase 3

defn

gui-grid

(gui-grid [r : Rect text : cstr spacing : float divs : int] :)

draw a grid and return the hovered cell as a packed int.

rbounding Rect
textgrid label
spacingcell size in pixels
divsnumber of subdivisions per cell

Packed (row << 32 | col) of the hovered cell, or -1 if none.

Since: Phase 3