Documentation ¶
Overview ¶
GUI element appearance can be dynamically configured through Property values, the set of which forms a theme called the Style.
Index ¶
- Variables
- func BackgroundColor() rl.Color
- func Button(bounds rl.Rectangle, text string) bool
- func CheckBox(bounds rl.Rectangle, checked bool) bool
- func ComboBox(bounds rl.Rectangle, comboText []string, active int) int
- func ConstrainRectangle(bounds *rl.Rectangle, minWidth, idealWidth, minHeight, idealHeight int32)
- func DrawBorderedRectangle(bounds rl.RectangleInt32, borderWidth int32, borderColor, insideColor rl.Color)
- func DrawInsetRectangle(outer rl.RectangleInt32, inset int32, color rl.Color)
- func GetStyle32(property Property) int32
- func GetStyleColor(property Property) rl.Color
- func GetStyleProperty(guiProperty Property) int64
- func InsetRectangle(outer rl.RectangleInt32, inset int32) rl.RectangleInt32
- func IsInAny(point rl.Vector2, rectangles ...rl.Rectangle) bool
- func Label(bounds rl.Rectangle, text string)
- func LabelEx(bounds rl.Rectangle, text string, textColor, border, inner rl.Color)
- func LinesColor() rl.Color
- func LoadGuiStyle(fileName string)
- func ProgressBar(bounds rl.Rectangle, value float32)
- func SaveGuiStyle(fileName string)
- func SetStyleColor(guiProperty Property, value rl.Color)
- func SetStyleProperty(guiProperty Property, value int64)
- func Slider(bounds rl.Rectangle, value, minValue, maxValue float32) float32
- func SliderBar(bounds rl.Rectangle, value, minValue, maxValue float32) float32
- func Spinner(bounds rl.Rectangle, value, minValue, maxValue int) int
- func TextBox(bounds rl.Rectangle, text string) string
- func TextColor() rl.Color
- func ToggleButton(bounds rl.Rectangle, text string, active bool) bool
- func ToggleGroup(bounds rl.Rectangle, toggleText []string, active int) int
- type ControlState
- type Property
Constants ¶
This section is empty.
Variables ¶
var BackspaceRepeatDelay = 300 * time.Millisecond
BackspaceRepeatDelay controls the time backspace must be held down before it will repeat.
var BackspaceRepeatInterval = 60 * time.Millisecond
BackspaceRepeatInterval controls how frequently backspace registers after the initial delay.
Functions ¶
func BackgroundColor ¶
BackgroundColor will return the current background color
func ComboBox ¶
ComboBox draws a simplified version of a ComboBox allowing the user to select a string from a list accompanied by an N/M counter. The widget does not provide a drop-down/completion or any input support.
func ConstrainRectangle ¶
Constrain rectangle will ensure that if width/height are below given minimums, they will be set to an ideal minimum.
func DrawBorderedRectangle ¶
func DrawBorderedRectangle(bounds rl.RectangleInt32, borderWidth int32, borderColor, insideColor rl.Color)
DrawBorderedRectangle is a helper to draw a box with a border around it.
func DrawInsetRectangle ¶
func DrawInsetRectangle(outer rl.RectangleInt32, inset int32, color rl.Color)
DrawInsetRectangle is a helper to draw a box inset by a margin of an outer container.
func GetStyle32 ¶
GetStyle32 will return the int32 for a given property of the current style
func GetStyleColor ¶
GetPropColor will return the Color value for a given property of the current style
func GetStyleProperty ¶
GetStyleProperty - Get one style property
func InsetRectangle ¶
func InsetRectangle(outer rl.RectangleInt32, inset int32) rl.RectangleInt32
InsetRectangle returns the dimensions of a rectangle inset by a margin within an outer rectangle.
func LoadGuiStyle ¶
func LoadGuiStyle(fileName string)
LoadGuiStyle will load a GUI style from a file. See SaveGuiStyle.
func ProgressBar ¶
func ProgressBar(bounds rl.Rectangle, value float32)
ProgressBar - Progress Bar element, shows current progress value
func SaveGuiStyle ¶
func SaveGuiStyle(fileName string)
SaveGuiStyle will write the current GUI style to a file in a format suitable for loading via LoadGuiStyle.
func SetStyleColor ¶
SetStyleColor - Set one style property to a color value
func SetStyleProperty ¶
SetStyleProperty - Set one style property
func ToggleButton ¶
ToggleButton - Toggle Button element, returns true when active
func ToggleGroup ¶
ToggleGroup - Toggle Group element, returns toggled button index
Types ¶
type ControlState ¶
type ControlState int
GUI controls states
const ( Disabled ControlState = iota // Normal is the default state for rendering GUI elements. Normal // Focused indicates the mouse is hovering over the GUI element. Focused // Pressed indicates the mouse is hovering over the GUI element and LMB is pressed down. Pressed // Clicked indicates the mouse is hovering over the GUI element and LMB has just been released. Clicked )
func GetInteractionState ¶
func GetInteractionState(rectangles ...rl.Rectangle) ControlState
GetInteractionState determines the current state of a control based on mouse position and button states.
type Property ¶
type Property int32
Property - GUI property
const ( GlobalBaseColor Property = iota GlobalBorderColor GlobalTextColor GlobalTextFontsize GlobalBorderWidth GlobalBackgroundColor GlobalLinesColor LabelBorderWidth LabelTextColor LabelTextPadding ButtonBorderWidth ButtonTextPadding ButtonDefaultBorderColor ButtonDefaultInsideColor ButtonDefaultTextColor ButtonHoverBorderColor ButtonHoverInsideColor ButtonHoverTextColor ButtonPressedBorderColor ButtonPressedInsideColor ButtonPressedTextColor ToggleTextPadding ToggleBorderWidth ToggleDefaultBorderColor ToggleDefaultInsideColor ToggleDefaultTextColor ToggleHoverBorderColor ToggleHoverInsideColor ToggleHoverTextColor TogglePressedBorderColor TogglePressedInsideColor TogglePressedTextColor ToggleActiveBorderColor ToggleActiveInsideColor ToggleActiveTextColor TogglegroupPadding SliderBorderWidth SliderButtonBorderWidth SliderBorderColor SliderInsideColor SliderDefaultColor SliderHoverColor SliderActiveColor SliderbarBorderColor SliderbarInsideColor SliderbarDefaultColor SliderbarHoverColor SliderbarActiveColor SliderbarZeroLineColor ProgressbarBorderColor ProgressbarInsideColor ProgressbarProgressColor ProgressbarBorderWidth SpinnerLabelBorderColor SpinnerLabelInsideColor SpinnerDefaultButtonBorderColor SpinnerDefaultButtonInsideColor SpinnerDefaultSymbolColor SpinnerDefaultTextColor SpinnerHoverButtonBorderColor SpinnerHoverButtonInsideColor SpinnerHoverSymbolColor SpinnerHoverTextColor SpinnerPressedButtonBorderColor SpinnerPressedButtonInsideColor SpinnerPressedSymbolColor SpinnerPressedTextColor ComboboxPadding ComboboxBorderWidth ComboboxDefaultBorderColor ComboboxDefaultInsideColor ComboboxDefaultTextColor ComboboxDefaultListTextColor ComboboxHoverBorderColor ComboboxHoverInsideColor ComboboxHoverTextColor ComboboxHoverListTextColor ComboboxPressedBorderColor ComboboxPressedInsideColor ComboboxPressedTextColor ComboboxPressedListBorderColor ComboboxPressedListInsideColor ComboboxPressedListTextColor CheckboxDefaultBorderColor CheckboxDefaultInsideColor CheckboxHoverBorderColor CheckboxHoverInsideColor CheckboxClickBorderColor CheckboxClickInsideColor CheckboxDefaultActiveColor CheckboxInsideWidth TextboxBorderWidth TextboxBorderColor TextboxInsideColor TextboxTextColor TextboxLineColor TextboxTextFontsize // Add new properties above. NumProperties )
GUI properties enumeration