Documentation
¶
Overview ¶
Code generated by internal/uibinarygen; DO NOT EDIT.
Package ui defines bounded author-owned presentation assets shared by the build pipeline and host. It has no dependency on a rendering library.
Index ¶
Constants ¶
const ( LengthAuto uint8 = iota LengthPixels LengthPercent )
const ( PercentScale = 10000 MaxDimensionPixels = 2048 )
const ( MaxAssetBytes = 64 * 1024 MaxElements = 64 MaxTextBytes = 4096 MaxNameBytes = 128 MaxRows = 256 MaxTransitionMilliseconds = 2000 BackElementID uint32 = MaxElements + 1 AssetPrefix = "karty.ui/" FontAssetPrefix = "karty.font/" SectionName = "karty.ui.v1" SchemaComposition uint32 = 2 SchemaStyle uint32 = 3 SchemaImageStyle uint32 = 4 SchemaLayout uint32 = 5 SchemaResponsive uint32 = 6 SchemaControlTransition uint32 = 7 SchemaVisualHierarchy uint32 = 8 SchemaInteractionPolish uint32 = 9 SchemaWidgets uint32 = 10 SchemaSizing uint32 = 11 MinResponsiveWidth = 240 MaxResponsiveWidth = 1024 )
const ( StyleBackground uint32 = 1 << iota StyleBackgroundHover StyleBackgroundPressed StyleColor StylePadding StyleGap StyleFontSize StyleMinHeight StyleBackgroundImage StyleBackgroundImageHover StyleBackgroundImagePressed StyleBackgroundDisabled StyleBackgroundImageDisabled StyleColorHover StyleColorPressed StyleColorDisabled StyleFlexDirection StyleAlignItems StyleMinWidth StyleMaxWidth StyleMaxHeight StyleJustifyContent StyleFlexGrow StyleMargin StyleOverflow StyleTransitionDuration StyleTransitionEnter StyleTransitionExit StyleTextAlign StyleFontFamily StyleContentImage )
const ( Style2BackgroundFocus uint32 = 1 << iota Style2BackgroundImageFocus Style2ColorFocus Style2TransitionDelay Style2TransitionEasing Style2Position Style2Left Style2Right Style2Top Style2Bottom Style2ImageFit Style2Tint Style2Icon Style2IconSize Style2IconPosition Style2IconGap Style2Width Style2Height )
const ( FlexDirectionColumn uint8 = iota + 1 FlexDirectionRow )
const ( AlignItemsStart uint8 = iota + 1 AlignItemsCenter AlignItemsEnd AlignItemsStretch )
const ( JustifyContentStart uint8 = iota + 1 JustifyContentCenter JustifyContentEnd JustifyContentSpaceBetween )
const ( OverflowVisible uint8 = iota + 1 OverflowScroll )
const ( TransitionNone uint8 = iota TransitionLeft TransitionRight TransitionTop TransitionBottom )
const ( TransitionEasingLinear uint8 = iota + 1 TransitionEasingOut TransitionEasingInOut )
const ( ImageFitStretch uint8 = iota + 1 ImageFitContain ImageFitCover )
const ( IconPositionStart uint8 = iota + 1 IconPositionEnd )
const ( TextAlignStart uint8 = iota + 1 TextAlignCenter TextAlignEnd )
const ( FontFamilyBody uint8 = iota + 1 FontFamilyDisplay FontFamilyMono )
const ( ImageScopeGame uint8 = iota + 1 ImageScopeLevel )
const BinaryVersion = 1
const PositionOverlay uint8 = 1
Variables ¶
var ErrTemplate = errors.New("invalid UI template")
Functions ¶
func EncodeComposition ¶
func ValidateStyle ¶ added in v0.0.5
ValidateStyle checks a resolved style against a widget's complete current presentation contract. Authoring compilers may use this to omit invalid declarations; serialized templates still undergo strict versioned validation.
Types ¶
type Element ¶
type Element struct {
ID uint32
Parent uint32
Name string
Kind string
Text string
Action uint32
Value string
Min int32
Max int32
Placeholder string
Tooltip string
Style Style
// ResponsiveStyle is the fully resolved style selected at or below the
// template's ResponsiveMaxWidth. A zero Set inherits Style unchanged.
ResponsiveStyle Style
}
func (Element) ValidValue ¶ added in v0.0.5
ValidValue checks a control's canonical wire value. Selection membership is checked by the host against the complete staged tree and its current rows.
type Image ¶
type Image struct {
Scope uint8
Name string
AssetID uint32
Top uint16
Right uint16
Bottom uint16
Left uint16
}
Image is a compiler-resolved nine-slice reference. Game images use a logical name; level images use the stable numeric ID from their owning .kld.
type Length ¶ added in v0.0.5
Length stores logical pixels or hundredths of a percent; zero means auto. A style presence bit distinguishes an explicit auto override from omission.
type Style ¶
type Style struct {
Set uint32
Set2 uint32
Background uint32
BackgroundHover uint32
BackgroundPressed uint32
Color uint32
Padding uint16
Gap uint16
FontSize uint16
MinHeight uint16
BackgroundImage Image
BackgroundImageHover Image
BackgroundImagePressed Image
BackgroundDisabled uint32
BackgroundImageDisabled Image
ColorHover uint32
ColorPressed uint32
ColorDisabled uint32
FlexDirection uint8
AlignItems uint8
MinWidth uint16
MaxWidth uint16
MaxHeight uint16
JustifyContent uint8
FlexGrow uint8
Margin uint16
Overflow uint8
TransitionDuration uint16
TransitionEnter uint8
TransitionExit uint8
TextAlign uint8
FontFamily uint8
ContentImage Image
BackgroundFocus uint32
BackgroundImageFocus Image
ColorFocus uint32
TransitionDelay uint16
TransitionEasing uint8
Position uint8
Left uint16
Right uint16
Top uint16
Bottom uint16
ImageFit uint8
Tint uint32
Icon Image
IconSize uint16
IconPosition uint8
IconGap uint16
Width Length
Height Length
}
Style is a compact, compiler-resolved presentation value. Set distinguishes an authored zero/transparent value from an omitted property.
type Template ¶
type Template struct {
Version uint32
Modal bool
Back bool
Panel Style
ResponsiveMaxWidth uint16
ResponsivePanel Style
Elements []Element
}
Template version 1 is a vertical panel of named labels, buttons, and lists. A modal panel captures game input. Schema 9 also permits actionable nonmodal HUD controls; older nonmodal templates retain their noninteractive contract.
func DecodeComposition ¶
DecodeComposition accepts all versioned retained-tree presentation schemas.
func (Template) ValidateComposition ¶
ValidateComposition also accepts composition, style, layout, and responsive schemas. Legacy packaging continues using Validate, which accepts schema 1 only.