Documentation
¶
Overview ¶
Package ui provides layouts, constraints, reusable controls and composition. Shared scene geometry and rendering belong to scene; retained HTML belongs to ui/html; component storage and queries belong to ecs.
Index ¶
- Constants
- func BindControl[T any](world *ecs.World, entity ecs.Entity, opts ControlOptions, component T) error
- func BindControlComposition(world *ecs.World, composition ControlComposition, owner ecs.Entity, ...) error
- func BindList[T any](world *ecs.World, entity ecs.Entity, opts ListOptions[T]) bool
- func BindPart[T any](world *ecs.World, entity ecs.Entity) error
- func BindRelation[T any](world *ecs.World, entity, owner ecs.Entity) error
- func BindSelector(world *ecs.World, entity ecs.Entity, opts SelectorOptions) error
- func BindVariant[T comparable](world *ecs.World, owner ecs.Entity, variant Variant[T]) error
- func BindVirtualJoystick(world *ecs.World, entity ecs.Entity, opts ControlOptions, ...) error
- func BlurHTMLControl(world *ecs.World, entity ecs.Entity)
- func CaretBlinkDelay(world *ecs.World) (time.Duration, bool)
- func ControlBounds(world *ecs.World, entity ecs.Entity) (float32, float32, bool)
- func FindPart[P, T any](world *ecs.World, owner ecs.Entity) (ecs.Entity, bool)
- func FocusControl(world *ecs.World, entity ecs.Entity) bool
- func FocusedInputSystem(name string) ecs.SystemConfig
- func GetScrollAreaOffset(world *ecs.World, entity ecs.Entity) (mgl32.Vec2, bool)
- func ImageGridCellSize(width float32, columns int, gap float32) float32
- func ImageGridHeight(width float32, itemCount, columns int, gap float32) float32
- func LayoutPending(world *ecs.World) bool
- func ListItemEntities[T any](world *ecs.World, entity ecs.Entity) []ecs.Entity
- func NormalizeNumberInputValue(value string, input NumberInput) (string, bool)
- func RegisterRuntimeExtension(world *ecs.World, extension RuntimeExtension)
- func RegisterRuntimeFeature[T RuntimeFeature](world *ecs.World)
- func ResetHTMLForm(world *ecs.World, owner ecs.Entity, formID string) bool
- func ResetVirtualJoystick(world *ecs.World, entity ecs.Entity) bool
- func SetControlBounds(world *ecs.World, entity ecs.Entity, width, height float32)
- func SetControlDisabled(world *ecs.World, entity ecs.Entity, disabled bool)
- func SetControlInputFilter(world *ecs.World, entity ecs.Entity, filter scene.InputFilter)
- func SetControlPassThrough(world *ecs.World, entity ecs.Entity, passThrough bool)
- func SetControlSelected(world *ecs.World, entity ecs.Entity, selected bool)
- func SetHTMLControlChecked(world *ecs.World, control ecs.Entity, checked bool) bool
- func SetHTMLControlOptionSelected(world *ecs.World, control ecs.Entity, option int, selected bool) bool
- func SetHTMLControlSelected(world *ecs.World, control ecs.Entity, selected int) bool
- func SetHTMLControlSelectionRange(world *ecs.World, control ecs.Entity, anchor, focus int) bool
- func SetHTMLControlValue(world *ecs.World, control ecs.Entity, value string) bool
- func SetHTMLEditableSelection(world *ecs.World, editable ecs.Entity, anchor, focus int) bool
- func SetHTMLEditableValue(world *ecs.World, editable ecs.Entity, value string) bool
- func SetHTMLSelectOpen(world *ecs.World, entity ecs.Entity, open bool)
- func SetListItems[T any](world *ecs.World, entity ecs.Entity, items []T) bool
- func SetPosition(world *ecs.World, entity ecs.Entity, position scene.Val2) bool
- func SetScrollAreaOffset(world *ecs.World, entity ecs.Entity, offset mgl32.Vec2) bool
- func SetSelectorScrollOffset(world *ecs.World, selector ecs.Entity, offset float32) bool
- func SetSize(world *ecs.World, entity ecs.Entity, width, height float32) bool
- func SetText(world *ecs.World, entity ecs.Entity, value string) bool
- func SetVirtualJoystickRawValue(world *ecs.World, entity ecs.Entity, value mgl32.Vec2) bool
- func SpawnButton(world *ecs.World, opts ButtonOptions) ecs.Entity
- func SpawnButtonGroup[T any](world *ecs.World, opts ButtonGroupOptions[T]) ecs.Entity
- func SpawnCheckbox(world *ecs.World, opts CheckboxOptions) ecs.Entity
- func SpawnContextMenu(world *ecs.World, opts ContextMenuOptions) ecs.Entity
- func SpawnControl[T any](world *ecs.World, opts ControlOptions, component T) ecs.Entity
- func SpawnDialog(world *ecs.World, opts DialogOptions) ecs.Entity
- func SpawnImageGrid(world *ecs.World, opts ImageGridOptions) ecs.Entity
- func SpawnInput(world *ecs.World, opts TextOptions) ecs.Entity
- func SpawnLabel(world *ecs.World, opts LabelOptions) ecs.Entity
- func SpawnList[T any](world *ecs.World, opts ListOptions[T]) ecs.Entity
- func SpawnMenu(world *ecs.World, opts MenuOptions) ecs.Entity
- func SpawnNode[T any](world *ecs.World, options NodeOptions, value T) ecs.Entity
- func SpawnNode2[A, B any](world *ecs.World, options NodeOptions, a A, b B) ecs.Entity
- func SpawnNumberInput(world *ecs.World, opts NumberInputOptions) ecs.Entity
- func SpawnPanel(world *ecs.World, opts PanelOptions) ecs.Entity
- func SpawnProgress(world *ecs.World, opts ProgressOptions) ecs.Entity
- func SpawnScrollArea(world *ecs.World, opts ScrollAreaOptions) ecs.Entity
- func SpawnScrollContent(world *ecs.World, area ecs.Entity, x, y float32) ecs.Entity
- func SpawnSelector(world *ecs.World, opts SelectorOptions) ecs.Entity
- func SpawnTab(world *ecs.World, opts TabOptions) ecs.Entity
- func SpawnTabPanel(world *ecs.World, tabs ecs.Entity, opts TabPanelOptions) ecs.Entity
- func SpawnTextarea(world *ecs.World, opts TextOptions) ecs.Entity
- func SpawnTree[T comparable](world *ecs.World, opts TreeOptions[T]) ecs.Entity
- func SpawnVirtualJoystick(world *ecs.World, opts VirtualJoystickOptions) ecs.Entity
- func SpawnWindowTitleBar(world *ecs.World, opts WindowTitleBarOptions) ecs.Entity
- func StepNumberInputValue(value string, input NumberInput, direction int) (string, bool)
- func Sync(world *ecs.World) error
- func SyncAfterLayout(world *ecs.World) error
- func SyncAfterLayoutSystem(name string) ecs.SystemConfig
- func SyncAfterLayoutWith[F RuntimeFeature](world *ecs.World) error
- func SyncHTML(world *ecs.World) error
- func SyncHTMLSystem(name string) ecs.SystemConfig
- func SyncLayoutSystem(name string) ecs.SystemConfig
- func SyncListSystem[T any](name string) ecs.SystemConfig
- func SyncSystem(name string) ecs.SystemConfig
- func SyncTextInputSystem(name string) ecs.SystemConfig
- func SyncTreeSystem[T comparable](name string) ecs.SystemConfig
- func SyncWith[F RuntimeFeature](world *ecs.World) error
- func TextCaretIndex[V piecetree.Value](text *scene.Text2D, value V, x, y float32) int
- func TextareaScrollBarAt(world *ecs.World, screenX, screenY float32) bool
- func UnbindControl(world *ecs.World, entity ecs.Entity)
- func UnbindControlCompositionPart(world *ecs.World, entity ecs.Entity)
- func UnbindVariant[T comparable](world *ecs.World, owner, entity ecs.Entity)
- func UpdateLayout(world *ecs.World) error
- func UpdateSystem(name string) ecs.SystemConfig
- func UpdateWindowTitleBar(world *ecs.World, entity ecs.Entity, opts WindowTitleBarOptions) bool
- type Action
- type AuthoredControls
- type BodyPart
- type Button
- type ButtonContentAlignment
- type ButtonGroup
- type ButtonGroupDividerOptions
- type ButtonGroupItem
- type ButtonGroupOptions
- type ButtonGroupStyle
- type ButtonGroupValue
- type ButtonOptions
- type ButtonStyle
- type ButtonStyles
- type ButtonVariant
- type CaretPart
- type ChangedEvent
- type CheckboxOptions
- type CheckboxStyle
- type CodeToken
- type CompositionNode
- type CompositionNodeKind
- type Content
- type ContextMenu
- type ContextMenuItem
- type ContextMenuOptions
- type ContextMenuPanelPart
- type Control
- type ControlComposition
- type ControlOptions
- type ControlState
- type ControlVariant
- type CornerRadius
- type Danger
- type DecrementPart
- type Dialog
- type DialogOptions
- type FileBrowser
- func (browser *FileBrowser) Entries() ([]FileBrowserEntry, error)
- func (browser *FileBrowser) OpenDirectory(path string) error
- func (browser *FileBrowser) OpenParent() error
- func (browser *FileBrowser) OpenValue(value string) (string, error)
- func (browser *FileBrowser) SaveValue(value string) (string, error)
- func (browser *FileBrowser) Select(path string) error
- type FileBrowserEntry
- type FillPart
- type FocusChangedEvent
- type FrameBorderPart
- type FullRuntime
- type HTMLRenderer
- type HTMLSelectStyle
- type IconContent
- type IconPart
- type IconStyle
- type ImageGrid
- type ImageGridEvent
- type ImageGridItem
- type ImageGridOptions
- type ImageGridStyle
- type IncrementPart
- type Indexed
- type Input
- type InputEvent
- type Item
- type ItemPart
- type KnobPart
- type Label
- type LabelOptions
- type LabelPart
- type Layout
- type LayoutConstraint
- type LayoutHorizontalDirection
- type LayoutResizeMode
- type LayoutStartAxis
- type LayoutType
- type LayoutVerticalDirection
- type LinkActivatedEvent
- type List
- type ListAxis
- type ListItem
- type ListOptions
- type Menu
- type MenuItem
- type MenuOptions
- type MenuPanelPart
- type MenuStyle
- type NodeOptions
- type NodeSpawner
- type NodeSpawner2
- type NumberInput
- type NumberInputBorderPart
- type NumberInputOptions
- type NumberInputStep
- type NumberInputStyle
- type NumberStepIconPart
- type Panel
- type PanelOptions
- type PanelPart
- type PanelStyle
- type Part
- type Progress
- type ProgressOptions
- type ProgressStyle
- type ProgressThumb
- type RefreshHTMLScope
- type Relation
- type RuntimeExtension
- type RuntimeFeature
- type ScrollArea
- type ScrollAreaOptions
- type ScrollContent
- type ScrollMetrics
- type ScrollStyle
- type ScrollThumbHorizontalPart
- type ScrollThumbVerticalPart
- type ScrollTrackHorizontalPart
- type ScrollTrackVerticalPart
- type SelectedEvent
- type SelectionPart
- type Selector
- type SelectorIconPart
- type SelectorItem
- type SelectorList
- type SelectorListPart
- type SelectorOptions
- type SelectorPanelBorderPart
- type SelectorPanelPart
- type SelectorScrollThumbPart
- type SelectorScrollTrackPart
- type SelectorStyle
- type Skin
- type StateStyle
- func (style StateStyle[T]) Resolve(state ControlState) T
- func (style StateStyle[T]) WithDisabled(value T) StateStyle[T]
- func (style StateStyle[T]) WithFocused(value T) StateStyle[T]
- func (style StateStyle[T]) WithHovered(value T) StateStyle[T]
- func (style StateStyle[T]) WithPressed(value T) StateStyle[T]
- func (style StateStyle[T]) WithSelected(value T) StateStyle[T]
- type StyleOverride
- type SubmittedEvent
- type SurfaceStyle
- type Tab
- type TabItem
- type TabItemBorder
- type TabItemBorderPart
- type TabItemBorderSide
- type TabItemSpec
- type TabOptions
- type TabPanel
- type TabPanelOptions
- type TabStyle
- type TextControl
- type TextControlMode
- type TextField
- type TextFieldKeyHandler
- type TextFieldStyle
- type TextOptions
- type Textarea
- type Theme
- type ThumbPart
- type TitlePart
- type Toggle
- type ToggleStyle
- type TrackPart
- type Tree
- type TreeEvent
- type TreeIndicatorImagePart
- type TreeIndicatorTextPart
- type TreeNode
- type TreeNodeSpec
- type TreeOptions
- type TreeStyle
- type TreeTextPart
- type Typography
- type ValuePart
- type Variant
- type Variants
- type VirtualJoystick
- type VirtualJoystickActiveEvent
- type VirtualJoystickAxis
- type VirtualJoystickKnobPart
- type VirtualJoystickOptions
- type VirtualJoystickStyle
- type VirtualJoystickTrackPart
- type Widget
- type WidgetAlignMode
- type Widgets
- type WindowTitleBar
- type WindowTitleBarAction
- type WindowTitleBarButton
- type WindowTitleBarEvent
- type WindowTitleBarItem
- type WindowTitleBarOptions
Constants ¶
const MaxFileBrowserEntries = 2000
const WindowTitleBarButtonWidth float32 = 46
Variables ¶
This section is empty.
Functions ¶
func BindControl ¶
func BindControl[T any](world *ecs.World, entity ecs.Entity, opts ControlOptions, component T) error
BindControl installs reusable control behavior on an existing static entity.
func BindControlComposition ¶
func BindControlComposition(world *ecs.World, composition ControlComposition, owner ecs.Entity, bindButton func(ecs.Entity) error) error
BindControlComposition assigns static descendants to the behavior components already installed on owner. bindButton binds nested button roots when needed.
func BindList ¶
BindList turns an existing scroll area into a virtual list. It is useful for scroll areas authored in a scene, whose transform and visual parts should be preserved.
func BindSelector ¶
BindSelector builds a data-driven selector on an existing UI entity. Its list and option entities are runtime-owned and hidden until opened.
func BindVariant ¶
func BindVirtualJoystick ¶
func BindVirtualJoystick(world *ecs.World, entity ecs.Entity, opts ControlOptions, joystick VirtualJoystick) error
BindVirtualJoystick adds joystick behavior to an authored UI control root. It intentionally does not generate visual parts, letting a scene provide its own art while preserving the same value and event behavior.
func BlurHTMLControl ¶
BlurHTMLControl removes focus from a native HTML control, including its text input and IME state, like HTMLElement.blur().
func CaretBlinkDelay ¶
CaretBlinkDelay is the next visual deadline for a focused text field. An on-demand host can sleep between phases instead of polling every frame.
func ControlBounds ¶
func FocusControl ¶
FocusControl moves native keyboard focus to a control. Passing zero clears focus. Applications can use it after opening a search bar or switching tabs.
func FocusedInputSystem ¶
func FocusedInputSystem(name string) ecs.SystemConfig
func GetScrollAreaOffset ¶
GetScrollAreaOffset exposes positive content offsets while UIScroll retains Clay's non-positive child-offset convention internally.
func ImageGridCellSize ¶
ImageGridCellSize returns the square card size for a grid width.
func ImageGridHeight ¶
ImageGridHeight returns the rendered height of an image grid.
func LayoutPending ¶
LayoutPending reports whether nested constraints need another settling pass.
func ListItemEntities ¶
ListItemEntities returns a copy of the pooled item entity handles.
func NormalizeNumberInputValue ¶
func NormalizeNumberInputValue(value string, input NumberInput) (string, bool)
func RegisterRuntimeExtension ¶
func RegisterRuntimeExtension(world *ecs.World, extension RuntimeExtension)
func RegisterRuntimeFeature ¶
func RegisterRuntimeFeature[T RuntimeFeature](world *ecs.World)
func ResetVirtualJoystick ¶
ResetVirtualJoystick releases a joystick and publishes state changes.
func SetControlBounds ¶
func SetControlDisabled ¶
func SetControlInputFilter ¶
func SetControlPassThrough ¶
func SetControlSelected ¶
func SetHTMLControlChecked ¶
func SetHTMLControlSelected ¶
func SetHTMLControlValue ¶
func SetHTMLEditableValue ¶
func SetHTMLSelectOpen ¶ added in v0.1.8
SetHTMLSelectOpen opens or closes the picker for an HTML select.
func SetListItems ¶
SetListItems replaces a list's data with an owned copy.
func SetPosition ¶
SetPosition changes only a UI node's translation, preserving its other transforms.
func SetScrollAreaOffset ¶
SetScrollAreaOffset updates the single UIScroll state and clamps it to the area's current range.
func SetSelectorScrollOffset ¶
SetSelectorScrollOffset updates the selector list's single UIScroll state using a positive content offset.
func SetSize ¶
SetSize changes the node's measured Size2D. Use SetControlBounds when input target bounds must also change.
func SetText ¶
SetText changes an existing text visual without replacing its layout caches. Equal values and missing components return false and do not mark Changed.
func SetVirtualJoystickRawValue ¶
SetVirtualJoystickRawValue sets a joystick's physical normalized deflection. The value is clamped to the unit circle before Axis and DeadZone are applied.
func SpawnButton ¶
func SpawnButton(world *ecs.World, opts ButtonOptions) ecs.Entity
func SpawnButtonGroup ¶
func SpawnCheckbox ¶
func SpawnCheckbox(world *ecs.World, opts CheckboxOptions) ecs.Entity
func SpawnContextMenu ¶
func SpawnContextMenu(world *ecs.World, opts ContextMenuOptions) ecs.Entity
func SpawnControl ¶
SpawnControl creates a behavior-only control root. Parts are ordinary child entities linked by the behavior that owns them.
func SpawnDialog ¶
func SpawnDialog(world *ecs.World, opts DialogOptions) ecs.Entity
func SpawnImageGrid ¶
func SpawnImageGrid(world *ecs.World, opts ImageGridOptions) ecs.Entity
SpawnImageGrid creates a thumbnail grid. The grid emits ImageGridEvent and EventImageGridRemove when a removable card's close control is activated.
func SpawnInput ¶
func SpawnInput(world *ecs.World, opts TextOptions) ecs.Entity
func SpawnLabel ¶
func SpawnLabel(world *ecs.World, opts LabelOptions) ecs.Entity
func SpawnList ¶
SpawnList creates a virtual list. Its entity count is based on the viewport and overscan, not on the number of items.
func SpawnNode ¶
SpawnNode reuses a factory owned by world. Retain a NewNodeSpawner result when a hot loop should avoid even the factory's type-key lookup.
func SpawnNode2 ¶
func SpawnNumberInput ¶
func SpawnNumberInput(world *ecs.World, opts NumberInputOptions) ecs.Entity
func SpawnPanel ¶
func SpawnPanel(world *ecs.World, opts PanelOptions) ecs.Entity
func SpawnProgress ¶
func SpawnProgress(world *ecs.World, opts ProgressOptions) ecs.Entity
func SpawnScrollArea ¶
func SpawnScrollArea(world *ecs.World, opts ScrollAreaOptions) ecs.Entity
func SpawnScrollContent ¶
func SpawnSelector ¶
func SpawnSelector(world *ecs.World, opts SelectorOptions) ecs.Entity
func SpawnTabPanel ¶
func SpawnTextarea ¶
func SpawnTextarea(world *ecs.World, opts TextOptions) ecs.Entity
func SpawnTree ¶
func SpawnTree[T comparable](world *ecs.World, opts TreeOptions[T]) ecs.Entity
SpawnTree creates typed nodes whose clicks are dispatched by the Widgets UpdateSystem. SyncTreeSystem[T] handles their layout and visual state.
func SpawnVirtualJoystick ¶
func SpawnVirtualJoystick(world *ecs.World, opts VirtualJoystickOptions) ecs.Entity
SpawnVirtualJoystick creates a complete virtual joystick. Set Floating to show its visual parts at the press position instead of keeping them visible. Read VirtualJoystick.Value from the returned entity, or subscribe to ChangedEvent[mgl32.Vec2] and VirtualJoystickActiveEvent.
func SpawnWindowTitleBar ¶
func SpawnWindowTitleBar(world *ecs.World, opts WindowTitleBarOptions) ecs.Entity
SpawnWindowTitleBar creates a reusable custom-window title-bar control group. The returned entity is an invisible layout root; its children are the interactive buttons and carry WindowTitleBarButton actions.
func StepNumberInputValue ¶
func StepNumberInputValue(value string, input NumberInput, direction int) (string, bool)
func SyncAfterLayout ¶
SyncAfterLayout runs registered UI synchronization after layout.
func SyncAfterLayoutSystem ¶
func SyncAfterLayoutSystem(name string) ecs.SystemConfig
func SyncAfterLayoutWith ¶
func SyncAfterLayoutWith[F RuntimeFeature](world *ecs.World) error
SyncAfterLayoutWith runs the selected tool profile after UI layout.
func SyncHTMLSystem ¶
func SyncHTMLSystem(name string) ecs.SystemConfig
func SyncLayoutSystem ¶
func SyncLayoutSystem(name string) ecs.SystemConfig
SyncLayoutSystem applies Layout and Widget components before UI global transforms are propagated. It is intentionally independent of the higher level ui widget runtime so scenes can use these components on their own.
func SyncListSystem ¶
func SyncListSystem[T any](name string) ecs.SystemConfig
SyncListSystem updates the pooled item entities after scrolling or replacing items. Add one system for every item type used by a world.
func SyncSystem ¶
func SyncSystem(name string) ecs.SystemConfig
func SyncTextInputSystem ¶
func SyncTextInputSystem(name string) ecs.SystemConfig
func SyncTreeSystem ¶
func SyncTreeSystem[T comparable](name string) ecs.SystemConfig
func SyncWith ¶
func SyncWith[F RuntimeFeature](world *ecs.World) error
SyncWith synchronizes a statically selected tool profile without changing the features installed in the world's scheduled UI runtime.
func TextCaretIndex ¶
func TextareaScrollBarAt ¶
TextareaScrollBarAt reports whether a screen point is inside a visible textarea scrollbar.
func UnbindControl ¶
UnbindControl removes the behavior installed by BindControl from an existing entity. Authored transform, layout, and visual components are intentionally left to the caller; this function only tears down UI control state and the relations used by static control compositions.
func UnbindControlCompositionPart ¶
UnbindControlCompositionPart removes composition state from one static node.
func UnbindVariant ¶
func UnbindVariant[T comparable](world *ecs.World, owner, entity ecs.Entity)
func UpdateLayout ¶
UpdateLayout immediately applies all Layout and Widget components in world. It is the programmatic equivalent of waiting for the next UI sync frame.
func UpdateSystem ¶
func UpdateSystem(name string) ecs.SystemConfig
func UpdateWindowTitleBar ¶
UpdateWindowTitleBar changes the root bounds and keeps its controls aligned to the right edge of the title bar.
Types ¶
type AuthoredControls ¶
type AuthoredControls struct{}
AuthoredControls enables pointer-state variants for controls whose visuals are authored directly in a scene.
type Button ¶
type Button struct{}
Button marks controls whose reusable behavior is button styling. Activation remains the original scene.InputEventTap and is handled by bound game logic.
type ButtonContentAlignment ¶
type ButtonContentAlignment uint8
ButtonContentAlignment controls how a button arranges its icon and label.
const ( ButtonContentStart ButtonContentAlignment = iota ButtonContentCenter )
type ButtonGroup ¶
type ButtonGroupItem ¶
type ButtonGroupOptions ¶
type ButtonGroupOptions[T any] struct { Divider *ButtonGroupDividerOptions Style *ButtonGroupStyle Items []ButtonGroupItem[T] Theme Theme FontSize float64 DPI float64 X, Y float32 Height float32 Radius CornerRadius PassThrough bool }
type ButtonGroupStyle ¶
type ButtonGroupStyle struct {
Button ButtonStyle
Frame SurfaceStyle
Divider SurfaceStyle
}
type ButtonOptions ¶
type ButtonOptions struct {
Style *ButtonStyle
Label string
Icon IconStyle
Theme Theme
FontSize float64
DPI float64
Radius CornerRadius
X float32
Height float32
Width float32
Y float32
Variant ButtonVariant
JoinLeft bool
JoinRight bool
Disabled bool
PassThrough bool
ContentAlign ButtonContentAlignment
}
type ButtonStyle ¶
type ButtonStyle struct {
Body StateStyle[SurfaceStyle]
JoinedEdge StateStyle[SurfaceStyle]
}
type ButtonStyles ¶
type ButtonStyles struct {
Primary ButtonStyle
Surface ButtonStyle
Danger ButtonStyle
}
type ButtonVariant ¶
type ButtonVariant uint8
const ( ButtonPrimary ButtonVariant = iota ButtonSurface )
type ChangedEvent ¶
type CheckboxOptions ¶
type CheckboxStyle ¶
type CheckboxStyle struct {
Track ToggleStyle[SurfaceStyle]
Mark StateStyle[SurfaceStyle]
}
type CodeToken ¶
CodeToken describes a code token in byte and rune offsets. Offset is the byte position of the requested character; Quoted identifies string contents.
func CodeTokenAt ¶
CodeTokenAt finds the token at a rune index in one allocation-free scan. Words include Unicode letters, digits and combining marks. Quoted contents stay together, excluding their delimiters; other delimiters stay separate.
type CompositionNode ¶
type CompositionNode struct {
Text string
X, Y float32
Width, Height float32
Kind CompositionNodeKind
Visible bool
}
CompositionNode describes one static, visual node available to a control. Behavior is selected exclusively by components installed on the control root.
type CompositionNodeKind ¶
type CompositionNodeKind uint8
const ( CompositionGroup CompositionNodeKind = iota CompositionSprite CompositionText )
type ContextMenu ¶
type ContextMenuItem ¶
type ContextMenuItem = Item[ContextMenu]
type ContextMenuOptions ¶
type ContextMenuPanelPart ¶
type ContextMenuPanelPart struct{}
type Control ¶
type Control struct {
Selected bool
}
Control marks an input target as a styled UI control. Geometry, disabled state, ordering and input state remain in generic ECS components.
type ControlComposition ¶
type ControlComposition map[ecs.Entity]CompositionNode
ControlComposition contains the static nodes that may form control visuals.
type ControlOptions ¶
type ControlState ¶
ControlState is the visual input state shared by interactive widgets.
type ControlVariant ¶
type ControlVariant uint8
const ( VariantAlways ControlVariant = iota VariantInputNormal VariantUnfocusedNormal VariantClosedNormal VariantHovered VariantUnfocusedHovered VariantClosedHovered VariantPressed VariantFocused VariantChecked VariantOpen VariantOpenEnabled )
type CornerRadius ¶
type CornerRadius float32
const Circle CornerRadius = -1
Circle uses the largest radius allowed by the surface dimensions.
type DecrementPart ¶
type DecrementPart struct{}
type DialogOptions ¶
type DialogOptions = PanelOptions
type FileBrowser ¶
type FileBrowser struct {
CurrentDir string
SelectedPath string
Extensions []string
Truncated bool
// contains filtered or unexported fields
}
func NewFileBrowser ¶
func NewFileBrowser(start string, extensions ...string) (FileBrowser, error)
func (*FileBrowser) Entries ¶
func (browser *FileBrowser) Entries() ([]FileBrowserEntry, error)
func (*FileBrowser) OpenDirectory ¶
func (browser *FileBrowser) OpenDirectory(path string) error
func (*FileBrowser) OpenParent ¶
func (browser *FileBrowser) OpenParent() error
func (*FileBrowser) Select ¶
func (browser *FileBrowser) Select(path string) error
type FileBrowserEntry ¶
type FocusChangedEvent ¶
type FrameBorderPart ¶
type FrameBorderPart struct{}
type FullRuntime ¶
type FullRuntime struct{}
FullRuntime selects HTML and widget systems for editor and tool worlds. Optional feature packages can add their own synchronizers with RegisterRuntimeExtension. Widgets also synchronize authored control compositions.
type HTMLRenderer ¶
type HTMLRenderer struct{}
HTMLRenderer enables synchronization of html.Surface components into UI entities. It is kept separate so tools can opt into HTML without enabling Markdown parsing.
type HTMLSelectStyle ¶
type HTMLSelectStyle struct {
Item StateStyle[SurfaceStyle]
Text StateStyle[graphics.ColorRGBA]
}
HTMLSelectStyle supplies native option interaction colors for an HTML surface. Normal option colors continue to come from the authored select control.
type IconContent ¶
type IconContent struct {
Value IconStyle
}
type ImageGrid ¶
type ImageGrid struct {
DeleteIcon IconStyle
Items []ImageGridItem
Columns int
Width float32
Gap float32
Padding float32
LabelHeight float32
}
ImageGrid owns a fixed collection of image cards. Recreate it when the item list or layout changes; moving its entity updates the whole grid.
type ImageGridEvent ¶
ImageGridEvent reports a remove request for a card.
type ImageGridItem ¶
ImageGridItem describes one image card in an ImageGrid.
type ImageGridOptions ¶
type ImageGridOptions struct {
Style *ImageGridStyle
DeleteIcon IconStyle
Items []ImageGridItem
Theme Theme
Columns int
LabelHeight float32
X float32
Padding float32
Gap float32
Radius CornerRadius
Width float32
Y float32
PassThrough bool
}
ImageGridOptions configures an ImageGrid.
type ImageGridStyle ¶
type ImageGridStyle struct {
Remove StateStyle[SurfaceStyle]
Cell SurfaceStyle
}
type IncrementPart ¶
type IncrementPart struct{}
type InputEvent ¶
type LabelOptions ¶
type Layout ¶
type Layout struct {
ConstraintNum int `json:"constraintNum,omitempty"`
Padding scene.UIRect `json:"padding,omitzero"`
CellSize mgl32.Vec2 `json:"cellSize,omitzero"`
SpacingY float32 `json:"spacingY,omitempty"`
PaddingTop float32 `json:"paddingTop,omitempty"`
PaddingBottom float32 `json:"paddingBottom,omitempty"`
PaddingRight float32 `json:"paddingRight,omitempty"`
SpacingX float32 `json:"spacingX,omitempty"`
PaddingLeft float32 `json:"paddingLeft,omitempty"`
VerticalDirection LayoutVerticalDirection `json:"verticalDirection,omitempty"`
HorizontalDirection LayoutHorizontalDirection `json:"horizontalDirection,omitempty"`
Type LayoutType `json:"type,omitempty"`
StartAxis LayoutStartAxis `json:"startAxis,omitempty"`
AffectedByScale bool `json:"affectedByScale,omitempty"`
AutoAlignment bool `json:"autoAlignment,omitempty"`
Constraint LayoutConstraint `json:"constraint,omitempty"`
ResizeMode LayoutResizeMode `json:"resizeMode,omitempty"`
}
Layout is a UI container layout component. Children are the entities that carry Parent{Entity: owner}; authored SiblingOrder values preserve sibling order and Entity values provide a deterministic runtime fallback. PaddingLeft/Right/Top/Bottom are in logical pixels. Padding can be used when percentage or viewport-relative padding is desired.
type LayoutConstraint ¶
type LayoutConstraint uint8
const ( LayoutConstraintNone LayoutConstraint = iota LayoutConstraintFixedRow LayoutConstraintFixedColumn )
type LayoutHorizontalDirection ¶
type LayoutHorizontalDirection uint8
const ( LayoutLeftToRight LayoutHorizontalDirection = iota LayoutRightToLeft )
type LayoutResizeMode ¶
type LayoutResizeMode uint8
LayoutResizeMode controls whether a layout changes its children or itself.
const ( LayoutResizeNone LayoutResizeMode = iota LayoutResizeChildren LayoutResizeContainer )
type LayoutStartAxis ¶
type LayoutStartAxis uint8
const ( LayoutStartHorizontal LayoutStartAxis = iota LayoutStartVertical )
type LayoutType ¶
type LayoutType uint8
LayoutType selects the arrangement performed by Layout.
const ( LayoutNone LayoutType = iota LayoutHorizontal LayoutVertical LayoutGrid )
type LayoutVerticalDirection ¶
type LayoutVerticalDirection uint8
const ( LayoutTopToBottom LayoutVerticalDirection = iota LayoutBottomToTop )
type LinkActivatedEvent ¶
type List ¶
type List[T any] struct { BindItem func(*ecs.World, ecs.Entity, int, T) UnbindItem func(*ecs.World, ecs.Entity) Items []T Overscan int First int Last int ItemSize float32 Axis ListAxis // contains filtered or unexported fields }
List is a virtual list backed by a fixed pool of item entities. Items may be replaced at runtime; changing the viewport or item size requires recreating the list so its item pool remains correctly sized.
type ListAxis ¶
type ListAxis uint8
ListAxis controls the axis along which list items are laid out and scrolled.
type ListItem ¶
ListItem identifies the item currently represented by a pooled item entity. Index is -1 while the entity is not in use.
type ListOptions ¶
type ListOptions[T any] struct { UnbindItem func(*ecs.World, ecs.Entity) BindItem func(*ecs.World, ecs.Entity, int, T) // BuildItem initializes each pooled entity once. Add custom visuals as its // children; BindItem then updates them whenever it represents an item. // UnbindItem resets those visuals when a pooled entity stops representing an // item. It is also called once after BuildItem so empty lists start cleanly. BuildItem func(*ecs.World, ecs.Entity) Style *ScrollStyle Items []T Theme Theme Overscan int ScrollX float32 ThumbBarSize float32 X, Y float32 ScrollY float32 BarSize float32 MinThumbSize float32 ItemSize float32 HoverBarSize float32 Radius CornerRadius Width, Height float32 Axis ListAxis PassThrough bool ReserveScrollbarSpace bool Controlled bool }
type MenuOptions ¶
type MenuPanelPart ¶
type MenuPanelPart struct{}
type MenuStyle ¶
type MenuStyle struct {
Trigger ButtonStyle
Item StateStyle[SurfaceStyle]
Indicator IconStyle
Popup SurfaceStyle
}
type NodeOptions ¶
type NodeOptions struct {
Anchor *scene.Anchor
Parent ecs.Entity
StackIndex int
X, Y float32
Hidden bool
}
NodeOptions describes an unrotated UI node with unit scale. Zero options create a visible top-left node at the origin; Hidden explicitly hides it. A nil Anchor selects TopLeft; use &scene.AnchorCenter for a centered node.
type NodeSpawner ¶
type NodeSpawner[T any] struct { // contains filtered or unexported fields }
NodeSpawner binds the six common UI components plus T to one archetype. T must differ from the fixed components; duplicates panic at construction.
func NewNodeSpawner ¶
func NewNodeSpawner[T any](world *ecs.World) NodeSpawner[T]
func (*NodeSpawner[T]) Reserve ¶
func (s *NodeSpawner[T]) Reserve(capacity int)
func (*NodeSpawner[T]) Spawn ¶
func (s *NodeSpawner[T]) Spawn(options NodeOptions, value T) ecs.Entity
type NodeSpawner2 ¶
type NodeSpawner2[A, B any] struct { // contains filtered or unexported fields }
NodeSpawner2 creates nodes with two additional components in the same write. Use it for e.g. Size2D plus a visual, avoiding a follow-up Insert and migration.
func NewNodeSpawner2 ¶
func NewNodeSpawner2[A, B any](world *ecs.World) NodeSpawner2[A, B]
func (*NodeSpawner2[A, B]) Reserve ¶
func (s *NodeSpawner2[A, B]) Reserve(capacity int)
func (*NodeSpawner2[A, B]) Spawn ¶
func (s *NodeSpawner2[A, B]) Spawn(options NodeOptions, a A, b B) ecs.Entity
type NumberInput ¶
type NumberInputBorderPart ¶
type NumberInputBorderPart struct{}
type NumberInputOptions ¶
type NumberInputOptions struct {
Style *NumberInputStyle
Value string
Placeholder string
UpIcon IconStyle
DownIcon IconStyle
Theme Theme
DPI float64
MaxRunes int
Step float64
FontSize float64
Width, Height float32
Y float32
StepButtonWidth float32
X float32
Radius CornerRadius
Disabled bool
Integer bool
PassThrough bool
}
type NumberInputStep ¶
type NumberInputStyle ¶
type NumberInputStyle struct {
Step StateStyle[SurfaceStyle]
Field TextFieldStyle
}
type NumberStepIconPart ¶
type NumberStepIconPart struct{}
type PanelOptions ¶
type PanelOptions struct {
Style *PanelStyle
Title string
Theme Theme
Border graphics.ColorRGBA
X, Y float32
Width, Height float32
Radius CornerRadius
BorderWidth float32
PassThrough bool
}
type PanelStyle ¶
type PanelStyle struct {
Body SurfaceStyle
}
type ProgressOptions ¶
type ProgressStyle ¶
type ProgressStyle struct {
Track StateStyle[SurfaceStyle]
Thumb StateStyle[SurfaceStyle]
Fill SurfaceStyle
}
type ProgressThumb ¶
ProgressThumb links an authored thumb control to its progress source.
type RefreshHTMLScope ¶ added in v0.1.8
type RefreshHTMLScope func()
RefreshHTMLScope includes newly created UI children in the current scene query scope.
type Relation ¶
Relation links a control part to its owner. T identifies the relation's domain, while semantic purpose is represented by a separate Part marker.
type RuntimeExtension ¶
RuntimeExtension adds an optional synchronizer to an existing UI runtime. Feature packages use this boundary so unused implementations stay out of the core UI binary.
type RuntimeFeature ¶
type RuntimeFeature interface {
// contains filtered or unexported methods
}
RuntimeFeature is a statically selected UI subsystem. Only feature types passed to RegisterRuntimeFeature are retained by the linker.
type ScrollArea ¶
type ScrollArea struct {
// ReserveScrollbarSpace subtracts visible scrollbar gutters from the content viewport.
ReserveScrollbarSpace bool
Width float32
Height float32
ContentWidth float32
ContentHeight float32
Controlled bool
DisableDrag bool
WheelStep float32
BarSize float32
MinThumbSize float32
ThumbBarSize float32
HoverBarSize float32
HoverHorizontal bool
HoverVertical bool
DraggingHorizontal bool
DraggingVertical bool
StackIndex int
// ScrollBarStackIndex overrides the visual layer of scrollbar parts; zero follows StackIndex.
ScrollBarStackIndex int
}
func (ScrollArea) Measure ¶
func (area ScrollArea) Measure() ScrollMetrics
Measure derives the viewport and scroll range without allocating.
type ScrollAreaOptions ¶
type ScrollAreaOptions struct {
Style *ScrollStyle
Theme Theme
ScrollBarStackIndex int
ScrollX float32
Width float32
ContentWidth float32
ContentHeight float32
X, Y float32
WheelStep float32
Radius CornerRadius
ScrollY float32
BarSize float32
MinThumbSize float32
ThumbBarSize float32
HoverBarSize float32
Height float32
ReserveScrollbarSpace bool
PassThrough bool
DisableDrag bool
Controlled bool
}
type ScrollMetrics ¶
type ScrollMetrics struct {
ViewportWidth float32
ViewportHeight float32
MaxScrollX float32
MaxScrollY float32
HorizontalVisible bool
VerticalVisible bool
}
func GetScrollAreaMetrics ¶
GetScrollAreaMetrics derives viewport and range data from the current area configuration.
func MeasureScrollArea ¶
func MeasureScrollArea(width, height, contentWidth, contentHeight float32) ScrollMetrics
type ScrollStyle ¶
type ScrollStyle struct {
Thumb StateStyle[SurfaceStyle]
Track SurfaceStyle
}
type ScrollThumbHorizontalPart ¶
type ScrollThumbHorizontalPart struct{}
type ScrollThumbVerticalPart ¶
type ScrollThumbVerticalPart struct{}
type ScrollTrackHorizontalPart ¶
type ScrollTrackHorizontalPart struct{}
type ScrollTrackVerticalPart ¶
type ScrollTrackVerticalPart struct{}
type SelectionPart ¶
type SelectionPart struct{}
type SelectorIconPart ¶
type SelectorIconPart struct{}
type SelectorItem ¶
type SelectorList ¶
type SelectorListPart ¶
type SelectorListPart struct{}
type SelectorOptions ¶
type SelectorOptions struct {
Style *SelectorStyle
Label string
Icon IconStyle
Options []string
Theme Theme
Selected int
ScrollY float32
Height float32
ItemHeight float32
ListHeight float32
X float32
Radius CornerRadius
Width float32
Y float32
Disabled bool
PassThrough bool
Upward bool
JoinLeft bool
JoinRight bool
}
type SelectorPanelBorderPart ¶
type SelectorPanelBorderPart struct{}
type SelectorPanelPart ¶
type SelectorPanelPart struct{}
type SelectorScrollThumbPart ¶
type SelectorScrollThumbPart struct{}
type SelectorScrollTrackPart ¶
type SelectorScrollTrackPart struct{}
type SelectorStyle ¶
type SelectorStyle struct {
Body StateStyle[SurfaceStyle]
Item StateStyle[SurfaceStyle]
Popup SurfaceStyle
}
type Skin ¶
type Skin struct {
Button ButtonStyles
NumberInput NumberInputStyle
Checkbox CheckboxStyle
Selector SelectorStyle
Progress ProgressStyle
VirtualJoystick VirtualJoystickStyle
ImageGrid ImageGridStyle
Scroll ScrollStyle
Menu MenuStyle
ContextMenu MenuStyle
Tree TreeStyle
Tab TabStyle
ButtonGroup ButtonGroupStyle
TextField TextFieldStyle
Panel PanelStyle
}
Skin contains the visual styles used by all built-in widgets.
func DefaultSkin ¶
type StateStyle ¶
type StateStyle[T any] struct { Normal T Hovered *T Pressed *T Selected *T Focused *T Disabled *T }
StateStyle resolves a value for an input state. Missing overrides fall back to Normal.
func NewStateStyle ¶
func NewStateStyle[T any](normal T) StateStyle[T]
func (StateStyle[T]) Resolve ¶
func (style StateStyle[T]) Resolve(state ControlState) T
func (StateStyle[T]) WithDisabled ¶
func (style StateStyle[T]) WithDisabled(value T) StateStyle[T]
func (StateStyle[T]) WithFocused ¶
func (style StateStyle[T]) WithFocused(value T) StateStyle[T]
func (StateStyle[T]) WithHovered ¶
func (style StateStyle[T]) WithHovered(value T) StateStyle[T]
func (StateStyle[T]) WithPressed ¶
func (style StateStyle[T]) WithPressed(value T) StateStyle[T]
func (StateStyle[T]) WithSelected ¶
func (style StateStyle[T]) WithSelected(value T) StateStyle[T]
type StyleOverride ¶
type StyleOverride[T any] struct { Value T }
StyleOverride stores a strongly typed per-entity style override.
type SubmittedEvent ¶
type SurfaceStyle ¶
SurfaceStyle describes the independently rendered background, image and border layers.
func ColorSurface ¶
func ColorSurface(color graphics.ColorRGBA) SurfaceStyle
func NineSliceSurface ¶
func NineSliceSurface(texture *graphics.Texture, slice scene.NineSlice2D) SurfaceStyle
func TextureSurface ¶
func TextureSurface(texture *graphics.Texture) SurfaceStyle
func (SurfaceStyle) WithBackground ¶
func (surface SurfaceStyle) WithBackground(shape scene.Shape2D) SurfaceStyle
func (SurfaceStyle) WithBorder ¶
func (surface SurfaceStyle) WithBorder(shape scene.Shape2D) SurfaceStyle
type TabItemBorder ¶
type TabItemBorder struct {
Side TabItemBorderSide
}
type TabItemBorderPart ¶
type TabItemBorderPart struct{}
type TabItemBorderSide ¶
type TabItemBorderSide uint8
const ( TabItemBorderTop TabItemBorderSide = iota TabItemBorderRight TabItemBorderBottom TabItemBorderLeft )
type TabItemSpec ¶
type TabOptions ¶
type TabPanelOptions ¶
type TabPanelOptions struct {
Style *TabStyle
Theme Theme
Index int
Radius CornerRadius
PassThrough bool
}
type TabStyle ¶
type TabStyle struct {
Frame SurfaceStyle
Item ToggleStyle[SurfaceStyle]
Panel SurfaceStyle
}
type TextControl ¶
type TextControl[T TextControlMode] struct { Value string Placeholder string Password bool Wrap bool Padding float32 MaxRunes int FontSize float64 DPI float64 }
TextControl configures explicit text-field behavior for an existing control root. T selects single-line Input or multiline Textarea behavior in code.
type TextControlMode ¶
type TextFieldKeyHandler ¶
TextFieldKeyHandler intercepts keyboard editing before native text input and focus traversal. Returning true lets editor widgets own Enter, Tab, arrows and Escape without also inserting text or moving the document caret.
type TextFieldStyle ¶
type TextFieldStyle struct {
Body StateStyle[SurfaceStyle]
Caret SurfaceStyle
Selection SurfaceStyle
}
type TextOptions ¶
type Textarea ¶
type Textarea struct {
// WrapWidthPercent scales the available content width; zero uses the full width.
WrapWidthPercent float32
// BarSize is the scrollbar width; zero uses the default and a negative value hides the bar while keeping scrolling.
BarSize float32
// WheelStep is the distance per wheel unit; zero uses the UI default.
WheelStep float32
Padding float32
ScrollX float32
ScrollY float32
// CaptureTab lets a code editor handle Tab without moving focus.
CaptureTab bool
// FollowTail reveals the end when the value or viewport changes, even without focus.
FollowTail bool
DisableHorizontalScroll bool
Wrap bool
// SelectTokens selects a code word, operator or quoted contents on a mouse double-click.
SelectTokens bool
// WrapTokens preserves words and identifiers, allowing long tokens to overflow.
WrapTokens bool
// contains filtered or unexported fields
}
Textarea stores multiline text behavior, content padding, and the current content offset. Scroll offsets use positive coordinates from the content's top-left corner.
func (*Textarea) ResetScroll ¶
func (textarea *Textarea) ResetScroll()
ResetScroll returns the viewport to its origin and releases scrollbar dragging.
func (*Textarea) RestoreScroll ¶
RestoreScroll restores a saved viewport without revealing the caret on the next layout pass. Layout still clamps the offset to the current content.
type Theme ¶
type Theme struct {
Font *onixtext.Font
FontSize float64
DPI float64
StackIndex int
Background graphics.ColorRGBA
Surface graphics.ColorRGBA
SurfaceHover graphics.ColorRGBA
SurfaceActive graphics.ColorRGBA
SurfaceDisabled graphics.ColorRGBA
Primary graphics.ColorRGBA
PrimaryHover graphics.ColorRGBA
PrimaryActive graphics.ColorRGBA
Text graphics.ColorRGBA
Muted graphics.ColorRGBA
Accent graphics.ColorRGBA
Danger graphics.ColorRGBA
Selection graphics.ColorRGBA
}
func DefaultTheme ¶
func DefaultTheme() Theme
func ThemeForWorld ¶
ThemeForWorld resolves a theme against the world's configured theme.
func ThemeWithDefaults ¶
ThemeWithDefaults fills omitted values with the standard UI theme.
type Toggle ¶
type Toggle[T comparable] struct { Value T Off T On T Changed bool }
type ToggleStyle ¶
type ToggleStyle[T any] struct { Off StateStyle[T] On StateStyle[T] }
ToggleStyle contains input styles for off/on or unselected/selected states.
func (ToggleStyle[T]) Resolve ¶
func (style ToggleStyle[T]) Resolve(on bool, state ControlState) T
type Tree ¶
type Tree[T comparable] struct { Selected T HasSelection bool Width float32 RowHeight float32 }
type TreeIndicatorImagePart ¶
type TreeIndicatorImagePart struct{}
type TreeIndicatorTextPart ¶
type TreeIndicatorTextPart struct{}
type TreeNodeSpec ¶
type TreeNodeSpec[T comparable] struct { ID T Parent T Label string HasParent bool Expanded bool Leaf bool }
type TreeOptions ¶
type TreeOptions[T comparable] struct { Style *TreeStyle Nodes []TreeNodeSpec[T] Theme Theme X, Y float32 Width float32 RowHeight float32 Radius CornerRadius PassThrough bool }
type TreeStyle ¶
type TreeStyle struct {
Row ToggleStyle[SurfaceStyle]
Collapsed IconStyle
Expanded IconStyle
Leaf IconStyle
Background SurfaceStyle
}
type TreeTextPart ¶
type TreeTextPart struct{}
type Variant ¶
type Variant[T comparable] struct { State T Entity ecs.Entity Enabled bool }
Variant associates an entity with one strongly typed owner state.
type Variants ¶
type Variants[T comparable] struct { Items []Variant[T] }
Variants stores the authored entities controlled by one state domain.
type VirtualJoystick ¶
type VirtualJoystick struct {
Value mgl32.Vec2
RawValue mgl32.Vec2
DeadZone float32
Axis VirtualJoystickAxis
Active bool
Floating bool
Track ecs.Entity
Knob ecs.Entity
// contains filtered or unexported fields
}
VirtualJoystick stores the normalized output of a virtual joystick. RawValue retains the clamped physical deflection, while Value applies Axis and DeadZone. Track and Knob are optional visual part entities. Floating joysticks show those parts at the initial press position until release.
type VirtualJoystickActiveEvent ¶
VirtualJoystickActiveEvent is emitted when a joystick is engaged or reset.
type VirtualJoystickAxis ¶
type VirtualJoystickAxis uint8
VirtualJoystickAxis limits a virtual joystick to one or both axes.
const ( VirtualJoystickBoth VirtualJoystickAxis = iota VirtualJoystickHorizontal VirtualJoystickVertical )
type VirtualJoystickKnobPart ¶
type VirtualJoystickKnobPart struct{}
type VirtualJoystickOptions ¶
type VirtualJoystickOptions struct {
Style *VirtualJoystickStyle
Theme Theme
X, Y float32
Size float32
KnobSize float32
DeadZone float32
Axis VirtualJoystickAxis
Floating bool
Disabled bool
PassThrough bool
}
VirtualJoystickOptions configures a generated virtual joystick. Size is the diameter of its touch area and visual track. A non-positive size uses 120.
type VirtualJoystickStyle ¶
type VirtualJoystickStyle struct {
Track StateStyle[SurfaceStyle]
Knob StateStyle[SurfaceStyle]
}
VirtualJoystickStyle controls the track and thumb of a virtual joystick. Both parts resolve against the root control's pointer state.
type VirtualJoystickTrackPart ¶
type VirtualJoystickTrackPart struct{}
type Widget ¶
type Widget struct {
TargetID string `json:"target,omitempty"`
Target ecs.Entity `json:"-"`
Left scene.Val `json:"left,omitzero"`
Right scene.Val `json:"right,omitzero"`
Top scene.Val `json:"top,omitzero"`
Bottom scene.Val `json:"bottom,omitzero"`
AlignLeft bool `json:"alignLeft,omitempty"`
AlignRight bool `json:"alignRight,omitempty"`
AlignTop bool `json:"alignTop,omitempty"`
AlignBottom bool `json:"alignBottom,omitempty"`
AlignMode WidgetAlignMode `json:"alignMode,omitempty"`
Enabled bool `json:"enabled,omitempty"`
}
Widget pins a UI node to its parent's constraint box. A zero Target uses the entity's Parent; an explicit Target supports pinning to another UI node. TargetID is the stable scene-facing form of Target. Margins use Val, so Px, Percent and viewport units can be mixed.
func (*Widget) UnmarshalJSON ¶
type WidgetAlignMode ¶
type WidgetAlignMode uint8
WidgetAlignMode determines how often a Widget recomputes its constraints.
const ( WidgetAlignAlways WidgetAlignMode = iota WidgetAlignOnce WidgetAlignOnWindowResize )
type Widgets ¶
type Widgets struct{}
Widgets enables the reusable control input and visual systems, except Markdown rendering and focused text-input dispatch.
type WindowTitleBar ¶
WindowTitleBar describes a reusable custom window title bar and its controls.
type WindowTitleBarAction ¶
type WindowTitleBarAction uint8
WindowTitleBarAction identifies a standard custom-window control.
const ( WindowTitleBarMinimize WindowTitleBarAction = iota WindowTitleBarMaximize WindowTitleBarClose WindowTitleBarFullscreen )
type WindowTitleBarButton ¶
type WindowTitleBarButton struct {
Bar ecs.Entity
Action WindowTitleBarAction
}
WindowTitleBarButton binds a standard window action to a button entity.
type WindowTitleBarEvent ¶
type WindowTitleBarEvent struct {
Bar ecs.Entity
Button ecs.Entity
Action WindowTitleBarAction
}
WindowTitleBarEvent is emitted when a title-bar button is activated.
type WindowTitleBarItem ¶
type WindowTitleBarItem struct {
Style *ButtonStyle
Icon IconStyle
Width float32
Action WindowTitleBarAction
}
WindowTitleBarItem configures one standard title-bar control.
type WindowTitleBarOptions ¶
type WindowTitleBarOptions struct {
Items []WindowTitleBarItem
Theme Theme
StackIndex int
X, Y float32
Width float32
Height float32
Radius CornerRadius
PassThrough bool
}
Source Files
¶
- components.go
- composition.go
- control_composition.go
- control_removal.go
- doc.go
- file_browser.go
- focus.go
- html.go
- html_bridge.go
- html_focus.go
- image_grid.go
- layout.go
- layout_json.go
- layout_pending.go
- list.go
- node.go
- registered_systems.go
- scroll.go
- spawn.go
- style.go
- sync_value.go
- system.go
- system_composition.go
- system_input.go
- system_text_input.go
- system_text_metrics.go
- system_visual_text.go
- text_history.go
- text_navigation.go
- theme.go
- tree.go
- update.go
- virtual_joystick.go