Documentation ¶
Index ¶
- Constants
- Variables
- func AddSuffixes(unit Unit, suffixes ...string)
- func Collinear(a, b, c gfx.Coord) bool
- func Ease(delta float32, easing func(float32) float32) float32
- func InPolygon(polygon []gfx.Coord, pt gfx.Coord) bool
- func Length(dx, dy float32) float32
- func LengthSq(dx, dy float32) float32
- func Normal(vx, vy float32) (nx, ny, length float32)
- func NormalBetween(origin, point gfx.Coord) (nx, ny, length float32)
- func Override[V any](value V) *V
- type Alignment
- type Amount
- type AmountBounds
- type AmountContext
- type AmountCorners
- type AmountPoint
- type Anchor
- type Animation
- type AnimationEvent
- type AnimationFactory
- type AnimationState
- func (as *AnimationState) IsAnimating() bool
- func (as *AnimationState) PostProcess(base *Base, ctx *RenderContext, out *VertexBuffers)
- func (as *AnimationState) Set(a Animation, ev AnimationEvent)
- func (as *AnimationState) Stop(now bool)
- func (as *AnimationState) Update(base *Base, update Update) Dirty
- type Animations
- type Background
- type BackgroundColor
- type BackgroundImage
- type BackgroundLinearGradient
- type BackgroundRadialGradient
- type Base
- func (b *Base) AddChildren(children ...*Base)
- func (b *Base) AddStates(state State)
- func (b *Base) AnimationFor(ev AnimationEvent) AnimationFactory
- func (b *Base) AnimationNamed(name id.Identifier) AnimationFactory
- func (b *Base) ApplyTemplate(t *Template)
- func (b *Base) At(pt gfx.Coord) *Base
- func (b *Base) BringToFront()
- func (b *Base) ChildrenUpdated()
- func (b *Base) ClearListeners()
- func (b *Base) ComputeRenderContext() *RenderContext
- func (b *Base) CouldRender() bool
- func (b *Base) Dirty(dirty Dirty)
- func (b *Base) Edit(editor func(*Base)) *Base
- func (b *Base) GetColorable(t color.Themed) color.Able
- func (b *Base) GetDirty() Dirty
- func (b *Base) HasPostProcess() bool
- func (b *Base) Hide()
- func (b *Base) Init()
- func (b *Base) IsChild(c *Base) bool
- func (b *Base) IsChildOrSelf(c *Base) bool
- func (b Base) IsDisabled() bool
- func (b Base) IsDraggable() bool
- func (b *Base) IsDragging() bool
- func (b Base) IsDroppable() bool
- func (b Base) IsFocusable() bool
- func (b Base) IsHidden() bool
- func (b *Base) IsInside(pt gfx.Coord) bool
- func (b *Base) IsInvisible() bool
- func (b *Base) IsParent(p *Base) bool
- func (b *Base) IsParentOrSelf(p *Base) bool
- func (b *Base) IsRenderParent(child *Base) bool
- func (b Base) IsShown() bool
- func (b *Base) OnBlur(ev *Event)
- func (b *Base) OnDrag(ev *DragEvent)
- func (b *Base) OnFocus(ev *Event)
- func (b *Base) OnKey(ev *KeyEvent)
- func (b *Base) OnPointer(ev *PointerEvent)
- func (b *Base) Order() int
- func (b *Base) Parent() *Base
- func (b *Base) Place(ctx *RenderContext, parent Bounds, force bool)
- func (b *Base) PlaceMinHeight()
- func (b *Base) PlaceMinWidth()
- func (b *Base) PlaceWidth(width float32)
- func (b *Base) PlaceWidthFor(width float32, ctx *RenderContext)
- func (b *Base) Play(factory AnimationFactory) bool
- func (b *Base) PlayEvent(ev AnimationEvent) bool
- func (b *Base) PlayMaybe(name string) bool
- func (b *Base) PlayName(name id.Identifier) bool
- func (b *Base) PostProcess(ctx *RenderContext, out *VertexBuffers)
- func (b *Base) PreferredSize(ctx *RenderContext, maxWidth float32) gfx.Coord
- func (b *Base) Relayout()
- func (b *Base) Remove()
- func (b *Base) RemoveStates(state State)
- func (b *Base) Render(ctx *RenderContext, queue *VertexQueue)
- func (b *Base) Rerender()
- func (b *Base) SendToBack()
- func (b *Base) SetBounds(newBounds Bounds) bool
- func (b *Base) SetClip(clip Placement)
- func (b *Base) SetColor(color color.Modify)
- func (b *Base) SetDisabled(disabled bool)
- func (b *Base) SetOrder(order int)
- func (b *Base) SetPlacement(placement Placement)
- func (b *Base) SetRelativePlacement(placement Placement)
- func (b *Base) SetRenderParent(parent *Base)
- func (b *Base) SetState(state State)
- func (b *Base) SetTransform(transform Transform)
- func (b *Base) SetTransparency(transparency float32)
- func (b *Base) SetVisible(show bool)
- func (b *Base) Show()
- func (b *Base) ShownChildren() []*Base
- func (b *Base) UI() *UI
- func (b *Base) Update(update Update)
- type BaseGlyph
- type BasicAnimation
- func (a BasicAnimation) Copy() BasicAnimation
- func (a BasicAnimation) GetAnimation(b *Base) Animation
- func (a BasicAnimation) GetProps() BasicAnimationProp
- func (a BasicAnimation) IndexForTime(time float32) int
- func (a BasicAnimation) Init(base *Base)
- func (a BasicAnimation) IsDone(base *Base, animationTime float32) bool
- func (a BasicAnimation) Merge(b BasicAnimation) BasicAnimation
- func (a BasicAnimation) Only(props BasicAnimationProp) BasicAnimation
- func (a BasicAnimation) PostProcess(base *Base, animationTime float32, ctx *RenderContext, out *VertexBuffers)
- func (a BasicAnimation) PreLerpForTime(time float32) BasicAnimationFrame
- func (a BasicAnimation) Reverse() BasicAnimation
- func (a BasicAnimation) Update(base *Base, animationTime float32, update Update) Dirty
- func (a BasicAnimation) WithDuration(duration float32) BasicAnimation
- func (a BasicAnimation) WithEasing(easing ease.Easing) BasicAnimation
- func (a BasicAnimation) WithNoSave() BasicAnimation
- func (a BasicAnimation) WithSave(save, skipColor, skipTransparent, skipTransform bool) BasicAnimation
- func (a BasicAnimation) Without(props BasicAnimationProp) BasicAnimation
- type BasicAnimationFrame
- type BasicAnimationFrameInterpolated
- type BasicAnimationProp
- type BasicTextAnimation
- func (a *BasicTextAnimation) EasedTime(time float32) float32
- func (a BasicTextAnimation) GetAnimation(text *RenderedText) TextAnimation
- func (a *BasicTextAnimation) GetStates(text *RenderedText) []BasicTextAnimationState
- func (a *BasicTextAnimation) Init(base *Base)
- func (a *BasicTextAnimation) IsDone(base *Base, animationTime float32) bool
- func (a *BasicTextAnimation) Render(b *Base, animationTime float32, bounds Bounds, ctx *RenderContext, ...)
- func (a *BasicTextAnimation) Update(b *Base, animationTime float32, update Update) Dirty
- func (a *BasicTextAnimation) ValueAt(time float32) (state int, value int, timeInValue float32)
- type BasicTextAnimationKind
- type BasicTextAnimationSettings
- type BasicTextAnimationState
- type Bounds
- func (b Bounds) Add(a Bounds) Bounds
- func (b Bounds) Center() (float32, float32)
- func (b *Bounds) Clear()
- func (b Bounds) ClipCoord(c gfx.Coord) gfx.Coord
- func (b Bounds) ClipLine(x0, y0, x1, y1 float32) ClippedLine
- func (b Bounds) Closest(x, y float32) (float32, float32)
- func (b Bounds) ClosestCoord(c gfx.Coord) gfx.Coord
- func (b Bounds) Contains(a Bounds) bool
- func (b Bounds) Delta(x, y float32) (float32, float32)
- func (b Bounds) Dimensions() (float32, float32)
- func (b Bounds) Dx(x float32) float32
- func (b Bounds) Dy(y float32) float32
- func (b Bounds) Expand(a Bounds) Bounds
- func (b Bounds) Height() float32
- func (b *Bounds) Include(x, y float32)
- func (b Bounds) Inside(x, y float32) bool
- func (b Bounds) InsideCoord(c gfx.Coord) bool
- func (b Bounds) Intersects(a Bounds) bool
- func (b Bounds) IsEmpty() bool
- func (b Bounds) IsNegative() bool
- func (b Bounds) IsPositive() bool
- func (b Bounds) IsUniform() bool
- func (b Bounds) IsZero() bool
- func (b Bounds) Lerp(x, y float32) (float32, float32)
- func (b Bounds) Lerpx(dx float32) float32
- func (b Bounds) Lerpy(dy float32) float32
- func (b Bounds) Scale(s float32) Bounds
- func (b Bounds) Side(x, y float32) BoundsSide
- func (b Bounds) SideInside(x, y float32, side BoundsSide) bool
- func (b Bounds) SideIntersect(x0, y0, x1, y1 float32, side BoundsSide) (x, y, delta float32)
- func (b Bounds) Size() gfx.Coord
- func (b Bounds) String() string
- func (b Bounds) Sub(a Bounds) Bounds
- func (b *Bounds) Translate(x, y float32)
- func (b Bounds) Union(a Bounds) Bounds
- func (b Bounds) Width() float32
- type BoundsSide
- type CanStop
- type ClipShow
- type ClippedLine
- type ComponentMap
- func (cm *ComponentMap) Add(c *Base)
- func (cm *ComponentMap) AddLineage(c *Base)
- func (cm *ComponentMap) AddMany(c []*Base)
- func (old ComponentMap) Compare(new ComponentMap) (inOld []*Base, inBoth []*Base, inNew []*Base)
- func (cm ComponentMap) Components() []*Base
- func (cm ComponentMap) Has(c *Base) bool
- type CursorEvent
- type Cursors
- type Dirty
- type DragEvent
- type DragEventType
- type Event
- type Events
- type ExtentTile
- type Flags
- func (f *Flags) Add(other Flags)
- func (f Flags) All(other Flags) bool
- func (f Flags) Any() bool
- func (f *Flags) Clear()
- func (f Flags) Exactly(other Flags) bool
- func (f Flags) Is(other Flags) bool
- func (f Flags) None() bool
- func (f Flags) Not(other Flags) bool
- func (f Flags) NotAll(other Flags) bool
- func (f *Flags) Remove(other Flags)
- func (f *Flags) Removed(other Flags) bool
- func (f *Flags) Take() Flags
- func (f Flags) WithAdd(other Flags) Flags
- func (f Flags) WithRemove(other Flags) Flags
- type Font
- type FontRune
- type Glyph
- type GlyphState
- type GlyphVisibility
- type HasCursor
- type HookBase
- type HookPlace
- type HookRender
- type HookUpdate
- type Hooks
- type IndexIterator
- type KeyEvent
- type KeyEventType
- type Layer
- func (l Layer) ComputeRenderContext(b *Base) *RenderContext
- func (l Layer) ForStates(s State) bool
- func (l *Layer) Init(b *Base)
- func (l *Layer) Place(b *Base, parent Bounds)
- func (l Layer) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32) gfx.Coord
- func (l Layer) Render(b *Base, ctx *RenderContext, out *VertexBuffers)
- func (l *Layer) Update(b *Base, update Update) Dirty
- type Layout
- type LayoutColumn
- type LayoutData
- func (ld LayoutData) WithEnforcePreferredSize(enforce bool) LayoutData
- func (ld LayoutData) WithFullHeight(fullHeight bool) LayoutData
- func (ld LayoutData) WithFullWidth(fullWidth bool) LayoutData
- func (ld LayoutData) WithHeightWeight(heightWeight float32) LayoutData
- func (ld LayoutData) WithHorizontalAlignment(alignment Alignment) LayoutData
- func (ld LayoutData) WithKeepInside(keepInside bool) LayoutData
- func (ld LayoutData) WithKeepInsideForgetSize(forgetSize bool) LayoutData
- func (ld LayoutData) WithKeepInsideIgnoreMargins(ignoreMargins bool) LayoutData
- func (ld LayoutData) WithVerticalAlignment(alignment Alignment) LayoutData
- func (ld LayoutData) WithWidthWeight(widthWeight float32) LayoutData
- type LayoutGrid
- type LayoutGridColumn
- type LayoutGridRow
- type LayoutInline
- type LayoutRow
- type LayoutSizing
- type LayoutSizings
- type LayoutStatic
- type Layoutable
- type Listener
- type Paragraph
- func (paragraph Paragraph) GetLineHeight(ctx *RenderContext, style *ParagraphStyles, actualLineHeight float32) float32
- func (paragraph Paragraph) GetStates(ctx *RenderContext, style *ParagraphStyles) []GlyphState
- func (paragraph Paragraph) Measure(ctx *RenderContext, paragraphs Paragraphs) gfx.Coord
- func (paragraph Paragraph) MinWidth(ctx *RenderContext, keepEmpty bool) float32
- func (paragraph Paragraph) Render(ctx *RenderContext, paragraphs Paragraphs, b *Base) RenderedText
- func (paragraph Paragraph) String() string
- type ParagraphStyles
- type ParagraphStylesOverride
- type Paragraphs
- func (paragraphs Paragraphs) Measure(ctx *RenderContext) gfx.Coord
- func (paragraphs Paragraphs) MinWidth(ctx *RenderContext) float32
- func (paragraphs Paragraphs) Render(ctx *RenderContext, b *Base) RenderedText
- func (paragraphs Paragraphs) String() string
- func (paragraphs Paragraphs) ToString(paragraphSeparator string) string
- func (paragraphs Paragraphs) Wrap(lineWidth float32) bool
- type ParagraphsStyles
- type ParagraphsStylesOverride
- type Placement
- func (p Placement) Attach(dx float32, dy float32, width float32, height float32) Placement
- func (p Placement) BottomFixedHeight(bottomOffset float32, height float32, leftOffset float32, rightOffset float32) Placement
- func (p Placement) Center(width float32, height float32) Placement
- func (p Placement) Contains(x float32, y float32, parentWidth float32, parentHeight float32) bool
- func (p Placement) Defined() bool
- func (p Placement) FitInside(width, height float32, keepSize bool) Placement
- func (p Placement) GetBounds(parentWidth float32, parentHeight float32) Bounds
- func (p Placement) GetBoundsIn(parent Bounds) Bounds
- func (p *Placement) GetBoundsi(parentWidth float32, parentHeight float32) geom.Bounds2i
- func (p Placement) GetHeight(parentHeight float32) float32
- func (p Placement) GetMinHeight(parentHeight float32, minHeight float32) float32
- func (p Placement) GetMinWidth(parentWidth float32, minWidth float32) float32
- func (p Placement) GetWidth(parentWidth float32) float32
- func (p Placement) Grow(amount float32) Placement
- func (p *Placement) Init(defaultPlacement Placement)
- func (p Placement) IsMaximized() bool
- func (p Placement) LeftFixedWidth(leftOffset float32, width float32, topOffset float32, bottomOffset float32) Placement
- func (p Placement) Maximize() Placement
- func (p Placement) MinParentHeight() float32
- func (p Placement) MinParentSize() gfx.Coord
- func (p Placement) MinParentWidth() float32
- func (p Placement) Padded(padding Bounds) Placement
- func (p Placement) Padding() gfx.Coord
- func (p Placement) ParentHeight(minHeight float32) float32
- func (p Placement) ParentSize(minWidth, minHeight float32) gfx.Coord
- func (p Placement) ParentWidth(minWidth float32) float32
- func (p Placement) PreferredHeight() float32
- func (p Placement) PreferredWidth() float32
- func (p Placement) Relative(leftAnchor float32, topAnchor float32, rightAnchor float32, ...) Placement
- func (p Placement) RightFixedWidth(rightOffset float32, width float32, topOffset float32, bottomOffset float32) Placement
- func (p Placement) Shift(dx, dy float32) Placement
- func (p Placement) Shrink(amount float32) Placement
- func (p Placement) TopFixedHeight(topOffset float32, height float32, leftOffset float32, rightOffset float32) Placement
- func (p Placement) WithBottom(bottom, parentHeight float32) Placement
- func (p Placement) WithHeight(height float32) Placement
- func (p Placement) WithHeightRelative(height, parentHeight float32) Placement
- func (p Placement) WithLeft(left, parentWidth float32) Placement
- func (p Placement) WithRight(right, parentWidth float32) Placement
- func (p Placement) WithSize(width, height float32) Placement
- func (p Placement) WithSizeRelative(width, height, parentWidth, parentHeight float32) Placement
- func (p Placement) WithTop(top, parentHeight float32) Placement
- func (p Placement) WithWidth(width float32) Placement
- func (p Placement) WithWidthRelative(width, parentWidth float32) Placement
- type PlacementAnimation
- func (a PlacementAnimation) GetAnimation(base *Base) Animation
- func (a *PlacementAnimation) Init(base *Base)
- func (a *PlacementAnimation) IsDone(base *Base, animationTime float32) bool
- func (a *PlacementAnimation) PostProcess(base *Base, animationTime float32, ctx *RenderContext, out *VertexBuffers)
- func (a *PlacementAnimation) Update(base *Base, animationTime float32, update Update) Dirty
- type PointerButtons
- type PointerEvent
- type PointerEventType
- type PostProcess
- type RenderContext
- func (ctx *RenderContext) WithAmountContext(amt *AmountContext) *RenderContext
- func (ctx *RenderContext) WithBounds(parent Bounds) *RenderContext
- func (ctx *RenderContext) WithBoundsAndTextStyles(parent Bounds, styles *TextStylesOverride) *RenderContext
- func (ctx *RenderContext) WithParent(width, height float32) *RenderContext
- func (ctx *RenderContext) WithTextStyles(styles *TextStyles) *RenderContext
- type RenderedGlyph
- type RenderedText
- type Shape
- type ShapePolygon
- type ShapeRectangle
- type ShapeRounded
- type ShapeSharpen
- type State
- type StateFn
- type Template
- type TextAnimation
- type TextAnimationFactory
- type TextStyles
- type TextStylesOverride
- type TextWrap
- type Theme
- type Transform
- func (t *Transform) Determinant() float32
- func (t *Transform) GetDegrees() float32
- func (t *Transform) GetInvert() Transform
- func (t *Transform) GetRadians() float32
- func (t *Transform) GetScale() (x, y float32)
- func (t *Transform) GetTranslate() (float32, float32)
- func (t Transform) HasAffect() bool
- func (t *Transform) Identity()
- func (t *Transform) Invert()
- func (t Transform) IsEffectivelyIdentity() bool
- func (t Transform) IsIdentity() bool
- func (t Transform) IsZero() bool
- func (t *Transform) Multiply(b Transform)
- func (t *Transform) PreScale(sx, sy float32)
- func (t *Transform) PreTranslate(tx, ty float32)
- func (t *Transform) Rotate(radians float32)
- func (t *Transform) RotateDegrees(degrees float32)
- func (t *Transform) Scale(sx, sy float32)
- func (t *Transform) Set(sx, ry, rx, sy, tx, ty float32)
- func (t *Transform) SetRotate(radians float32)
- func (t *Transform) SetRotateAround(radians, anchorX, anchorY float32)
- func (t *Transform) SetRotateDegrees(degrees float32)
- func (t *Transform) SetRotateDegreesAround(radians, anchorX, anchorY float32)
- func (t *Transform) SetRotateDegreesScaleAround(degrees, scaleX, scaleY, anchorX, anchorY float32)
- func (t *Transform) SetRotateScaleAround(radians, scaleX, scaleY, anchorX, anchorY float32)
- func (t *Transform) SetScale(sx, sy float32)
- func (t *Transform) SetScaleAround(sx, sy, anchorX, anchorY float32)
- func (t *Transform) SetShear(sx, sy float32)
- func (t *Transform) SetShearAround(sx, sy, anchorX, anchorY float32)
- func (t *Transform) SetTranslate(tx, ty float32)
- func (t *Transform) Shear(sx, sy float32)
- func (t *Transform) Transform(x, y float32) (float32, float32)
- func (t *Transform) TransformCoord(c gfx.Coord) gfx.Coord
- func (t *Transform) TransformVector(vx, vy float32) (float32, float32)
- func (t *Transform) TransformVectorCoord(v gfx.Coord) gfx.Coord
- func (t *Transform) Translate(tx, ty float32)
- type UI
- func (ui *UI) GetCursor() (cursorVertex []Vertex)
- func (ui *UI) Init()
- func (ui *UI) IsPointerOver() bool
- func (ui *UI) NeedsRender() bool
- func (ui *UI) Place(newBounds Bounds)
- func (ui *UI) ProcessKeyEvent(ev KeyEvent) error
- func (ui *UI) ProcessPointerEvent(ev PointerEvent) error
- func (ui *UI) Render(queue *VertexQueue)
- func (ui *UI) RenderContext() *RenderContext
- func (ui *UI) SetContext(ctx *AmountContext)
- func (ui *UI) Update(update Update)
- type Unit
- type UnitContext
- type Update
- type Vertex
- type VertexBuffer
- func (b *VertexBuffer) AddLine() []Vertex
- func (b *VertexBuffer) AddQuad() []Vertex
- func (b *VertexBuffer) AddReservedLine(v0, v1 Vertex)
- func (b *VertexBuffer) AddReservedQuad(v0, v1, v2, v3 Vertex)
- func (b *VertexBuffer) AddReservedTriangle(v0, v1, v2 Vertex)
- func (b *VertexBuffer) AddTriangle() []Vertex
- func (b *VertexBuffer) Clear()
- func (b *VertexBuffer) Clip(bounds Bounds, out *VertexBuffer)
- func (b *VertexBuffer) ClipCompatible(vb *VertexBuffer) bool
- func (b *VertexBuffer) CloneTo(out *VertexBuffer) *VertexBuffer
- func (b *VertexBuffer) Compatible(vb *VertexBuffer) bool
- func (b VertexBuffer) Empty() bool
- func (b *VertexBuffer) GetReservedLine() (data []Vertex)
- func (b *VertexBuffer) GetReservedQuad() (data []Vertex)
- func (b *VertexBuffer) GetReservedTriangle() (data []Vertex)
- func (b *VertexBuffer) Init(capacity int)
- func (b VertexBuffer) Remaining() int
- func (b *VertexBuffer) ReserveLines(lines int)
- func (b *VertexBuffer) ReserveQuads(quads int)
- func (b *VertexBuffer) ReserveTriangles(triangles int)
- type VertexBuffers
- func (vbs *VertexBuffers) Clip(bounds Bounds, render func(clippable *VertexBuffers))
- func (clipped *VertexBuffers) ClipInto(bounds Bounds, source VertexIterable)
- func (vbs *VertexBuffers) CloneTo(target *VertexBuffers)
- func (vbs *VertexBuffers) Get(primitive gfx.Primitive, blend gfx.Blend) *VertexBuffer
- func (vbs *VertexBuffers) NewLike() *VertexBuffers
- func (vbs *VertexBuffers) With(primitive gfx.Primitive, blend gfx.Blend, render func(out *VertexBuffers))
- type VertexIterable
- type VertexIterator
- type VertexModifier
- type VertexQueue
- type Visual
- type VisualBorderScale
- type VisualBordered
- type VisualFilled
- type VisualFrame
- type VisualShadow
- type VisualText
- func (s *VisualText) Clipped() *VisualText
- func (s *VisualText) Dirty() *VisualText
- func (s *VisualText) Init(b *Base)
- func (s *VisualText) Play(factory TextAnimationFactory) *VisualText
- func (s VisualText) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32) gfx.Coord
- func (s VisualText) Rendered() RenderedText
- func (s VisualText) RenderedBounds() Bounds
- func (s *VisualText) SetParagraphs(para Paragraphs) *VisualText
- func (s *VisualText) SetText(text string) *VisualText
- func (s *VisualText) Stop() *VisualText
- func (s *VisualText) Update(b *Base, update Update) Dirty
- func (s *VisualText) Visibility(threshold GlyphVisibility) *VisualText
- func (s *VisualText) Visualize(b *Base, bounds Bounds, ctx *RenderContext, out *VertexBuffers)
- func (s *VisualText) WillClip() bool
Constants ¶
const ( MeasureWidthRoundingError = 0.001 MeasureHeightRoundingError = 0.001 )
const (
LayoutGridWidthRoundingError = 0.001
)
Variables ¶
var ( BufferPoolCreate = func() *VertexBuffers { return NewVertexBuffers(BufferCapacity, Buffers) } ClipPoolCreate = func() *VertexBuffers { return NewVertexBuffers(ClipCapacity, Buffers) } BufferPoolQueueCreate = func() *VertexQueue { return NewVertexQueue(BufferQueueCapacity) } BufferPoolReset = func(vbs *VertexBuffers) *VertexBuffers { vbs.Clear() return vbs } BufferPoolQueueReset = func(vbs *VertexQueue) *VertexQueue { vbs.Clear() return vbs } BufferPoolSize = 256 BufferCapacity = 64 ClipPoolSize = 24 ClipCapacity = 1024 BufferQueueCapacity = 12 BufferQueuePoolSize = 256 Buffers = 1 BufferPool = ds.NewPool(BufferPoolSize, BufferPoolCreate, BufferPoolReset) BufferQueuePool = ds.NewPool(BufferQueuePoolSize, BufferPoolQueueCreate, BufferPoolQueueReset) ClipPool = ds.NewPool(ClipPoolSize, ClipPoolCreate, BufferPoolReset) ClipMemory = ds.NewStack[*VertexBuffers](32) )
var AmountFormatRegex = regexp.MustCompile(`^([+-]?\d*(\.\d+)?)((%)?[a-zA-Z]*)$`)
var Area = id.NewArea[uint32, uint16]( id.WithCapacity(1024), id.WithResizeBuffer(24), )
var ShapeRoundedAngles = [][]float32{{math.Pi, math.Pi * 0.5}, {math.Pi * 0.5, 0}, {math.Pi * 2, math.Pi * 1.5}, {math.Pi * 1.5, math.Pi}}
var ShapeRoundedPlacements = [][]float32{{0, 0}, {1, 0}, {1, 1}, {0, 1}} // 0=1, 1=-1 *2 (0,2) -1 (-1,1)
var TextFormatRegex = regexp.MustCompile(`\\{|\{([^:}]+):?([^}]*)\}|.|\s`)
var TextMeasureErrorAmount float32 = 5
Functions ¶
func AddSuffixes ¶
func NormalBetween ¶
Computes the normal between an origin and a point and returns the length as well.
Types ¶
type Alignment ¶
type Alignment float32
func (Alignment) MarshalText ¶
func (*Alignment) UnmarshalText ¶
type AmountBounds ¶
func NewAmountBounds ¶
func NewAmountBounds(left, top, right, bottom float32) AmountBounds
func NewAmountBoundsUniform ¶
func NewAmountBoundsUniform(value float32, unit Unit) AmountBounds
func NewAmountBoundsUnit ¶
func NewAmountBoundsUnit(left, top, right, bottom float32, unit Unit) AmountBounds
func (AmountBounds) GetBounds ¶
func (a AmountBounds) GetBounds(ctx *AmountContext) Bounds
func (AmountBounds) IsZero ¶
func (a AmountBounds) IsZero() bool
func (*AmountBounds) Set ¶
func (a *AmountBounds) Set(value float32, unit Unit)
func (*AmountBounds) SetAmount ¶
func (a *AmountBounds) SetAmount(amount Amount)
func (AmountBounds) WithAmount ¶
func (a AmountBounds) WithAmount(amount Amount) AmountBounds
type AmountContext ¶
type AmountContext struct { Parent UnitContext FontSize float32 View UnitContext Window UnitContext Screen UnitContext }
func (*AmountContext) ForFont ¶
func (c *AmountContext) ForFont(font Amount) *AmountContext
func (AmountContext) GetScalar ¶
func (c AmountContext) GetScalar(unit Unit, widthRelative bool) float32
func (*AmountContext) IsSameSize ¶
func (c *AmountContext) IsSameSize(width, height float32, fontSize Amount) bool
func (*AmountContext) Resize ¶
func (c *AmountContext) Resize(width, height float32, fontSize Amount) *AmountContext
type AmountCorners ¶
func NewAmountCorners ¶
func NewAmountCorners(topLeft, topRight, bottomRight, bottomLeft float32) AmountCorners
func NewAmountCornersUniform ¶
func NewAmountCornersUniform(value float32, unit Unit) AmountCorners
func NewAmountCornersUnit ¶
func NewAmountCornersUnit(topLeft, topRight, bottomRight, bottomLeft float32, unit Unit) AmountCorners
func (*AmountCorners) Set ¶
func (a *AmountCorners) Set(value float32, unit Unit)
type AmountPoint ¶
func NewAmountPoint ¶
func NewAmountPoint(x, y float32) AmountPoint
func NewAmountPointParent ¶
func NewAmountPointParent(x, y float32) AmountPoint
func NewAmountPointUnit ¶
func NewAmountPointUnit(x, y float32, unit Unit) AmountPoint
func (AmountPoint) Get ¶
func (a AmountPoint) Get(ctx *AmountContext) (float32, float32)
func (AmountPoint) IsZero ¶
func (a AmountPoint) IsZero() bool
func (AmountPoint) Lerp ¶
func (start AmountPoint) Lerp(end AmountPoint, delta float32) AmountPoint
func (*AmountPoint) Set ¶
func (a *AmountPoint) Set(value float32, unit Unit)
type Anchor ¶
func (*Anchor) SetRelative ¶
type AnimationEvent ¶
type AnimationEvent uint
const ( AnimationEventNone AnimationEvent = iota AnimationEventShow AnimationEventHide AnimationEventRemove AnimationEventFocus AnimationEventBlur AnimationEventPointerEnter AnimationEventPointerLeave AnimationEventPointerDown AnimationEventPointerUp AnimationEventDragStart AnimationEventDragStop AnimationEventDragCancel AnimationEventDragEnter AnimationEventDrop AnimationEventDisabled AnimationEventEnabled )
type AnimationFactory ¶
type AnimationState ¶
type AnimationState struct { Current Animation CurrentTime float32 CurrentEvent AnimationEvent // contains filtered or unexported fields }
func (*AnimationState) IsAnimating ¶
func (as *AnimationState) IsAnimating() bool
func (*AnimationState) PostProcess ¶
func (as *AnimationState) PostProcess(base *Base, ctx *RenderContext, out *VertexBuffers)
func (*AnimationState) Set ¶
func (as *AnimationState) Set(a Animation, ev AnimationEvent)
func (*AnimationState) Stop ¶
func (as *AnimationState) Stop(now bool)
type Animations ¶
type Animations struct { ForEvent ds.EnumMap[AnimationEvent, AnimationFactory] Named id.DenseKeyMap[AnimationFactory, uint16, uint8] }
func (*Animations) Merge ¶
func (a *Animations) Merge(other *Animations, replace bool)
type Background ¶
type BackgroundColor ¶
func (BackgroundColor) Backgroundify ¶
func (bc BackgroundColor) Backgroundify(b *Base, bounds Bounds, ctx *RenderContext, out *Vertex)
func (BackgroundColor) Init ¶
func (bc BackgroundColor) Init(b *Base)
type BackgroundImage ¶
func (BackgroundImage) Backgroundify ¶
func (bi BackgroundImage) Backgroundify(b *Base, bounds Bounds, ctx *RenderContext, out *Vertex)
func (BackgroundImage) Init ¶
func (bi BackgroundImage) Init(b *Base)
type BackgroundLinearGradient ¶
type BackgroundLinearGradient struct { StartColor color.Able Start gfx.Coord EndColor color.Able End gfx.Coord }
func (BackgroundLinearGradient) Backgroundify ¶
func (bg BackgroundLinearGradient) Backgroundify(b *Base, bounds Bounds, ctx *RenderContext, out *Vertex)
func (BackgroundLinearGradient) Init ¶
func (bc BackgroundLinearGradient) Init(b *Base)
type BackgroundRadialGradient ¶
type BackgroundRadialGradient struct { InnerColor color.Able OuterColor color.Able Radius AmountPoint Offset AmountPoint }
func (BackgroundRadialGradient) Backgroundify ¶
func (bg BackgroundRadialGradient) Backgroundify(b *Base, bounds Bounds, ctx *RenderContext, out *Vertex)
func (BackgroundRadialGradient) Init ¶
func (bg BackgroundRadialGradient) Init(b *Base)
type Base ¶
type Base struct { Name id.Identifier Layers []Layer Placement Placement RelativePlacement Placement Bounds Bounds Children []*Base ChildrenOrderless bool Focusable bool Draggable bool Droppable bool Events Events States State Clip Placement Transform Transform TextStyles *TextStylesOverride Shape Shape OverShape []gfx.Coord Transparency float32 Color color.Modify Animation AnimationState Animations *Animations Cursors Cursors Hooks Hooks Colors color.Colors Margin AmountBounds MinSize AmountPoint MaxSize AmountPoint Layout Layout LayoutData LayoutData IgnoreLayoutPreferredWidth bool IgnoreLayoutPreferredHeight bool // contains filtered or unexported fields }
The Base UI component.
func (*Base) AddChildren ¶
Adds the given children to this parent and initializes them. This will dirty this component and all parents.
func (*Base) AddStates ¶
Adds the given states to the component. See SetState. This operation has no effect if the state is unchanged.
func (*Base) AnimationFor ¶
func (b *Base) AnimationFor(ev AnimationEvent) AnimationFactory
func (*Base) AnimationNamed ¶
func (b *Base) AnimationNamed(name id.Identifier) AnimationFactory
func (*Base) ApplyTemplate ¶
Applies the template to this component, anywhere it appears an option is defined on the template but not the component.
func (*Base) At ¶
Returns the component at the given point within this component. If a TransparencyThreshold is defined on the UI and this component is too transparent it is considered invisible to pointer events. If the UI is configured to transform the pointer to the relative orientation of this component then the coordinate is passed through the inverse transform of this component before further inspection is done. If the point is not within the Bounds or OverShape of this component then nil is returned. Otherwise all ShownChildren are inspected using the same logic as above and the first one to return a non-nil value is returned.
func (*Base) BringToFront ¶
func (b *Base) BringToFront()
Sets this component to be the last one rendered in it's render parent.
func (*Base) ChildrenUpdated ¶
func (b *Base) ChildrenUpdated()
Marks the children as updated and they required placement and visual updates.
func (*Base) ClearListeners ¶
func (b *Base) ClearListeners()
Removes all listeners (init, place, update, render, remove, post processes, events) from this component.
func (*Base) ComputeRenderContext ¶
func (b *Base) ComputeRenderContext() *RenderContext
Computes the render context for this component looking up through the parents to get the effective text styles and relative to the bounds of this component.
func (*Base) CouldRender ¶
Returns whether a component could render based on its invisible, animation, and hidden states.
func (*Base) GetColorable ¶
Gets the color if any for the themed color.
func (*Base) HasPostProcess ¶
Returns whether a component has a post processing function that needs to be applied.
func (*Base) Hide ¶
func (b *Base) Hide()
Hides the component if it's not already hiding or hidden. If a hide animation is defined the animation will play out before the component is hidden and effectively removed from it's render parent's layout.
func (*Base) Init ¶
func (b *Base) Init()
Initializes the state of the component. Before this is done it is expected that the component has been set on a UI and/or has a parent component. This should only be called when the UI is first initialized or on a child component that is added or removed.
func (*Base) IsChildOrSelf ¶
If the component is a child to this component or is this component.
func (Base) IsDisabled ¶
Returns whether this component is any disabled states.
func (Base) IsDraggable ¶
Returns whether this component is draggable. It must be marked draggable and it cannot be in a state where it doesn't receive input events.
func (*Base) IsDragging ¶
Returns if this component is the one currently being drug.
func (Base) IsDroppable ¶
Returns whether this component is droppable. It must be marked droppable and it cannot be in a state where it doesn't receive input events.
func (Base) IsFocusable ¶
Returns whether this component is focusable. It must be marked focusable and it cannot be in a state where it doesn't receive input events.
func (Base) IsHidden ¶
Returns if this component is considered hidden. It is only hidden when hiding is done and it's not trying to show.
func (*Base) IsInside ¶
Returns true if the point is inside the Bounds of this component. The point is expected to be transformed to the relative orientation of this component. If an OverShape is defined then point-in-polygon logic is used to determine inside-ness.
func (*Base) IsInvisible ¶
Returns whether this component is invisible based on its transparency or color.
func (*Base) IsParentOrSelf ¶
If the component is a parent to this component or is this component.
func (*Base) IsRenderParent ¶
Returns true if this component is the render parent to the given component.
func (Base) IsShown ¶
Returns if this component is considered shown (not hidden). It may be in the process of showing or hiding and still be considered shown.
func (*Base) OnDrag ¶
Handles a drag or drop event. Updates state and plays any necessary animations.
func (*Base) OnKey ¶
Handles a key event. This is only invoked when this component or one of its children are focused.
func (*Base) OnPointer ¶
func (b *Base) OnPointer(ev *PointerEvent)
Handles a pointer event. This is only invoked when the pointer is over this component or one of it's children. Updates state, plays any necessary animations, and can update the cursor.
func (*Base) Order ¶
Returns index this component is in it's render parent's children. Any hidden components in the parent are not adjusted for to maintain consistent ordering.
func (*Base) Place ¶
func (b *Base) Place(ctx *RenderContext, parent Bounds, force bool)
Places this component within the given bounds. If the component does not have any dirty placements this may have no effect unless force is passed with true which will cause all components in the tree to be placed. The context is expected to have the size that matches the dimensions of the parent bounds passed.
func (*Base) PlaceMinHeight ¶
func (b *Base) PlaceMinHeight()
Updates the components placement to be the smallest height possible for the current width and the given render context.
func (*Base) PlaceMinWidth ¶
func (b *Base) PlaceMinWidth()
Updates the components placement to be the smallest width possible.
func (*Base) PlaceWidth ¶
Updates the components placement to be the desired width if possible.
func (*Base) PlaceWidthFor ¶
func (b *Base) PlaceWidthFor(width float32, ctx *RenderContext)
Updates the components placement to be the desired width if possible for the given render context.
func (*Base) Play ¶
func (b *Base) Play(factory AnimationFactory) bool
func (*Base) PlayEvent ¶
func (b *Base) PlayEvent(ev AnimationEvent) bool
func (*Base) PostProcess ¶
func (b *Base) PostProcess(ctx *RenderContext, out *VertexBuffers)
Performs the post processing that's defined on this component to the given vertex buffers.
func (*Base) PreferredSize ¶
func (b *Base) PreferredSize(ctx *RenderContext, maxWidth float32) gfx.Coord
PreferredSize computes the preferred size possibly given a width we are fitting this component into. If maxWidth = 0 then the preferred size return will present one with a minimum possible width.
func (*Base) Relayout ¶
func (b *Base) Relayout()
Marks the component's layout as dirty so its children are layed out next placement.
func (*Base) Remove ¶
func (b *Base) Remove()
Removes the component if it's not already removed or removing. If a remove animation is defined the animation will play out before the component is actually removed from the parent & render parent. On removal much of the cached state of the component is freed until the component is Init again by a new parent.
func (*Base) RemoveStates ¶
Removes the given states from the component. See SetState. This operation has no effect if the state is unchanged.
func (*Base) Render ¶
func (b *Base) Render(ctx *RenderContext, queue *VertexQueue)
Renders a component and adds all buffers to the given queue. If the component is not visible this returns immediately. This will use cached buffers if possible, otherwise they may need to be regenerated. If this component has any post processing then the vertices applied to the queue by this component are cloned and post processing is applied to the clones to preserve the cached state.
func (*Base) Rerender ¶
func (b *Base) Rerender()
Marks the component as visually dirty (layers, children, & post processing) so it's rendered on next render.
func (*Base) SendToBack ¶
func (b *Base) SendToBack()
Sets this component to be the first one rendered in it's render parent.
func (*Base) SetBounds ¶
Sets the bounds of the component. If the bounds are different then each layer is placed with the new bounds. If the component does not currently have a dirty placement it is added. The component is also marked visually dirty. Returns whether the bounds have changed.
func (*Base) SetClip ¶
Sets the clip placement of the children and marks the child placement as dirty if the placement is different. All parents are notified they have a dirty child placement.
func (*Base) SetColor ¶
Sets the color modification function that's applied to all vertices of this component and marks the post processing as dirty if the modification function appears to be different. All parents are notified they have a dirty child visual.
func (*Base) SetDisabled ¶
Sets the disabled state of this component. Any associated disabled or enabled animations will be played if there is a change in state.
func (*Base) SetOrder ¶
Sets the index this component is in it's render parent's children. Any hidden components in the parent are not adjusted for to maintain consistent ordering.
func (*Base) SetPlacement ¶
Sets the placement of the component and marks the placement as dirty if the placement is different. All parents are notified they have a dirty child placement.
func (*Base) SetRelativePlacement ¶
Sets the relative placement of the component and marks the placement as dirty if the placement is different. All parents are notified they have a dirty child placement.
func (*Base) SetRenderParent ¶
Changes the render parent of this component. You can have a component exist in one tree which decides its initial placement but actually be considered outside its parent and rendered under another. The ordering, final layout, and rendering is done by the render parent. You can pass nil to this to reset it back to the parent and remove from the current render parent.
func (*Base) SetState ¶
Sets the state of the component. If no state is given the default state is applied. If the component is not visually dirty the state change is checked against the layers and if any of the layers is shown/hidden based on the state change the component is marked visually dirty. If post processing exists for the new state the component is marked dirty for post processing.
func (*Base) SetTransform ¶
Sets the transform of the component and marks the post processing as dirty if the transform is different. All parents are notified they have a dirty child visual.
func (*Base) SetTransparency ¶
Sets the transparency of the component and marks the post processing as dirty if the transparency is different. All parents are notified they have a dirty child visual.
func (*Base) SetVisible ¶
Sets the visibility of this component to either show or hide. See Show & Hide.
func (*Base) Show ¶
func (b *Base) Show()
Shows the component if it's not already shown or showing. If a show animation is defined the animation will play out before the component is considered shown and can be interacted with. As soon as the showing process begins it's effectively added back to its render parent in the same position it previously was in it's layout.
func (*Base) ShownChildren ¶
Returns the children that are rendered by this component.
func (*Base) Update ¶
Updates the component. This includes it's layers, children, animation, and hooks. Each can return a dirty state which is applied to the component. A child is only updated by its parent, never by its render parent. If the component is hidden and UI.UpdateHidden is false then this has no effect. A component that is playing a hide, show, or remove animation needs to be updated to complete the desired action.
type BaseGlyph ¶
type BaseGlyph struct { Text rune Font id.Identifier Size Amount Color color.Color // contains filtered or unexported fields }
func (*BaseGlyph) GetState ¶
func (g *BaseGlyph) GetState(ctx *RenderContext, wrap TextWrap, prev Glyph) GlyphState
func (*BaseGlyph) Render ¶
func (g *BaseGlyph) Render(ctx *RenderContext, topLeft gfx.Coord, b *Base) RenderedGlyph
type BasicAnimation ¶
type BasicAnimation struct { Duration float32 Easing ease.Easing Save bool SaveSkipColor bool SaveSkipTransparency bool SaveSkipTransform bool Frames []BasicAnimationFrame }
func (BasicAnimation) Copy ¶
func (a BasicAnimation) Copy() BasicAnimation
func (BasicAnimation) GetAnimation ¶
func (a BasicAnimation) GetAnimation(b *Base) Animation
func (BasicAnimation) GetProps ¶
func (a BasicAnimation) GetProps() BasicAnimationProp
func (BasicAnimation) IndexForTime ¶
func (a BasicAnimation) IndexForTime(time float32) int
func (BasicAnimation) Init ¶
func (a BasicAnimation) Init(base *Base)
func (BasicAnimation) IsDone ¶
func (a BasicAnimation) IsDone(base *Base, animationTime float32) bool
func (BasicAnimation) Merge ¶
func (a BasicAnimation) Merge(b BasicAnimation) BasicAnimation
func (BasicAnimation) Only ¶
func (a BasicAnimation) Only(props BasicAnimationProp) BasicAnimation
func (BasicAnimation) PostProcess ¶
func (a BasicAnimation) PostProcess(base *Base, animationTime float32, ctx *RenderContext, out *VertexBuffers)
func (BasicAnimation) PreLerpForTime ¶
func (a BasicAnimation) PreLerpForTime(time float32) BasicAnimationFrame
func (BasicAnimation) Reverse ¶
func (a BasicAnimation) Reverse() BasicAnimation
func (BasicAnimation) Update ¶
func (a BasicAnimation) Update(base *Base, animationTime float32, update Update) Dirty
func (BasicAnimation) WithDuration ¶
func (a BasicAnimation) WithDuration(duration float32) BasicAnimation
func (BasicAnimation) WithEasing ¶
func (a BasicAnimation) WithEasing(easing ease.Easing) BasicAnimation
func (BasicAnimation) WithNoSave ¶
func (a BasicAnimation) WithNoSave() BasicAnimation
func (BasicAnimation) WithSave ¶
func (a BasicAnimation) WithSave(save, skipColor, skipTransparent, skipTransform bool) BasicAnimation
func (BasicAnimation) Without ¶
func (a BasicAnimation) Without(props BasicAnimationProp) BasicAnimation
type BasicAnimationFrame ¶
type BasicAnimationFrame struct { Translate AmountPoint Scale *gfx.Coord Rotate float32 Origin AmountPoint Time float32 Color color.Modify Transparency float32 Easing ease.Easing }
func (BasicAnimationFrame) Lerp ¶
func (start BasicAnimationFrame) Lerp(end BasicAnimationFrame, delta float32, ctx *AmountContext, x, y float32) BasicAnimationFrameInterpolated
func (BasicAnimationFrame) PreLerp ¶
func (start BasicAnimationFrame) PreLerp(end BasicAnimationFrame, delta float32) BasicAnimationFrame
type BasicAnimationFrameInterpolated ¶
type BasicAnimationFrameInterpolated struct {
ScaleX, ScaleY float32
OriginX, OriginY float32
TranslateX, TranslateY float32
Rotation float32
Color color.Modify
Transparency float32
}
func (BasicAnimationFrameInterpolated) Transform ¶
func (inter BasicAnimationFrameInterpolated) Transform() Transform
type BasicAnimationProp ¶
type BasicAnimationProp int
const ( BasicAnimationPropScale BasicAnimationProp = 1 << iota BasicAnimationPropOrigin BasicAnimationPropTranslate BasicAnimationPropRotate BasicAnimationPropColor BasicAnimationPropTransparency BasicAnimationPropEasing )
type BasicTextAnimation ¶
type BasicTextAnimation struct { Settings []BasicTextAnimationSettings Easing ease.Easing // contains filtered or unexported fields }
func (*BasicTextAnimation) EasedTime ¶
func (a *BasicTextAnimation) EasedTime(time float32) float32
func (BasicTextAnimation) GetAnimation ¶
func (a BasicTextAnimation) GetAnimation(text *RenderedText) TextAnimation
func (*BasicTextAnimation) GetStates ¶
func (a *BasicTextAnimation) GetStates(text *RenderedText) []BasicTextAnimationState
func (*BasicTextAnimation) Init ¶
func (a *BasicTextAnimation) Init(base *Base)
func (*BasicTextAnimation) IsDone ¶
func (a *BasicTextAnimation) IsDone(base *Base, animationTime float32) bool
func (*BasicTextAnimation) Render ¶
func (a *BasicTextAnimation) Render(b *Base, animationTime float32, bounds Bounds, ctx *RenderContext, out *VertexBuffer)
type BasicTextAnimationKind ¶
type BasicTextAnimationKind int
const ( BasicTextAnimationKindChar BasicTextAnimationKind = iota BasicTextAnimationKindWord BasicTextAnimationKindLine BasicTextAnimationKindParagraph BasicTextAnimationKindColumn )
func (BasicTextAnimationKind) Get ¶
func (k BasicTextAnimationKind) Get(g *RenderedGlyph) int
type BasicTextAnimationSettings ¶
type BasicTextAnimationSettings struct { // How to break up the text into pieces to animate Kind BasicTextAnimationKind // The frames to animate over the given duration for a piece Frames []BasicAnimationFrame // How long to animate a piece Duration float32 // How long between starting each piece animation Delay float32 // Optional easing function for determining the frame Easing ease.Easing // The index of the glyph to start at Start int }
func (BasicTextAnimationSettings) GetFrames ¶
func (s BasicTextAnimationSettings) GetFrames(time float32) (first int, delta float32)
func (BasicTextAnimationSettings) GetState ¶
func (s BasicTextAnimationSettings) GetState(text *RenderedText, endExclusive int) BasicTextAnimationState
type BasicTextAnimationState ¶
type Bounds ¶
type Bounds struct {
Left, Top, Right, Bottom float32
}
func (Bounds) ClipLine ¶
func (b Bounds) ClipLine(x0, y0, x1, y1 float32) ClippedLine
func (Bounds) Dimensions ¶
func (Bounds) Intersects ¶
func (Bounds) IsNegative ¶
func (Bounds) IsPositive ¶
func (Bounds) Side ¶
func (b Bounds) Side(x, y float32) BoundsSide
func (Bounds) SideInside ¶
func (b Bounds) SideInside(x, y float32, side BoundsSide) bool
func (Bounds) SideIntersect ¶
func (b Bounds) SideIntersect(x0, y0, x1, y1 float32, side BoundsSide) (x, y, delta float32)
type BoundsSide ¶
type BoundsSide int
const ( BoundsSideNone BoundsSide = (1 << iota) >> 1 BoundsSideLeft BoundsSideTop BoundsSideRight BoundsSideBottom BoundsSideAll = BoundsSideLeft | BoundsSideTop | BoundsSideRight | BoundsSideBottom )
type ClippedLine ¶
type ClippedLine struct { Start gfx.Coord StartDelta float32 StartSide BoundsSide End gfx.Coord EndDelta float32 EndSide BoundsSide Outside bool }
func (ClippedLine) Inside ¶
func (cl ClippedLine) Inside() bool
type ComponentMap ¶
type ComponentMap struct {
// contains filtered or unexported fields
}
func NewComponentMap ¶
func NewComponentMap() ComponentMap
func (*ComponentMap) Add ¶
func (cm *ComponentMap) Add(c *Base)
func (*ComponentMap) AddLineage ¶
func (cm *ComponentMap) AddLineage(c *Base)
func (*ComponentMap) AddMany ¶
func (cm *ComponentMap) AddMany(c []*Base)
func (ComponentMap) Compare ¶
func (old ComponentMap) Compare(new ComponentMap) (inOld []*Base, inBoth []*Base, inNew []*Base)
func (ComponentMap) Components ¶
func (cm ComponentMap) Components() []*Base
func (ComponentMap) Has ¶
func (cm ComponentMap) Has(c *Base) bool
type CursorEvent ¶
type CursorEvent uint8
const ( CursorEventHover CursorEvent = iota CursorEventDown CursorEventDrag CursorEventDisabled )
type Cursors ¶
type Cursors struct { ds.EnumMap[CursorEvent, id.Identifier] }
func NewCursors ¶
func NewCursors(m map[CursorEvent]id.Identifier) Cursors
func (Cursors) HandleDrag ¶
func (Cursors) HandlePointer ¶
func (c Cursors) HandlePointer(ev *PointerEvent, b *Base)
func (Cursors) OverCursor ¶
func (c Cursors) OverCursor(b *Base, ignoreDragging bool) id.Identifier
type Dirty ¶
type Dirty = Flags
The possible dirty states of a component. Dirty states are used to keep track of what operations needs to be done (if at all) on component Place and Render. If a component tree is not animating or has a post processing state (for example) then render/clipping logic can be avoided for the current frame and cached render data can be used.
const ( // No dirty state DirtyNone Dirty = (1 << iota) >> 1 // The components placement in its parent has changed. After placement is done if the // bounds of the component has changed the visual is also marked dirty. DirtyPlacement // The components layers need to be rendered. DirtyVisual // The components children had placement changed and need to be layout and placed again. DirtyChildPlacement // The components children had its layer, children, or post processing changed. DirtyChildVisual // The component's post processing has changed and needs to be processed again. DirtyPostProcess )
func (Dirty) ParentDirty ¶
Converts this Dirty into what should be added to the parent's Dirty state. If the placement is dirty, then the parent state will have DirtyChildPlacement. If the visual is dirty, then the parent state will have DirtyChildVisual. If the post process is dirty, then the parent state will have DirtyChildVisual.
type DragEventType ¶
type DragEventType int
const ( DragEventStart DragEventType = iota DragEventMove DragEventEnd DragEventCancel DragEventOver DragEventDrop )
type Event ¶
func (*Event) PreventDefault ¶
func (e *Event) PreventDefault()
func (*Event) StopPropagation ¶
func (e *Event) StopPropagation()
type Events ¶
type ExtentTile ¶
func NewExtentTile ¶
func NewExtentTile(tile gfx.Tile, extent Bounds) ExtentTile
type Font ¶
type Font struct { // The name of the font Name string // The texture of the font Texture string // The lineheight relative to the font size. 1.0=matches font-size LineHeight float32 // Within a line how far down is the baseline from the top relative to the font size. Baseline float32 // Data about each rune in the font Runes map[rune]FontRune // Kerning data when run B follows rune A Kerning map[rune]map[rune]float32 }
type FontRune ¶
type FontRune struct { // The extends around the baseline point at the start of the font rune ExtentTile // The advance width of the rune Width float32 }
type Glyph ¶
type Glyph interface { GetState(ctx *RenderContext, wrap TextWrap, prev Glyph) GlyphState Render(ctx *RenderContext, start gfx.Coord, base *Base) RenderedGlyph String() string }
type GlyphState ¶
type GlyphVisibility ¶
type GlyphVisibility int
const ( GlyphVisibilityVisible GlyphVisibility = iota GlyphVisibilityPartial GlyphVisibilityInvisible )
type HasCursor ¶
type HasCursor struct { Cursor *id.Identifier CursorSet bool CursorTrigger *Base }
func (*HasCursor) RemoveCursor ¶
func (ev *HasCursor) RemoveCursor(cursor id.Identifier)
type HookRender ¶
type HookRender func(b *Base, ctx *RenderContext, out *VertexQueue)
func (*HookRender) Add ¶
func (h *HookRender) Add(add HookRender, before bool)
func (*HookRender) Clear ¶
func (h *HookRender) Clear()
type HookUpdate ¶
func (*HookUpdate) Add ¶
func (h *HookUpdate) Add(add HookUpdate, before bool)
func (*HookUpdate) Clear ¶
func (h *HookUpdate) Clear()
func (HookUpdate) Run ¶
func (h HookUpdate) Run(b *Base, update Update)
type Hooks ¶
type Hooks struct { OnInit HookBase OnPlace HookPlace OnUpdate HookUpdate OnRender HookRender OnRemove HookBase OnPostProcess PostProcess OnPostProcessLayers PostProcess OnPostProcessChildren PostProcess }
type IndexIterator ¶
type IndexIterator = buf.IndexIterator[Vertex, VertexBuffer]
func NewIndexIterator ¶
func NewIndexIterator(iterable buf.Iterable[Vertex, VertexBuffer], beginning bool) IndexIterator
type KeyEventType ¶
type KeyEventType int
const ( KeyEventDown KeyEventType = iota KeyEventUp KeyEventPress )
type Layer ¶
type Layer struct { Placement Placement Bounds Bounds Visual Visual Background Background States StateFn }
func (Layer) ComputeRenderContext ¶
func (l Layer) ComputeRenderContext(b *Base) *RenderContext
func (Layer) PreferredSize ¶
func (Layer) Render ¶
func (l Layer) Render(b *Base, ctx *RenderContext, out *VertexBuffers)
type LayoutColumn ¶
type LayoutColumn struct { FullWidth bool FullHeight bool EqualWidths bool HorizontalAlignment Alignment Spacing Amount }
A layout which places all children in a column (vertical stack). The children can have their width expanded to the full width or default to their preferred size. If they are not expanded to full width they can be horizontally aligned. Optionally the size inferred by the placement can be factored into the preferred size as well (it's not by default).
func (LayoutColumn) Init ¶
func (l LayoutColumn) Init(b *Base)
func (LayoutColumn) Layout ¶
func (l LayoutColumn) Layout(b *Base, ctx *RenderContext, bounds Bounds, layoutable []*Base)
func (LayoutColumn) PreferredSize ¶
func (l LayoutColumn) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32, layoutable []*Base) gfx.Coord
type LayoutData ¶
type LayoutData struct { // The weight for the width when the layout is stretched. WidthWeight float32 // Each cell component is expanded to the column width FullWidth *bool // When FullWidth is false, how to align the cell component horizontally in the cell HorizontalAlignment *Alignment // The weight for the height when the layout is stretched. HeightWeight float32 // Each cell component is expanded to the row height FullHeight *bool // When FullHeight is false, how to align the cell component veritcally in the cell VerticalAlignment *Alignment // For certain layouts, should the preferred size be enforced? EnforcePreferredSize *bool // For certain layouts, should the component be moved within the parent's bounds? KeepInside *bool KeepInsideForgetSize *bool KeepInsideIgnoreMargins *bool }
Layout information that can be specified at the component level that a layout may or may not use during placement.
func (LayoutData) WithEnforcePreferredSize ¶
func (ld LayoutData) WithEnforcePreferredSize(enforce bool) LayoutData
func (LayoutData) WithFullHeight ¶
func (ld LayoutData) WithFullHeight(fullHeight bool) LayoutData
func (LayoutData) WithFullWidth ¶
func (ld LayoutData) WithFullWidth(fullWidth bool) LayoutData
func (LayoutData) WithHeightWeight ¶
func (ld LayoutData) WithHeightWeight(heightWeight float32) LayoutData
func (LayoutData) WithHorizontalAlignment ¶
func (ld LayoutData) WithHorizontalAlignment(alignment Alignment) LayoutData
func (LayoutData) WithKeepInside ¶
func (ld LayoutData) WithKeepInside(keepInside bool) LayoutData
func (LayoutData) WithKeepInsideForgetSize ¶
func (ld LayoutData) WithKeepInsideForgetSize(forgetSize bool) LayoutData
func (LayoutData) WithKeepInsideIgnoreMargins ¶
func (ld LayoutData) WithKeepInsideIgnoreMargins(ignoreMargins bool) LayoutData
func (LayoutData) WithVerticalAlignment ¶
func (ld LayoutData) WithVerticalAlignment(alignment Alignment) LayoutData
func (LayoutData) WithWidthWeight ¶
func (ld LayoutData) WithWidthWeight(widthWeight float32) LayoutData
type LayoutGrid ¶
type LayoutGrid struct { // The grid will take up the full width of the bounds. May result in ignoring other width settings. FullWidth bool // The grid will take up the full height of the bounds. May result in ignoring other height settings. FullHeight bool // How much space between rows VerticalSpacing Amount // How much space between columns HorizontalSpacing Amount // Whether the number of columns should be dynamically calculated. ColumnsDynamic bool // When dynamically calculating columns, this will be the min number of columns in the grid. ColumnsMin int // When dynamically calculating columns, this will be the max number of columns in the grid. ColumnsMax int // A value used in determining how many columns should be in the grid when not defined. // A value of 0.0 will try to fit as many columns as possible while a value of 1.0 will try to fit as few columns as possible. ColumnsDynamicDelta float32 // If the cell heights should be a ratio of their width. A value of 0.0 has no affect. // A value of 0.5 will make the height half the width. AspectRatio float32 // If all the rows in the grid should try to have equal heights. Min/Max heights may interfere with this. EqualHeights bool // If all the columns in the grid should try to have equal widths. Min/Max widths may interfere with this. EqualWidths bool // The columns in the grid. You can use Columns or ColumnsMin to control the number of columns in the grid. // When the number of column definitions is below the number of columns the last column definition will be used. // At least one column is typically defined. Columns []LayoutGridColumn // The rows in the table. If the table has anymore rows beyond what's defined the last row will be used. // At least one row is typically defined. Rows []LayoutGridRow }
A layout which places all children in a grid. The number of columns in the grid can be given or MinWidths can be given with a non-zero X component. That component is used with the spacing and the width of the parent to maintain a dynamic number of columns based on the min width. The width of the cell is evenly distributed is EqualWidths. The height of the cell can be determined by the max preferred size of a child in a row while also using the MinHeights defined on the layout which all can be overridden if a non-zero AspectRatio is defined which will make all rows have the same height respective to the cell width. Alignment of a component within a cell is determine by Vertical and Horizontal alignment, unless FullWidth & FullHeight are given which means the component expands to fit the cell.
func (LayoutGrid) Init ¶
func (l LayoutGrid) Init(b *Base)
func (LayoutGrid) Layout ¶
func (l LayoutGrid) Layout(b *Base, ctx *RenderContext, bounds Bounds, layoutable []*Base)
func (LayoutGrid) PreferredSize ¶
func (l LayoutGrid) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32, layoutable []*Base) gfx.Coord
type LayoutGridColumn ¶
type LayoutGridColumn struct { // When stretching the columns to match the width of the bounds - how should each column // be stretched? A value of zero will cause no stretching, and non-zero values will be // divided up based on the value / the sum of values. One or zero weights will cause // the widths to be equally stretched. Weight float32 // Each cell component is expanded to the column width FullWidth bool // When FullWidth is false, how to align the cell component horizontally in the cell HorizontalAlignment Alignment // Each cell component is expanded to the row height FullHeight *bool // When FullHeight is false, how to align the cell component vertically in the cell VerticalAlignment *Alignment // Defines the min widths for one or all columns. Min float32 // Defines the max widths for one or all columns. Max float32 }
A definition for a single column in the table layout.
type LayoutGridRow ¶
type LayoutGridRow struct { // When stretching the rows to match the height of the bounds - how should each row // be stretched? A value of zero will cause no stretching, and non-zero values will be // divided up based on the value / the sum of values. One or zero weights will cause // the heights to be equally stretched. Weight float32 // Each cell component is expanded to the row height FullHeight bool // When FullHeight is false, how to align the cell component veritcally in the cell VerticalAlignment Alignment // Each cell component is expanded to the column width FullWidth *bool // When FullWidth is false, how to align the cell component horizontally in the cell HorizontalAlignment *Alignment // Defines the min heights for one or all rows. If the number of rows extends beyond the number // of min heights defined, they will use the last min height defined. Min float32 // Defines the max heights for one or all rows. If the number of rows extends beyond the number // of max heights defined, they will use the last max height defined. Max float32 }
A definition for a single row in the table layout.
type LayoutInline ¶
type LayoutInline struct { // The default vertical alignment of a component in a line. LineVerticalAlignment Alignment // The default horizontal alignment of a component in a stretched out // line in the parent component. This is only used when FullWidth=true // and LineFullWidth=false. LineHorizontalAlignment Alignment // The alignment of all the lines in the parent component. VerticalAlignment Alignment // The alignment of all the lines in the parent component. HorizontalAlignment Alignment // The spacing between each line. VerticalSpacing Amount // The spacing between each component in a line. HorizontalSpacing Amount // If all the components in a given line share the same height. LineFullHeight bool // If all the components in a given line take up the full width available. // This only has an effect when FullWidth is true. LineFullWidth bool // If all the lines share the same height. EqualHeights bool // If all components in a line should share the same width LineEqualWidths bool // If the layout should stretch the lines to the height of the parent. // The height weights of the components are used to stretch and if none are // defined then they are all equally stretched. FullHeight bool // If the layout should stretch the lines to the width of the parent. // The width weights of the components are used to stretch and if none are // defined then they are all equally stretched. FullWidth bool }
A layout which places all children on after another and wraps them if it can't fit in a line.
func (LayoutInline) Init ¶
func (l LayoutInline) Init(b *Base)
func (LayoutInline) Layout ¶
func (l LayoutInline) Layout(b *Base, ctx *RenderContext, bounds Bounds, layoutable []*Base)
func (LayoutInline) PreferredSize ¶
func (l LayoutInline) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32, layoutable []*Base) gfx.Coord
type LayoutRow ¶
type LayoutRow struct { FullHeight bool FullWidth bool EqualHeights bool VerticalAlignment Alignment Spacing Amount ExpandRight bool }
A layout which places all children in a row (horizontal stack). The children can have their height expanded to the full height or default to their preferred size. If they are not expanded to full height they can be vertically aligned. Optionally the size inferred by the placement can be factored into the preferred size as well (it's not by default).
func (LayoutRow) Layout ¶
func (l LayoutRow) Layout(b *Base, ctx *RenderContext, bounds Bounds, layoutable []*Base)
func (LayoutRow) PreferredSize ¶
type LayoutSizing ¶
type LayoutSizing struct {
FullWidth, FullHeight float32
Width, Height float32
OffsetX, OffsetY float32
Data *LayoutData
}
func (LayoutSizing) HeightPadding ¶
func (ls LayoutSizing) HeightPadding() float32
func (*LayoutSizing) SetFullHeight ¶
func (ls *LayoutSizing) SetFullHeight(fullHeight float32)
func (*LayoutSizing) SetFullWidth ¶
func (ls *LayoutSizing) SetFullWidth(fullWidth float32)
func (LayoutSizing) WidthPadding ¶
func (ls LayoutSizing) WidthPadding() float32
type LayoutSizings ¶
type LayoutSizings struct { Sizings []LayoutSizing MaxWidth, MaxHeight float32 TotalWidth, TotalHeight float32 TotalWidthWeight float32 TotalHeightWeight float32 }
func (LayoutSizings) GetHeightWeight ¶
func (ls LayoutSizings) GetHeightWeight(i int) float32
func (LayoutSizings) GetWidthWeight ¶
func (ls LayoutSizings) GetWidthWeight(i int) float32
type LayoutStatic ¶
type LayoutStatic struct { EnforcePreferredSize bool KeepInside bool KeepInsideForgetSize bool KeepInsideIgnoreMargins bool }
A layout which uses the defined placements on each child but can help with enforcing their preferred size and keeping them in the parent. Perfect for open spaces with draggable components.
func (LayoutStatic) Init ¶
func (l LayoutStatic) Init(b *Base)
func (LayoutStatic) Layout ¶
func (l LayoutStatic) Layout(b *Base, ctx *RenderContext, bounds Bounds, layoutable []*Base)
func (LayoutStatic) PreferredSize ¶
func (l LayoutStatic) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32, layoutable []*Base) gfx.Coord
type Layoutable ¶
type Paragraph ¶
type Paragraph struct { Styles *ParagraphStylesOverride Glyphs []Glyph }
func (Paragraph) GetLineHeight ¶
func (paragraph Paragraph) GetLineHeight(ctx *RenderContext, style *ParagraphStyles, actualLineHeight float32) float32
func (Paragraph) GetStates ¶
func (paragraph Paragraph) GetStates(ctx *RenderContext, style *ParagraphStyles) []GlyphState
func (Paragraph) Measure ¶
func (paragraph Paragraph) Measure(ctx *RenderContext, paragraphs Paragraphs) gfx.Coord
func (Paragraph) MinWidth ¶
func (paragraph Paragraph) MinWidth(ctx *RenderContext, keepEmpty bool) float32
func (Paragraph) Render ¶
func (paragraph Paragraph) Render(ctx *RenderContext, paragraphs Paragraphs, b *Base) RenderedText
type ParagraphStyles ¶
type ParagraphStyles struct { Spacing Amount // extra space between glyphs TODO LineSpacing Amount // extra space between lines LineHeight Amount // 0=calculated per line LineVerticalAlignment Alignment // 0=top, 0.5=middle, 1=bottom Indent Amount // shift first line in a wrappable line HorizontalAlignment Alignment // 0=left, 0.5=middle, 1=right Wrap TextWrap // when we are going beyond the width, how do we decide to wrap ParagraphPadding AmountBounds // padding around the paragraph }
func (*ParagraphStyles) Override ¶
func (s *ParagraphStyles) Override(o *ParagraphStylesOverride) *ParagraphStyles
type ParagraphStylesOverride ¶
type ParagraphStylesOverride struct { Spacing *Amount // extra space between glyphs LineSpacing *Amount // extra space between lines LineHeight *Amount // 0=calculated per line LineVerticalAlignment *Alignment // 0=top, 0.5=middle, 1=bottom Indent *Amount // shift first line in a wrappable line HorizontalAlignment *Alignment // 0=left, 0.5=middle, 1=right Wrap *TextWrap // when we are going beyond the width, how do we decide to wrap ParagraphPadding *AmountBounds // padding around the paragraph }
func (*ParagraphStylesOverride) Clone ¶
func (o *ParagraphStylesOverride) Clone() *ParagraphStylesOverride
func (*ParagraphStylesOverride) HasOverride ¶
func (o *ParagraphStylesOverride) HasOverride() bool
type Paragraphs ¶
type Paragraphs struct { Styles *ParagraphsStylesOverride Paragraphs []Paragraph MaxWidth float32 MaxHeight float32 KeepEmpty bool }
func MustTextToParagraphs ¶
func MustTextToParagraphs(text string) Paragraphs
func TextToParagraphs ¶
func TextToParagraphs(text string) (paragraphs Paragraphs, err error)
Parses text and converts it to glyphs using a special format. In the text you can set: - font = {f:name} or {f:} to reset to default - color = {c:#RRGGBB} or {c:#RRGGBBAA} or {c:red} or {c:} to reset to default - size = {s:12} or {s:50%} or {s:} to reset to default - new paragraph = {p} or {p:reset} to reset paragraph style - set kerning to paragraph = {k:5} - set horizontal alignment in paragraph = {h:0.5} - set vertical alignment within a line in paragraph = {v:0} - set wrap in paragraph = {w:none} or {w:word} or {w:char} - set line spacing in paragraph = {ls:10} - set line height in paragraph = {lh:10} or {lh:120%} - set indent = {i:5em} - set padding in paragraph = {pa:10} or {pl:10%} or {pr:0} or {pb} or {pt:} - set spacing between paragraphs = {ps:10} - set vertical alignment of paragraphs in area = {pv:0.5} - set max height in area = {mh:100} - set max width in area = {mw:100} - set clip show x in area = {cx} aka {cx:} aka {cx:none} or {cx:left} or {cx:right} - set clip show y in area = {cy} aka {cy:} aka {cy:none} or {cy:top} or {cy:bottom}
Ex: "Hello {f:roboto}World{f:} {s:20}HOW{s:} {c:#00F}blue {c:red}red {c:} \{"
func (Paragraphs) Measure ¶
func (paragraphs Paragraphs) Measure(ctx *RenderContext) gfx.Coord
func (Paragraphs) MinWidth ¶
func (paragraphs Paragraphs) MinWidth(ctx *RenderContext) float32
func (Paragraphs) Render ¶
func (paragraphs Paragraphs) Render(ctx *RenderContext, b *Base) RenderedText
func (Paragraphs) String ¶
func (paragraphs Paragraphs) String() string
func (Paragraphs) ToString ¶
func (paragraphs Paragraphs) ToString(paragraphSeparator string) string
func (Paragraphs) Wrap ¶
func (paragraphs Paragraphs) Wrap(lineWidth float32) bool
type ParagraphsStyles ¶
type ParagraphsStyles struct { ParagraphSpacing Amount // how much space between paragraphs VerticalAlignment Alignment // how to align all paragraphs in an area ClipShowX ClipShow // when text cannot fit in the area width, which side should we prefer to show (left, right, none) ClipShowY ClipShow // when text cannot fit in the area height, which side should we prefer to show (top, bottom, none) }
func (*ParagraphsStyles) Override ¶
func (s *ParagraphsStyles) Override(o *ParagraphsStylesOverride) *ParagraphsStyles
type ParagraphsStylesOverride ¶
type ParagraphsStylesOverride struct { ParagraphSpacing *Amount // how much space between paragraphs VerticalAlignment *Alignment // how to align all paragraphs in an area ClipShowX *ClipShow // when text cannot fit in the area width, which side should we prefer to show (left, right, none) ClipShowY *ClipShow // when text cannot fit in the area height, which side should we prefer to show (top, bottom, none) }
func (*ParagraphsStylesOverride) HasOverride ¶
func (o *ParagraphsStylesOverride) HasOverride() bool
type Placement ¶
func MaximizeOffset ¶
func (Placement) BottomFixedHeight ¶
func (Placement) GetBoundsIn ¶
func (*Placement) GetBoundsi ¶
func (Placement) GetMinHeight ¶
func (Placement) GetMinWidth ¶
func (Placement) IsMaximized ¶
func (Placement) LeftFixedWidth ¶
func (Placement) MinParentHeight ¶
func (Placement) MinParentSize ¶
func (Placement) MinParentWidth ¶
func (Placement) ParentHeight ¶
func (Placement) ParentWidth ¶
func (Placement) PreferredHeight ¶
func (Placement) PreferredWidth ¶
func (Placement) RightFixedWidth ¶
func (Placement) TopFixedHeight ¶
func (Placement) WithBottom ¶
func (Placement) WithHeight ¶
func (Placement) WithHeightRelative ¶
func (Placement) WithSizeRelative ¶
func (Placement) WithWidthRelative ¶
type PlacementAnimation ¶
type PlacementAnimation struct { Target Placement Easing ease.Easing Duration float32 ApplyMaxSize bool // contains filtered or unexported fields }
func (PlacementAnimation) GetAnimation ¶
func (a PlacementAnimation) GetAnimation(base *Base) Animation
func (*PlacementAnimation) Init ¶
func (a *PlacementAnimation) Init(base *Base)
func (*PlacementAnimation) IsDone ¶
func (a *PlacementAnimation) IsDone(base *Base, animationTime float32) bool
func (*PlacementAnimation) PostProcess ¶
func (a *PlacementAnimation) PostProcess(base *Base, animationTime float32, ctx *RenderContext, out *VertexBuffers)
type PointerButtons ¶
type PointerEvent ¶
type PointerEventType ¶
type PointerEventType int
const ( // Press down (might not be followed by up) PointerEventDown PointerEventType = iota // Press up (might not be followed by ) PointerEventUp // When a component previously received a down but the latest down excludes them. PointerEventDownOut // When a component previously received an up but the latest up excludes them. PointerEventUpOut // A pointer has leaved a component. PointerEventLeave // A pointer has entered a component. PointerEventEnter // A scroll/wheel event. PointerEventWheel // The pointer has moved. PointerEventMove )
type PostProcess ¶
type PostProcess func(b *Base, ctx *RenderContext, out *VertexBuffers)
func PostProcessVertex ¶
func PostProcessVertex(modify VertexModifier) PostProcess
func (*PostProcess) Add ¶
func (pp *PostProcess) Add(other PostProcess, before bool)
func (*PostProcess) Clear ¶
func (pp *PostProcess) Clear()
func (PostProcess) Run ¶
func (pp PostProcess) Run(b *Base, ctx *RenderContext, out *VertexBuffers)
type RenderContext ¶
type RenderContext struct { AmountContext *AmountContext Theme *Theme TextStyles *TextStyles }
func (*RenderContext) WithAmountContext ¶
func (ctx *RenderContext) WithAmountContext(amt *AmountContext) *RenderContext
func (*RenderContext) WithBounds ¶
func (ctx *RenderContext) WithBounds(parent Bounds) *RenderContext
func (*RenderContext) WithBoundsAndTextStyles ¶
func (ctx *RenderContext) WithBoundsAndTextStyles(parent Bounds, styles *TextStylesOverride) *RenderContext
func (*RenderContext) WithParent ¶
func (ctx *RenderContext) WithParent(width, height float32) *RenderContext
func (*RenderContext) WithTextStyles ¶
func (ctx *RenderContext) WithTextStyles(styles *TextStyles) *RenderContext
type RenderedGlyph ¶
type RenderedGlyph struct { gfx.Tile Bounds Bounds Color color.Color Visibility GlyphVisibility Line int Column int Word int Paragraph int ParagraphIndex int Index int Empty bool }
func (RenderedGlyph) Write ¶
func (g RenderedGlyph) Write(quad []Vertex)
type RenderedText ¶
type RenderedText struct { Bounds Bounds Glyphs []RenderedGlyph Paragraphs Paragraphs }
func (RenderedText) Closest ¶
func (text RenderedText) Closest(x, y float32) int
func (RenderedText) ClosestByLine ¶
func (text RenderedText) ClosestByLine(x, y float32) int
func (RenderedText) CountVisible ¶
func (text RenderedText) CountVisible(threshold *GlyphVisibility) int
func (*RenderedText) Translate ¶
func (paragraph *RenderedText) Translate(x, y float32)
func (RenderedText) UpdateVisibility ¶
func (text RenderedText) UpdateVisibility(visibleBounds Bounds)
type ShapePolygon ¶
func (ShapePolygon) Init ¶
func (o ShapePolygon) Init()
func (ShapePolygon) Shapify ¶
func (o ShapePolygon) Shapify(b Bounds, ctx *RenderContext) []gfx.Coord
type ShapeRectangle ¶
type ShapeRectangle struct{}
func (ShapeRectangle) Init ¶
func (o ShapeRectangle) Init()
func (ShapeRectangle) Shapify ¶
func (o ShapeRectangle) Shapify(b Bounds, ctx *RenderContext) []gfx.Coord
type ShapeRounded ¶
type ShapeRounded struct { Radius AmountCorners UnitToPoints float32 }
func (ShapeRounded) Init ¶
func (o ShapeRounded) Init()
func (ShapeRounded) Shapify ¶
func (o ShapeRounded) Shapify(b Bounds, ctx *RenderContext) []gfx.Coord
type ShapeSharpen ¶
func (ShapeSharpen) Init ¶
func (o ShapeSharpen) Init()
func (ShapeSharpen) Shapify ¶
func (o ShapeSharpen) Shapify(b Bounds, ctx *RenderContext) []gfx.Coord
type State ¶
type State = Flags
One or more states of a component. The states can define which layers or post processing is done.
const ( // Default enabled state StateDefault State = 1 << iota // Enabled state with pointer over component StateHover // Enabled state with pointer down on component. Can be other states as well. StatePressed // Enabled state when component is the currently focused one. StateFocused // Component was disabled by user and should receive no input events. StateDisabled // Enabled state when component is being drug. StateDragging // Enabled state when component accepts drops and there's a drag element over it. StateDragOver // General state for more complex components (checked, chosen option, etc). StateSelected // Disabled state when component is hidden from render parent and is not placed. StateHidden // Disabled state when component has removing animation that's playing. StateRemoving // Disabled state when component has hiding animation that's playing. StateHiding // Disabled state when component has showing animation that's playing. StateShowing // All states that can't receive input events. StatesDisabled = StateDisabled | StateRemoving | StateShowing | StateHiding | StateHidden )
type StateFn ¶
A function which accepts a state and returns true/false. Used to control which layers are updated & rendered for a component's state.
type Template ¶
type Template struct { PreLayers []Layer PostLayers []Layer Focusable bool Draggable bool Droppable bool PreEvents Events PostEvents Events RelativePlacement Placement Clip Placement TextStyles *TextStylesOverride Shape Shape OverShape []gfx.Coord Transparency float32 Color color.Modify Animations *Animations AnimationsMerge bool Cursors Cursors CursorsMerge bool Colors color.Colors ColorsMerge bool PreHooks Hooks PostHooks Hooks Margin AmountBounds MinSize AmountPoint MaxSize AmountPoint Layout Layout IgnoreLayoutPreferredWidth bool IgnoreLayoutPreferredHeight bool }
A template for a base which can be applied.
type TextAnimation ¶
type TextAnimationFactory ¶
type TextAnimationFactory interface {
GetAnimation(text *RenderedText) TextAnimation
}
type TextStyles ¶
type TextStyles struct { ParagraphStyles ParagraphsStyles Color color.Able Font id.Identifier FontSize Amount }
func (*TextStyles) Override ¶
func (s *TextStyles) Override(o *TextStylesOverride) *TextStyles
type TextStylesOverride ¶
type TextStylesOverride struct { ParagraphStylesOverride *ParagraphStylesOverride ParagraphsStylesOverride *ParagraphsStylesOverride Color *color.Able Font *id.Identifier FontSize *Amount }
func (*TextStylesOverride) HasOverride ¶
func (o *TextStylesOverride) HasOverride() bool
type Theme ¶
type Theme struct { TextStyles TextStyles StatePostProcess map[State]PostProcess Fonts id.DenseMap[*Font, uint16, uint8] Cursors id.DenseMap[ExtentTile, uint16, uint8] DefaultCursor id.Identifier Animations Animations Colors color.Colors }
The Theme of a UI. Contains the base text styles, state specific post processing, the collection of supported fonts & cursors, the default cursor, the theme wide named animations, and the theme wide colors.
type Transform ¶
type Transform struct {
// contains filtered or unexported fields
}
func (*Transform) Determinant ¶
func (*Transform) GetDegrees ¶
func (*Transform) GetRadians ¶
func (*Transform) GetTranslate ¶
func (Transform) IsEffectivelyIdentity ¶
func (Transform) IsIdentity ¶
func (*Transform) PreTranslate ¶
func (*Transform) RotateDegrees ¶
func (*Transform) SetRotateAround ¶
func (*Transform) SetRotateDegrees ¶
func (*Transform) SetRotateDegreesAround ¶
func (*Transform) SetRotateDegreesScaleAround ¶
func (*Transform) SetRotateScaleAround ¶
func (*Transform) SetScaleAround ¶
func (*Transform) SetShearAround ¶
func (*Transform) SetTranslate ¶
func (*Transform) TransformVector ¶
func (*Transform) TransformVectorCoord ¶
type UI ¶
type UI struct { PointerButtons []PointerButtons PointerPoint gfx.Coord Root *Base PointerOver *Base Focused *Base Dragging *Base DragStart gfx.Coord DragCancels ds.Set[string] Theme *Theme Cursor id.Identifier Named id.DenseMap[*Base, uint16, uint16] TransformPointer bool TransparencyThreshold float32 UpdateHidden bool PointerEntersOnDrag bool PointerMovesOnDrag bool // contains filtered or unexported fields }
func (*UI) IsPointerOver ¶
func (*UI) NeedsRender ¶
func (*UI) ProcessKeyEvent ¶
func (*UI) ProcessPointerEvent ¶
func (ui *UI) ProcessPointerEvent(ev PointerEvent) error
func (*UI) Render ¶
func (ui *UI) Render(queue *VertexQueue)
func (*UI) RenderContext ¶
func (ui *UI) RenderContext() *RenderContext
func (*UI) SetContext ¶
func (ui *UI) SetContext(ctx *AmountContext)
type Unit ¶
type Unit int
const ( UnitConstant Unit = iota // "" px UnitFont // %f f rem %rem em %em UnitParent // % p %p UnitParentWidth // %w w %pw pw UnitParentHeight // %h h %ph ph UnitView // %v v UnitViewWidth // %vw vw UnitViewHeight // %vh vh UnitWindow // %n n UnitWindowWidth // %nw nw UnitWindowHeight // %nh nh UnitScreen // %s s UnitScreenWidth // %sw sw UnitScreenHeight // %sh sh )
func (Unit) SupportsPercent ¶
type UnitContext ¶
func (UnitContext) Get ¶
func (c UnitContext) Get(widthRelative bool) float32
type Vertex ¶
type Vertex struct {
X, Y float32
Tex gfx.TextureCoord
HasCoord bool
Color color.Color
HasColor bool
}
func (*Vertex) SetCoord ¶
func (vert *Vertex) SetCoord(coord gfx.TextureCoord)
type VertexBuffer ¶
func (*VertexBuffer) AddLine ¶
func (b *VertexBuffer) AddLine() []Vertex
func (*VertexBuffer) AddQuad ¶
func (b *VertexBuffer) AddQuad() []Vertex
func (*VertexBuffer) AddReservedLine ¶
func (b *VertexBuffer) AddReservedLine(v0, v1 Vertex)
func (*VertexBuffer) AddReservedQuad ¶
func (b *VertexBuffer) AddReservedQuad(v0, v1, v2, v3 Vertex)
func (*VertexBuffer) AddReservedTriangle ¶
func (b *VertexBuffer) AddReservedTriangle(v0, v1, v2 Vertex)
func (*VertexBuffer) AddTriangle ¶
func (b *VertexBuffer) AddTriangle() []Vertex
func (*VertexBuffer) Clear ¶
func (b *VertexBuffer) Clear()
func (*VertexBuffer) Clip ¶
func (b *VertexBuffer) Clip(bounds Bounds, out *VertexBuffer)
func (*VertexBuffer) ClipCompatible ¶
func (b *VertexBuffer) ClipCompatible(vb *VertexBuffer) bool
func (*VertexBuffer) CloneTo ¶
func (b *VertexBuffer) CloneTo(out *VertexBuffer) *VertexBuffer
func (*VertexBuffer) Compatible ¶
func (b *VertexBuffer) Compatible(vb *VertexBuffer) bool
func (VertexBuffer) Empty ¶
func (b VertexBuffer) Empty() bool
func (*VertexBuffer) GetReservedLine ¶
func (b *VertexBuffer) GetReservedLine() (data []Vertex)
func (*VertexBuffer) GetReservedQuad ¶
func (b *VertexBuffer) GetReservedQuad() (data []Vertex)
func (*VertexBuffer) GetReservedTriangle ¶
func (b *VertexBuffer) GetReservedTriangle() (data []Vertex)
func (*VertexBuffer) Init ¶
func (b *VertexBuffer) Init(capacity int)
func (VertexBuffer) Remaining ¶
func (b VertexBuffer) Remaining() int
func (*VertexBuffer) ReserveLines ¶
func (b *VertexBuffer) ReserveLines(lines int)
func (*VertexBuffer) ReserveQuads ¶
func (b *VertexBuffer) ReserveQuads(quads int)
func (*VertexBuffer) ReserveTriangles ¶
func (b *VertexBuffer) ReserveTriangles(triangles int)
type VertexBuffers ¶
type VertexBuffers struct { buf.Buffers[Vertex, VertexBuffer] Blend gfx.Blend Primitive gfx.Primitive }
func NewVertexBuffers ¶
func NewVertexBuffers(capacity int, buffers int) *VertexBuffers
func (*VertexBuffers) Clip ¶
func (vbs *VertexBuffers) Clip(bounds Bounds, render func(clippable *VertexBuffers))
func (*VertexBuffers) ClipInto ¶
func (clipped *VertexBuffers) ClipInto(bounds Bounds, source VertexIterable)
func (*VertexBuffers) CloneTo ¶
func (vbs *VertexBuffers) CloneTo(target *VertexBuffers)
func (*VertexBuffers) Get ¶
func (vbs *VertexBuffers) Get(primitive gfx.Primitive, blend gfx.Blend) *VertexBuffer
func (*VertexBuffers) NewLike ¶
func (vbs *VertexBuffers) NewLike() *VertexBuffers
func (*VertexBuffers) With ¶
func (vbs *VertexBuffers) With(primitive gfx.Primitive, blend gfx.Blend, render func(out *VertexBuffers))
type VertexIterable ¶
type VertexIterable = buf.Iterable[Vertex, VertexBuffer]
type VertexIterator ¶
type VertexIterator = buf.DataIterator[Vertex, VertexBuffer]
func NewVertexIterator ¶
func NewVertexIterator(iterable buf.Iterable[Vertex, VertexBuffer], beginning bool) VertexIterator
type VertexModifier ¶
type VertexModifier func(*Vertex)
type VertexQueue ¶
type VertexQueue struct { buf.Queue[Vertex, VertexBuffer] }
func NewVertexQueue ¶
func NewVertexQueue(capacity int) *VertexQueue
func (*VertexQueue) Clip ¶
func (vbs *VertexQueue) Clip(bounds Bounds, clipOut **VertexBuffers, render func(clippable *VertexQueue, clipping bool))
func (*VertexQueue) ToBuffers ¶
func (vbs *VertexQueue) ToBuffers() *VertexBuffers
type Visual ¶
type Visual interface { Init(b *Base) Update(b *Base, update Update) Dirty Visualize(b *Base, bounds Bounds, ctx *RenderContext, out *VertexBuffers) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32) gfx.Coord }
type VisualBorderScale ¶
type VisualBordered ¶
type VisualBordered struct { Width float32 OuterColor color.Able InnerColor color.Able Scales []VisualBorderScale Shape Shape }
func (VisualBordered) Init ¶
func (s VisualBordered) Init(b *Base)
func (VisualBordered) PreferredSize ¶
func (s VisualBordered) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32) gfx.Coord
func (VisualBordered) Visualize ¶
func (s VisualBordered) Visualize(b *Base, bounds Bounds, ctx *RenderContext, out *VertexBuffers)
type VisualFilled ¶
type VisualFilled struct {
Shape Shape
}
func (VisualFilled) Init ¶
func (s VisualFilled) Init(b *Base)
func (VisualFilled) PreferredSize ¶
func (s VisualFilled) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32) gfx.Coord
func (VisualFilled) Visualize ¶
func (s VisualFilled) Visualize(b *Base, bounds Bounds, ctx *RenderContext, out *VertexBuffers)
type VisualFrame ¶
type VisualFrame struct { Sizes AmountBounds Tile []gfx.Tile Columns int }
func (VisualFrame) Init ¶
func (r VisualFrame) Init(b *Base)
func (VisualFrame) PreferredSize ¶
func (s VisualFrame) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32) gfx.Coord
func (VisualFrame) Visualize ¶
func (r VisualFrame) Visualize(b *Base, bounds Bounds, ctx *RenderContext, out *VertexBuffers)
type VisualShadow ¶
type VisualShadow struct { Shape Shape Blur AmountBounds Offsets AmountBounds AlwaysFill bool }
func (VisualShadow) Init ¶
func (s VisualShadow) Init(b *Base)
func (VisualShadow) PreferredSize ¶
func (s VisualShadow) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32) gfx.Coord
func (VisualShadow) Visualize ¶
func (s VisualShadow) Visualize(b *Base, bounds Bounds, ctx *RenderContext, out *VertexBuffers)
type VisualText ¶
type VisualText struct { Paragraphs Paragraphs VisibleThreshold *GlyphVisibility Clip bool Animation TextAnimation AnimationFactory TextAnimationFactory // contains filtered or unexported fields }
func MustTextToVisual ¶
func MustTextToVisual(text string) *VisualText
func TextToVisual ¶
func TextToVisual(text string) (*VisualText, error)
func (*VisualText) Clipped ¶
func (s *VisualText) Clipped() *VisualText
func (*VisualText) Dirty ¶
func (s *VisualText) Dirty() *VisualText
func (*VisualText) Init ¶
func (s *VisualText) Init(b *Base)
func (*VisualText) Play ¶
func (s *VisualText) Play(factory TextAnimationFactory) *VisualText
func (VisualText) PreferredSize ¶
func (s VisualText) PreferredSize(b *Base, ctx *RenderContext, maxWidth float32) gfx.Coord
func (VisualText) Rendered ¶
func (s VisualText) Rendered() RenderedText
func (VisualText) RenderedBounds ¶
func (s VisualText) RenderedBounds() Bounds
func (*VisualText) SetParagraphs ¶
func (s *VisualText) SetParagraphs(para Paragraphs) *VisualText
func (*VisualText) SetText ¶
func (s *VisualText) SetText(text string) *VisualText
func (*VisualText) Stop ¶
func (s *VisualText) Stop() *VisualText
func (*VisualText) Visibility ¶
func (s *VisualText) Visibility(threshold GlyphVisibility) *VisualText
func (*VisualText) Visualize ¶
func (s *VisualText) Visualize(b *Base, bounds Bounds, ctx *RenderContext, out *VertexBuffers)
func (*VisualText) WillClip ¶
func (s *VisualText) WillClip() bool