Skip to content

package ui

import "kaiju/ui"

Constants

EventTypeInvalid

iota

EventTypeEnter

EventTypeExit

EventTypeClick

EventTypeRightClick

EventTypeDoubleClick

EventTypeDown

EventTypeUp

EventTypeMiss

EventTypeDragStart

EventTypeDragEnd

EventTypeDrop

EventTypeDropEnter

EventTypeDropExit

EventTypeScroll

EventTypeRebuild

EventTypeDestroy

EventTypeSubmit

EventTypeChange

EventTypeRender

EventTypeKeyDown

EventTypeKeyUp

EventTypeEnd

InputTypeDefault

iota

InputTypeText

InputTypeNumber

InputTypePhone

InputTypeDatetime

AnchorTopLeft

Anchor(1 + iota)

AnchorTopCenter

AnchorTopRight

AnchorLeft

AnchorCenter

AnchorRight

AnchorBottomLeft

AnchorBottomCenter

AnchorBottomRight

AnchorStretchLeft

AnchorStretchTop

AnchorStretchRight

AnchorStretchBottom

AnchorStretchCenter

PositioningStatic

Positioning(iota)

PositioningAbsolute

PositioningFixed

PositioningRelative

PositioningSticky

PanelScrollDirectionNone

0x00

PanelScrollDirectionVertical

0x01

PanelScrollDirectionHorizontal

0x02

PanelScrollDirectionBoth

0x03

BorderStyleNone

iota

BorderStyleHidden

BorderStyleDotted

BorderStyleDashed

BorderStyleSolid

BorderStyleDouble

BorderStyleGroove

BorderStyleRidge

BorderStyleInset

BorderStyleOutset

ContentFitNone

iota

ContentFitWidth

ContentFitHeight

ContentFitBoth

OverflowScroll

iota

OverflowVisible

OverflowHidden

DirtyTypeNone

iota

DirtyTypeLayout

DirtyTypeResize

DirtyTypeGenerated

DirtyTypeColorChange

DirtyTypeScissor

DirtyTypeParent

DirtyTypeParentLayout

DirtyTypeParentResize

DirtyTypeParentGenerated

DirtyTypeParentReGenerated

DirtyTypeParentColorChange

DirtyTypeParentScissor

ElementTypeLabel

ElementType(iota)

ElementTypePanel

ElementTypeButton

ElementTypeCheckbox

ElementTypeImage

ElementTypeInput

ElementTypeProgressBar

ElementTypeSelect

ElementTypeSlider

EntityDataName

"ui"

LabelFontSize

14.0

Types

Anchor

int32

type Anchor int32

Anchor.ConvertToBottom

func (a Anchor) ConvertToBottom() Anchor

Anchor.ConvertToCenter

func (a Anchor) ConvertToCenter() Anchor

Anchor.ConvertToLeft

func (a Anchor) ConvertToLeft() Anchor

Anchor.ConvertToRight

func (a Anchor) ConvertToRight() Anchor

Anchor.ConvertToTop

func (a Anchor) ConvertToTop() Anchor

Anchor.IsBottom

func (a Anchor) IsBottom() bool

Anchor.IsLeft

func (a Anchor) IsLeft() bool

Anchor.IsRight

func (a Anchor) IsRight() bool

Anchor.IsTop

func (a Anchor) IsTop() bool

BorderStyle

int32

type BorderStyle = int32

Button

Panel

type Button Panel

Button.Base

func (b *Button) Base() *UI

Button.ButtonData

func (b *Button) ButtonData() *buttonData

Button.Init

func (b *Button) Init(texture *rendering.Texture, text string, anchor Anchor)

Button.Label

func (b *Button) Label() *Label

Button.SetColor

func (b *Button) SetColor(color matrix.Color)

Checkbox

Panel

type Checkbox Panel

Checkbox.Base

func (cb *Checkbox) Base() *UI

Checkbox.CheckboxData

func (cb *Checkbox) CheckboxData() *checkboxData

Checkbox.Init

func (cb *Checkbox) Init(anchor Anchor)

Checkbox.IsChecked

func (cb Checkbox) IsChecked() bool

Checkbox.SetChecked

func (cb *Checkbox) SetChecked(isChecked bool)

ContentFit

int32

type ContentFit = int32

DirtyType

int

type DirtyType = int

ElementType

uint8

type ElementType = uint8

EventType

int

type EventType = int

Group

struct

type Group struct {
    // Has unexported fields.
}

NewGroup

func NewGroup() *Group

Group.Attach

func (group *Group) Attach(host *engine.Host)

Group.Detach

func (group *Group) Detach(host *engine.Host)

Group.HasRequests

func (group *Group) HasRequests() bool

Group.SetThreaded

func (g *Group) SetThreaded()

Image

Panel

type Image Panel

Image.Base

func (s *Image) Base() *UI

Image.ImageData

func (s *Image) ImageData() *imageData

Image.Init

func (s *Image) Init(texture *rendering.Texture, anchor Anchor)

Image.PlayAnimation

func (img *Image) PlayAnimation()

Image.SetFlipBookAnimation

func (img *Image) SetFlipBookAnimation(framesPerSecond float32, textures ...*rendering.Texture)

Image.SetFrameRate

func (img *Image) SetFrameRate(framesPerSecond float32)

Image.SetTexture

func (img *Image) SetTexture(texture *rendering.Texture)

Image.StopAnimation

func (img *Image) StopAnimation()

Input

Panel

type Input Panel

Input.Base

func (input *Input) Base() *UI

Input.Focus

func (input *Input) Focus()

Input.Init

func (input *Input) Init(placeholderText string, anchor Anchor)

Input.InputData

func (input *Input) InputData() *inputData

Input.InsertText

func (input *Input) InsertText(text string)

Input.IsFocused

func (input *Input) IsFocused() bool

Input.RemoveFocus

func (input *Input) RemoveFocus()

Input.SelectAll

func (input *Input) SelectAll()

Input.SetBGColor

func (input *Input) SetBGColor(newColor matrix.Color)

Input.SetCursorColor

func (input *Input) SetCursorColor(newColor matrix.Color)

Input.SetCursorOffset

func (input *Input) SetCursorOffset(offset int)

Input.SetDescription

func (input *Input) SetDescription(text string)

Input.SetFGColor

func (input *Input) SetFGColor(newColor matrix.Color)

Input.SetFontSize

func (input *Input) SetFontSize(fontSize float32)

Input.SetNextFocusedInput

func (input *Input) SetNextFocusedInput(next *Input)

Input.SetPlaceholder

func (input *Input) SetPlaceholder(text string)

Input.SetSelectColor

func (input *Input) SetSelectColor(newColor matrix.Color)

Input.SetText

func (input *Input) SetText(text string)

Input.SetTextColor

func (input *Input) SetTextColor(newColor matrix.Color)

Input.SetTextWithoutEvent

func (input *Input) SetTextWithoutEvent(text string)

Input.SetTitle

func (input *Input) SetTitle(text string)

Input.SetType

func (input *Input) SetType(inputType InputType)

Input.Text

func (input *Input) Text() string

InputType

int32

type InputType = int32

Label

UI

type Label UI

Label.Base

func (l *Label) Base() *UI

Label.BoldRange

func (label *Label) BoldRange(start, end int)

Label.CalculateMaxWidth

func (label *Label) CalculateMaxWidth() float32

Label.ColorRange

func (label *Label) ColorRange(start, end int, newColor, bgColor matrix.Color)

Label.EnforceBGColor

func (label *Label) EnforceBGColor(color matrix.Color)

Label.EnforceFGColor

func (label *Label) EnforceFGColor(color matrix.Color)

Label.FontFace

func (label *Label) FontFace() rendering.FontFace

Label.FontSize

func (label *Label) FontSize() float32

Label.Hide

func (label *Label) Hide()

Label.Init

func (label *Label) Init(text string, anchor Anchor)

Label.LabelData

func (l *Label) LabelData() *labelData

Label.LineHeight

func (label *Label) LineHeight() float32

Label.MaxWidth

func (label *Label) MaxWidth() float32

Label.Measure

func (label *Label) Measure() matrix.Vec2

Label.SetBGColor

func (label *Label) SetBGColor(newColor matrix.Color)

Label.SetBaseline

func (label *Label) SetBaseline(baseline rendering.FontBaseline)

Label.SetColor

func (label *Label) SetColor(newColor matrix.Color)

Label.SetFontSize

func (label *Label) SetFontSize(size float32)

Label.SetFontStyle

func (label *Label) SetFontStyle(style string)

Label.SetFontWeight

func (label *Label) SetFontWeight(weight string)

Label.SetJustify

func (label *Label) SetJustify(justify rendering.FontJustify)

Label.SetLineHeight

func (label *Label) SetLineHeight(height float32)

Label.SetMaxWidth

func (label *Label) SetMaxWidth(maxWidth float32)

Label.SetText

func (label *Label) SetText(text string)

Label.SetWidthAutoHeight

func (label *Label) SetWidthAutoHeight(width float32)

Label.SetWrap

func (label *Label) SetWrap(wrapText bool)

Label.Show

func (label *Label) Show()

Label.Text

func (label *Label) Text() string

Label.UnEnforceBGColor

func (label *Label) UnEnforceBGColor()

Label.UnEnforceFGColor

func (label *Label) UnEnforceFGColor()

Layout

struct

type Layout struct {
    // Has unexported fields.
}

Layout.AddFunction

func (l *Layout) AddFunction(fn func(layout *Layout)) LayoutFuncId

Layout.Anchor

func (l *Layout) Anchor() Anchor

Layout.AnchorTo

func (l *Layout) AnchorTo(anchorPosition Anchor)

Layout.Border

func (l *Layout) Border() matrix.Vec4

Layout.CalcOffset

func (l *Layout) CalcOffset() matrix.Vec2

Layout.ClearFunctions

func (l *Layout) ClearFunctions()

Layout.ContentSize

func (l *Layout) ContentSize() (float32, float32)

Layout.InnerOffset

func (l *Layout) InnerOffset() matrix.Vec4

Layout.LocalInnerOffset

func (l *Layout) LocalInnerOffset() matrix.Vec4

Layout.Margin

func (l *Layout) Margin() matrix.Vec4

Layout.Offset

func (l *Layout) Offset() matrix.Vec2

Layout.Padding

func (l *Layout) Padding() matrix.Vec4

Layout.PixelSize

func (l *Layout) PixelSize() matrix.Vec2

Layout.Positioning

func (l *Layout) Positioning() Positioning

Layout.RemoveFunction

func (l *Layout) RemoveFunction(id LayoutFuncId)

Layout.Scale

func (l *Layout) Scale(width, height float32) bool

Layout.ScaleHeight

func (l *Layout) ScaleHeight(height float32) bool

Layout.ScaleWidth

func (l *Layout) ScaleWidth(width float32) bool

Layout.SetBorder

func (l *Layout) SetBorder(left, top, right, bottom float32)

Layout.SetInnerOffset

func (l *Layout) SetInnerOffset(left, top, right, bottom float32)

Layout.SetInnerOffsetBottom

func (l *Layout) SetInnerOffsetBottom(offset float32)

Layout.SetInnerOffsetLeft

func (l *Layout) SetInnerOffsetLeft(offset float32)

Layout.SetInnerOffsetRight

func (l *Layout) SetInnerOffsetRight(offset float32)

Layout.SetInnerOffsetTop

func (l *Layout) SetInnerOffsetTop(offset float32)

Layout.SetLocalInnerOffset

func (l *Layout) SetLocalInnerOffset(left, top, right, bottom float32)

Layout.SetMargin

func (l *Layout) SetMargin(left, top, right, bottom float32)

Layout.SetOffset

func (l *Layout) SetOffset(x, y float32)

Layout.SetPadding

func (l *Layout) SetPadding(left, top, right, bottom float32)

Layout.SetPositioning

func (l *Layout) SetPositioning(pos Positioning)

Layout.SetRowLayoutOffset

func (l *Layout) SetRowLayoutOffset(offset matrix.Vec2)

Layout.SetStretch

func (l *Layout) SetStretch(left, top, right, bottom float32)

Layout.SetStretchRatio

func (l *Layout) SetStretchRatio(leftRatio, topRatio, rightRatio, bottomRatio float32)

Layout.SetZ

func (l *Layout) SetZ(z float32)

Layout.Stretch

func (l *Layout) Stretch() matrix.Vec4

Layout.Ui

func (l *Layout) Ui() *UI

Layout.Z

func (l *Layout) Z() float32

LayoutFuncId

int64

type LayoutFuncId = int64

LayoutFunctions

struct

type LayoutFunctions struct {
    // Has unexported fields.
}

NewEvent

func NewEvent() LayoutFunctions

LayoutFunctions.Add

func (lf *LayoutFunctions) Add(call func(layout *Layout)) LayoutFuncId

LayoutFunctions.Clear

func (lf *LayoutFunctions) Clear()

LayoutFunctions.Execute

func (lf *LayoutFunctions) Execute(layout *Layout)

LayoutFunctions.IsEmpty

func (lf *LayoutFunctions) IsEmpty() bool

LayoutFunctions.Remove

func (e *LayoutFunctions) Remove(id LayoutFuncId)

Manager

struct

type Manager struct {
    Host  *engine.Host
    Group *Group

    // Has unexported fields.
}

Manager.Add

func (man *Manager) Add() *UI

Manager.Clear

func (man *Manager) Clear()

Manager.Init

func (man *Manager) Init(host *engine.Host)

Manager.Release

func (man *Manager) Release()

Manager.Remove

func (man *Manager) Remove(ui *UI)

Manager.Reserve

func (man *Manager) Reserve(additionalElements int)

Overflow

int

type Overflow = int

Panel

UI

type Panel UI

FirstPanelOnEntity

func FirstPanelOnEntity(entity *engine.Entity) *Panel

Panel.AddChild

func (p *Panel) AddChild(target *UI)

Panel.Background

func (p *Panel) Background() *rendering.Texture

Panel.Base

func (p *Panel) Base() *UI

Panel.BorderColor

func (p *Panel) BorderColor() [4]matrix.Color

Panel.BorderSize

func (p *Panel) BorderSize() matrix.Vec4

Panel.BorderStyle

func (p *Panel) BorderStyle() [4]BorderStyle

Panel.Child

func (p *Panel) Child(index int) *UI

Panel.DisableDragScroll

func (p *Panel) DisableDragScroll()

Panel.DontFitContent

func (p *Panel) DontFitContent()

Panel.DontFitContentHeight

func (p *Panel) DontFitContentHeight()

Panel.DontFitContentWidth

func (p *Panel) DontFitContentWidth()

Panel.EnableDragScroll

func (p *Panel) EnableDragScroll()

Panel.EnforceColor

func (p *Panel) EnforceColor(color matrix.Color)

Panel.FitContent

func (p *Panel) FitContent()

Panel.FitContentHeight

func (p *Panel) FitContentHeight()

Panel.FitContentWidth

func (p *Panel) FitContentWidth()

Panel.FittingContent

func (p *Panel) FittingContent() bool

Panel.Freeze

func (p *Panel) Freeze()

Panel.HasEnforcedColor

func (p *Panel) HasEnforcedColor() bool

Panel.Init

func (panel *Panel) Init(texture *rendering.Texture, anchor Anchor, elmType ElementType)

Panel.InsertChild

func (p *Panel) InsertChild(target *UI, idx int)

Panel.IsFrozen

func (p *Panel) IsFrozen() bool

Panel.IsScrolling

func (p *Panel) IsScrolling() bool

Panel.Overflow

func (p *Panel) Overflow() Overflow

Panel.PanelData

func (p *Panel) PanelData() *panelData

Panel.RemoveBackground

func (p *Panel) RemoveBackground()

Panel.RemoveChild

func (p *Panel) RemoveChild(target *UI)

Panel.ResetScroll

func (p *Panel) ResetScroll()

Panel.ScrollDirection

func (p *Panel) ScrollDirection() PanelScrollDirection

Panel.ScrollX

func (p *Panel) ScrollX() float32

Panel.ScrollY

func (p *Panel) ScrollY() float32

Panel.SetBackground

func (p *Panel) SetBackground(tex *rendering.Texture)

Panel.SetBorderColor

func (p *Panel) SetBorderColor(left, top, right, bottom matrix.Color)

Panel.SetBorderRadius

func (p *Panel) SetBorderRadius(topLeft, topRight, bottomRight, bottomLeft float32)

Panel.SetBorderSize

func (p *Panel) SetBorderSize(left, top, right, bottom float32)

Panel.SetBorderStyle

func (p *Panel) SetBorderStyle(left, top, right, bottom BorderStyle)

Panel.SetColor

func (p *Panel) SetColor(bgColor matrix.Color)

