Documentation ¶
Index ¶
- func Bounds() glitch.Rect
- func Button(label string, rect glitch.Rect) bool
- func Button2(label string, rect glitch.Rect) bool
- func ButtonExt(label string, rect glitch.Rect, style Style) bool
- func Checkbox(val *bool, rect glitch.Rect) bool
- func CheckboxExt(val *bool, rect glitch.Rect, styleTrue, styleFalse Style) bool
- func Clear()
- func ClearActive()
- func Contains(point glitch.Vec2) bool
- func CursorPos() int
- func Debug() bool
- func DefaultTooltipMount() (glm.Rect, glm.Vec2)
- func DragData() any
- func DragItem(label string, rect glitch.Rect, style Style) (bool, bool, bool, bool)
- func DragSlot(label string, rect glitch.Rect, style Style) bool
- func GridList(rect glitch.Rect, numX, numY int) gridList
- func HList(rect glitch.Rect, num int) hList
- func HList2(rect glitch.Rect, size float64) hList
- func Hovered(label string, rect glitch.Rect) bool
- func HoveredNoBlock(rect glitch.Rect) bool
- func Initialize(win *glitch.Window, camera *glitch.CameraOrtho, atlas *glitch.Atlas, ...)
- func Layer() int8
- func LineGraph(rect glitch.Rect, series []glitch.Vec2, textStyle TextStyle)
- func MeasureText(str string, rect glitch.Rect, t TextStyle) glitch.Rect
- func MeasureTextSize(str string, t TextStyle) glm.Vec2
- func MouseCaptured() bool
- func MousePosition() (float64, float64)
- func MultiText(label string, rect glitch.Rect, textStyle TextStyle) glitch.Rect
- func Panel2(label string, rect glitch.Rect) bool
- func PanelExt(label string, rect glitch.Rect, style Style) bool
- func PopId()
- func PushId[T constraints.Integer](id T)
- func Scrollbar(idx *int, total int, rect, hoverRect glitch.Rect)
- func SetActive(label string)
- func SetButtonStyle(style Style)
- func SetCheckboxStyleFalse(style Style)
- func SetCheckboxStyleTrue(style Style)
- func SetCursorPos(pos int)
- func SetDebug(val bool)
- func SetDragData(data any)
- func SetDragItemLayer(layer int8)
- func SetDragSlotStyle(style Style)
- func SetFontScale(scale float64)
- func SetHudScale(scale float64)
- func SetLayer(layer int8)
- func SetPanelStyle(style Style)
- func SetScrollbarBgStyle(style Style)
- func SetScrollbarBottomStyle(style Style)
- func SetScrollbarHandleStyle(style Style)
- func SetScrollbarTopStyle(style Style)
- func SetTooltipStyle(style Style)
- func SliderH(val *float64, min, max, step float64, rect, hoverRect glitch.Rect)
- func SliderV(val *float64, min, max, step float64, rect, hoverRect glitch.Rect)
- func SmoothDragButton(label string, rect *glitch.Rect, bounds glitch.Rect, step glitch.Vec2, ...) bool
- func Sprite(sprite Drawer, rect glitch.Rect, color glitch.RGBA)
- func SpritePanel(sprite Drawer, rect glitch.Rect, color glitch.RGBA) bool
- func TextExt(label string, rect glitch.Rect, textStyle TextStyle) glitch.Rect
- func TextInput(label string, str *string, rect glitch.Rect, style Style)
- func Tooltip(label string, rect glitch.Rect)
- func TooltipExt(label string, rect glitch.Rect, style Style)
- func Update()
- func VList(rect glitch.Rect, num int) vList
- func VList2(rect glitch.Rect, size float64) vList
- type Drawer
- type FullStyle
- type Layout
- type LayoutType
- type Size
- type SizeType
- type SpriteStyle
- type Style
- type TextStyle
- func (s TextStyle) Anchor(v glitch.Vec2) TextStyle
- func (s TextStyle) Autofit(v bool) TextStyle
- func (s TextStyle) Color(v glitch.RGBA) TextStyle
- func (s TextStyle) FitInteger(v bool) TextStyle
- func (s TextStyle) Padding(v glitch.Rect) TextStyle
- func (s TextStyle) Pivot(v glitch.Vec2) TextStyle
- func (s TextStyle) Scale(v float64) TextStyle
- func (s TextStyle) Shadow(v glitch.Vec2) TextStyle
- func (s TextStyle) WordWrap(v bool) TextStyle
- type WidgetResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clear ¶
func Clear()
Must be called every frame before any UI draws happen TODO - This is hard to remember to do
func ClearActive ¶
func ClearActive()
func DefaultTooltipMount ¶
Returns the cursor rect and the anchor vector for the tooltip
func HoveredNoBlock ¶
func Initialize ¶
func Initialize(win *glitch.Window, camera *glitch.CameraOrtho, atlas *glitch.Atlas, sorter *glitch.Sorter)
TODO: 1. Would be nice to have per-state styles that include text rendering style (rather than one global) 2. Some default style that "just works" and renders flat geometry 3. Mousechecks should happen based on active/hot and not bounds checks 4. Better interface for overriding styles: maybe variadic configs? Maybe push/pop? Maybe just really nice builder functions? 5. How to do layer swiching? As style override? 6. Ability to do WorldSpaceUI (maybe not interactable?)?
func MeasureText ¶
Returns the rectangular bounds of the drawn text
func MousePosition ¶
Returns the mouse position with respect to the group camera
func PushId ¶
func PushId[T constraints.Integer](id T)
TODO: You could potententially do an ID stack system: https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-about-the-id-stack-system
func SetButtonStyle ¶
func SetButtonStyle(style Style)
func SetCheckboxStyleFalse ¶
func SetCheckboxStyleFalse(style Style)
func SetCheckboxStyleTrue ¶
func SetCheckboxStyleTrue(style Style)
func SetCursorPos ¶
func SetCursorPos(pos int)
func SetDragData ¶
func SetDragData(data any)
func SetDragItemLayer ¶
func SetDragItemLayer(layer int8)
func SetDragSlotStyle ¶
func SetDragSlotStyle(style Style)
func SetFontScale ¶
func SetFontScale(scale float64)
func SetHudScale ¶
func SetHudScale(scale float64)
func SetPanelStyle ¶
func SetPanelStyle(style Style)
func SetScrollbarBgStyle ¶
func SetScrollbarBgStyle(style Style)
func SetScrollbarBottomStyle ¶
func SetScrollbarBottomStyle(style Style)
func SetScrollbarHandleStyle ¶
func SetScrollbarHandleStyle(style Style)
func SetScrollbarTopStyle ¶
func SetScrollbarTopStyle(style Style)
func SetTooltipStyle ¶
func SetTooltipStyle(style Style)
Types ¶
type Drawer ¶
type Drawer interface { RectDraw(glitch.BatchTarget, glitch.Rect) RectDrawColorMask(glitch.BatchTarget, glitch.Rect, glitch.RGBA) }
type LayoutType ¶
type LayoutType uint8
-------------------------------------------------------------------------------- - Layout --------------------------------------------------------------------------------
const ( CutLeft LayoutType = iota CutTop CutRight CutBottom Centered )
type SpriteStyle ¶
type SpriteStyle struct {
// contains filtered or unexported fields
}
func NewSpriteStyle ¶
func NewSpriteStyle(sprite Drawer, color glitch.RGBA) SpriteStyle
func (SpriteStyle) Color ¶
func (s SpriteStyle) Color(v glitch.RGBA) SpriteStyle
func (SpriteStyle) Sprite ¶
func (s SpriteStyle) Sprite(v Drawer) SpriteStyle
type Style ¶
type Style struct {
Normal, Hovered, Pressed SpriteStyle // These are kind of like button states
Text TextStyle
}
func ButtonStyle ¶
func DragItemStyle ¶
func DragItemStyle() Style
func SetDragItemStyle(style Style) { gStyle.dragItemStyle = style }
func DragSlotStyle ¶
func DragSlotStyle() Style
type TextStyle ¶
type TextStyle struct {
// contains filtered or unexported fields
}
func NewTextStyle ¶
func NewTextStyle() TextStyle
TODO: I kind of feel like the string needs to be in here, I'm not sure though
func (TextStyle) FitInteger ¶
type WidgetResp ¶
type WidgetResp struct { // mouseDragDelta glitch.Vec2 Pressed bool Repeated bool Held bool Released bool Dragging bool // contains filtered or unexported fields }
func ButtonFull ¶
func ButtonFull(label string, rect glitch.Rect, style Style) WidgetResp