Documentation ¶
Overview ¶
Package gui implements UI form elements.
Index ¶
- type Button
- type ButtonStyle
- type Control
- type FocusHandler
- type Focuser
- type Horizontal
- type HoverTilt
- type Number
- func (n *Number) Focus()
- func (n *Number) GetFocusHandler() *FocusHandler
- func (n *Number) HasFocus() bool
- func (n *Number) Height() float32
- func (n *Number) Render(tb *sprites.Batch)
- func (n *Number) SetY(y float32)
- func (n *Number) Update(cam *gfx.Camera, ictx *input.Context)
- func (n *Number) Width() float32
- type Scroll
- type Sprite
- type Text
- type Toggle
- func (t *Toggle) Focus()
- func (t *Toggle) GetFocusHandler() *FocusHandler
- func (t *Toggle) HasFocus() bool
- func (t *Toggle) Height() float32
- func (t *Toggle) Render(tb *sprites.Batch)
- func (t *Toggle) SetY(y float32)
- func (t *Toggle) Update(cam *gfx.Camera, ictx *input.Context)
- func (t *Toggle) Width() float32
- type ToggleOption
- type Vertical
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Button ¶
type Button struct { Label string X, Y, Z float32 Dy float32 Sx, Sy float32 MaxWidth float32 FocusHandler OnSelect func() Color sprites.Color Font sprites.FontID Centered bool DefaultFocus bool Style ButtonStyle }
Button is a (clickable) label.
type ButtonStyle ¶
type ButtonStyle uint8
ButtonStyle is a render style for a Button control.
const ( // BtnBorder is outlined text. When the button is hovered, the border // changes from black to rainbow. BtnBorder ButtonStyle = iota // BtnShadow is text with a drop shadow. When the button is hovered, // the text color changes to yellow. BtnShadow // BtnNone is plain text. When the button is hovered, the text color // changes to yellow. BtnNone // BtnTribe is outlined text with a card tribe indicator background. // Color changes the color of the background rather than the text. BtnTribe )
type FocusHandler ¶ added in v0.3.1
type FocusHandler struct { InputFocus **FocusHandler InputFocusLeft func() InputFocusRight func() InputFocusUp func() InputFocusDown func() }
func (*FocusHandler) Focus ¶ added in v0.3.1
func (h *FocusHandler) Focus()
func (*FocusHandler) GetFocusHandler ¶ added in v0.3.1
func (h *FocusHandler) GetFocusHandler() *FocusHandler
func (*FocusHandler) HasFocus ¶ added in v0.3.1
func (h *FocusHandler) HasFocus() bool
type Focuser ¶ added in v0.3.1
type Focuser interface {
GetFocusHandler() *FocusHandler
}
type Horizontal ¶
type Horizontal struct {
Controls []Control
}
func (*Horizontal) HasFocus ¶
func (h *Horizontal) HasFocus() bool
func (*Horizontal) Height ¶
func (h *Horizontal) Height() float32
func (*Horizontal) Render ¶
func (h *Horizontal) Render(b *sprites.Batch)
func (*Horizontal) SetY ¶
func (h *Horizontal) SetY(y float32)
func (*Horizontal) Width ¶ added in v0.3.1
func (h *Horizontal) Width() float32
type HoverTilt ¶
type HoverTilt struct {
X, Y float32
X0, Y0 float32
X1, Y1 float32
Dx, Dy float32
Scale float32
OffX, OffY float32
Falloff float32
Divisor float32
Mins, Maxs gfx.Vector
Hover uint8
}
func (*HoverTilt) SetFunHouse ¶ added in v0.3.15
type Number ¶ added in v0.3.1
type Number struct { Toggle Toggle Prefix string Suffix string Value int64 Min int64 Max int64 Step int64 ValueInf bool PosInf bool NegInf bool OnChange func(i int64, inf bool) }
func (*Number) GetFocusHandler ¶ added in v0.3.3
func (n *Number) GetFocusHandler() *FocusHandler
type Scroll ¶
type Sprite ¶ added in v0.3.1
type Sprite struct { Sprite *sprites.Sprite X, Y, Z float32 Dy float32 Sx, Sy float32 FocusHandler OnSelect func() Color sprites.Color HoverColor sprites.Color DefaultFocus bool }
Sprite is a (clickable) icon.
type Text ¶
type Toggle ¶
type Toggle struct { Button Button OnChange func(int, ToggleOption) Options []ToggleOption Selected int ForceArrow bool }
func (*Toggle) GetFocusHandler ¶ added in v0.3.3
func (t *Toggle) GetFocusHandler() *FocusHandler
type ToggleOption ¶
type ToggleOption struct {
Label string
}
Click to show internal directories.
Click to hide internal directories.