raygui

package
v0.0.0-...-ace572f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2021 License: Zlib Imports: 7 Imported by: 0

README

raygui GoDoc

raygui is simple and easy-to-use IMGUI (immediate mode GUI API) library.

screenshot

Documentation

Overview

GUI element appearance can be dynamically configured through Property values, the set of which forms a theme called the Style.

Index

Constants

This section is empty.

Variables

View Source
var BackspaceRepeatDelay = 300 * time.Millisecond

BackspaceRepeatDelay controls the time backspace must be held down before it will repeat.

View Source
var BackspaceRepeatInterval = 60 * time.Millisecond

BackspaceRepeatInterval controls how frequently backspace registers after the initial delay.

Functions

func BackgroundColor

func BackgroundColor() rl.Color

BackgroundColor will return the current background color

func Button

func Button(bounds rl.Rectangle, text string) bool

Button - Button element, returns true when clicked

func CheckBox

func CheckBox(bounds rl.Rectangle, checked bool) bool

CheckBox - Check Box element, returns true when active

func ComboBox

func ComboBox(bounds rl.Rectangle, comboText []string, active int) int

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

func ConstrainRectangle(bounds *rl.Rectangle, minWidth, idealWidth, minHeight, idealHeight int32)

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

func GetStyle32(property Property) int32

GetStyle32 will return the int32 for a given property of the current style

func GetStyleColor

func GetStyleColor(property Property) rl.Color

GetPropColor will return the Color value for a given property of the current style

func GetStyleProperty

func GetStyleProperty(guiProperty Property) int64

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 IsInAny

func IsInAny(point rl.Vector2, rectangles ...rl.Rectangle) bool

IsColliding will return true if 'point' is within any of the given rectangles.

func Label

func Label(bounds rl.Rectangle, text string)

Label - Label element, show text

func LabelEx

func LabelEx(bounds rl.Rectangle, text string, textColor, border, inner rl.Color)

LabelEx - Label element extended, configurable colors

func LinesColor

func LinesColor() rl.Color

LinesColor will return the current color for lines

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

func SetStyleColor(guiProperty Property, value rl.Color)

SetStyleColor - Set one style property to a color value

func SetStyleProperty

func SetStyleProperty(guiProperty Property, value int64)

SetStyleProperty - Set one style property

func Slider

func Slider(bounds rl.Rectangle, value, minValue, maxValue float32) float32

Slider - Slider element, returns selected value

func SliderBar

func SliderBar(bounds rl.Rectangle, value, minValue, maxValue float32) float32

SliderBar - Slider Bar element, returns selected value

func Spinner

func Spinner(bounds rl.Rectangle, value, minValue, maxValue int) int

Spinner - Spinner element, returns selected value

func TextBox

func TextBox(bounds rl.Rectangle, text string) string

TextBox - Text Box element, updates input text

func TextColor

func TextColor() rl.Color

TextColor will return the current color for normal state

func ToggleButton

func ToggleButton(bounds rl.Rectangle, text string, active bool) bool

ToggleButton - Toggle Button element, returns true when active

func ToggleGroup

func ToggleGroup(bounds rl.Rectangle, toggleText []string, active int) int

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL