Documentation ¶
Index ¶
- Constants
- func ButtonBackground(mgr *ecs.World, w, h int, l, t float64, layer int, absolute bool) ecs.Entity
- func EvaluateIfExpression(expr string, data interface{}) bool
- func LineSpacing(l TextSize) int
- func Resolve(text string, data interface{}) (string, error)
- func ResolveInt(text string, data interface{}) (int, error)
- type AttributeMap
- func (m AttributeMap) Align() string
- func (m AttributeMap) BottomPadding() int
- func (m AttributeMap) FontLayout() TextLayout
- func (m AttributeMap) FontSize() TextSize
- func (m AttributeMap) Height() int
- func (m AttributeMap) Intangible() bool
- func (m AttributeMap) LeftPadding() int
- func (m AttributeMap) RightPadding() int
- func (m AttributeMap) TopPadding() int
- func (m AttributeMap) Twelfths() int
- func (m AttributeMap) Valign() string
- func (m AttributeMap) Width() int
- func (m AttributeMap) X() int
- func (m AttributeMap) Y() int
- type ButtonRenderInstruction
- type Character
- type Element
- type ElementType
- type ImageRenderInstruction
- type Interact
- type Interactive
- type InteractiveRegion
- type InteractiveSystem
- type Line
- type PanelRenderInstruction
- type RenderInstruction
- type Text
- type TextLayout
- type TextRenderInstruction
- type TextSize
- type UI
- type UIInteract
- type UISystem
- type Word
Constants ¶
const ( LetterSpacing = 1 SpaceWidth = 4 TextPadding = 1 ButtonHeight = 15 DefaultButtonWidth = 90 )
Variables ¶
This section is empty.
Functions ¶
func ButtonBackground ¶
ButtonBackground constructs a new background for a button. It visual only and contains no interaction.
func EvaluateIfExpression ¶
func LineSpacing ¶
func Resolve ¶
Resolve the value of text by executing it as a template with the provided data source. Values like "45" are returned directly, while value like {{ .Age }} are resolved by pulling the field (if it exists) with the name "Age" from data.
func ResolveInt ¶
ResolveInt functions like Resolve, but returns an integral value.
Types ¶
type AttributeMap ¶
func (AttributeMap) Align ¶
func (m AttributeMap) Align() string
func (AttributeMap) BottomPadding ¶
func (m AttributeMap) BottomPadding() int
func (AttributeMap) FontLayout ¶
func (m AttributeMap) FontLayout() TextLayout
func (AttributeMap) FontSize ¶
func (m AttributeMap) FontSize() TextSize
func (AttributeMap) Height ¶
func (m AttributeMap) Height() int
func (AttributeMap) Intangible ¶
func (m AttributeMap) Intangible() bool
func (AttributeMap) LeftPadding ¶
func (m AttributeMap) LeftPadding() int
func (AttributeMap) RightPadding ¶
func (m AttributeMap) RightPadding() int
func (AttributeMap) TopPadding ¶
func (m AttributeMap) TopPadding() int
func (AttributeMap) Twelfths ¶
func (m AttributeMap) Twelfths() int
func (AttributeMap) Valign ¶
func (m AttributeMap) Valign() string
func (AttributeMap) Width ¶
func (m AttributeMap) Width() int
func (AttributeMap) X ¶
func (m AttributeMap) X() int
func (AttributeMap) Y ¶
func (m AttributeMap) Y() int
type ButtonRenderInstruction ¶
type Element ¶
type Element struct { Type ElementType Attributes AttributeMap Children []*Element }
type ElementType ¶
type ElementType int
const ( UIElement ElementType = iota PanelElement PaddingElement ColumnElement TextElement ButtonElement ImageElement IfElement RangeElement )
func (ElementType) String ¶
func (i ElementType) String() string
type ImageRenderInstruction ¶
type Interactive ¶
Interactive tags Components that can be interacted with in some way. Trigger is a function that is provided the x,y coordinate of the click either in world or screen coordinates, depending on the Position of the Interactive.
type InteractiveRegion ¶
type InteractiveSystem ¶
type InteractiveSystem struct {
// contains filtered or unexported fields
}
InteractiveSystem pumps events through Interactives.
func NewInteractiveSystem ¶
func NewInteractiveSystem(mgr *ecs.World, bus *event.Bus) *InteractiveSystem
NewInteractiveSystem creates a new InteractiveSystem.
func (*InteractiveSystem) Handle ¶
func (is *InteractiveSystem) Handle(ev *Interact)
Handle an Interact event.
type PanelRenderInstruction ¶
type RenderInstruction ¶
type RenderInstruction interface { }
type TextLayout ¶
type TextLayout int
const ( TextLayoutLeft TextLayout = iota TextLayoutRight TextLayoutJustify TextLayoutCenter )
type TextRenderInstruction ¶
type TextRenderInstruction struct { Text string Size TextSize Bounds image.Rectangle Layout TextLayout }
type UI ¶
type UI struct { Doc *Element Data interface{} // contains filtered or unexported fields }
UI is a Component that represents a UI. The stutter is unfortunate ...
func NewUI ¶
NewUI construct a new UI Component from a declared XML template. You're responsible for assigning Data to the Component before rendering it.
func (*UI) RenderInstructions ¶
func (c *UI) RenderInstructions() []RenderInstruction
type UIInteract ¶
UIInteract happens when the player interacts with the game by clicking with the mouse or tapping on the screen.