Panel.SetOverflow

func (p *Panel) SetOverflow(overflow Overflow)

Panel.SetScrollDirection

func (p *Panel) SetScrollDirection(direction PanelScrollDirection)

Panel.SetScrollX

func (p *Panel) SetScrollX(value float32)

Panel.SetScrollY

func (p *Panel) SetScrollY(value float32)

Panel.SetSpeed

func (p *Panel) SetSpeed(speed float32)

Panel.SetUseBlending

func (p *Panel) SetUseBlending(useBlending bool)

Panel.UnEnforceColor

func (p *Panel) UnEnforceColor()

Panel.UnFreeze

func (p *Panel) UnFreeze()

PanelScrollDirection

int32

type PanelScrollDirection = int32

Positioning

int

type Positioning = int

ProgressBar

Panel

type ProgressBar Panel

ProgressBar.Base

func (p *ProgressBar) Base() *UI

ProgressBar.Init

func (p *ProgressBar) Init(fgTexture, bgTexture *rendering.Texture, anchor Anchor)

ProgressBar.SetBGColor

func (b *ProgressBar) SetBGColor(bgColor matrix.Color)

ProgressBar.SetFGColor

func (b *ProgressBar) SetFGColor(fgColor matrix.Color)

ProgressBar.SetValue

func (b *ProgressBar) SetValue(value float32)

ProgressBar.Value

func (b ProgressBar) Value() float32

ShaderData

struct

type ShaderData struct {
    rendering.ShaderDataBase
    UVs          matrix.Vec4
    FgColor      matrix.Color
    BgColor      matrix.Color
    Scissor      matrix.Vec4
    Size2D       matrix.Vec4
    BorderRadius matrix.Vec4
    BorderSize   matrix.Vec4
    BorderColor  [4]matrix.Color
    BorderLen    matrix.Vec2
}

ShaderData.Size

func (s ShaderData) Size() int

Slider

Panel

type Slider Panel

Slider.Base

func (s *Slider) Base() *UI

Slider.Delta

func (slider Slider) Delta() float32

Slider.Init

func (s *Slider) Init(anchor Anchor)

Slider.SetBGColor

func (slider *Slider) SetBGColor(bgColor matrix.Color)

Slider.SetFGColor

func (slider *Slider) SetFGColor(fgColor matrix.Color)

Slider.SetValue

func (slider *Slider) SetValue(value float32)

Slider.SliderData

func (s *Slider) SliderData() *sliderData

Slider.Value

func (slider Slider) Value() float32

UI

struct

type UI struct {
    // Has unexported fields.
}

AllOnEntity

func AllOnEntity(entity *engine.Entity) []*UI

FirstOnEntity

func FirstOnEntity(entity *engine.Entity) *UI

UI.AddEvent

func (ui *UI) AddEvent(evtType EventType, evt func()) events.Id

UI.Clean

func (ui *UI) Clean()

UI.Entity

func (ui *UI) Entity() *engine.Entity

UI.Event

func (ui *UI) Event(evtType EventType) *events.Event

UI.ExecuteEvent

func (ui *UI) ExecuteEvent(evtType EventType) bool

UI.GenerateScissor

func (ui *UI) GenerateScissor()

UI.Host

func (ui *UI) Host() *engine.Host

UI.Layout

func (ui *UI) Layout() *Layout

UI.RemoveEvent

func (ui *UI) RemoveEvent(evtType EventType, evtId events.Id)

UI.SetDirty

func (ui *UI) SetDirty(dirtyType DirtyType)

UI.ShaderData

func (ui *UI) ShaderData() *ShaderData

UI.ToButton

func (u *UI) ToButton() *Button

UI.ToCheckbox

func (u *UI) ToCheckbox() *Checkbox

UI.ToImage

func (u *UI) ToImage() *Image

UI.ToInput

func (u *UI) ToInput() *Input

UI.ToLabel

func (u *UI) ToLabel() *Label

UI.ToPanel

func (u *UI) ToPanel() *Panel

UI.ToProgressBar

func (u *UI) ToProgressBar() *ProgressBar

UI.ToSlider

func (u *UI) ToSlider() *Slider

UI.Update

func (ui *UI) Update(deltaTime float64)

UIElementData

interface

type UIElementData interface {
    // Has unexported methods.
}