uinode

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

This package provides very basic nodes that work with scaffui. These provide a good baseline for implementing more higher-level components like buttons or input fields.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Align

func Align(create func(t *scaff.Tracker, props *AlignProps)) scaffui.NodeBuilder

func Clickable

func Clickable(create func(t *scaff.Tracker, props *ClickableProps)) scaffui.NodeBuilder

func Constrained

func Constrained(create func(t *scaff.Tracker, props *ConstrainedProps)) scaffui.NodeBuilder

func Flex

func Flex(create func(t *scaff.Tracker, props *FlexProps)) scaffui.NodeBuilder

func Image

func Image(create func(t *scaff.Tracker, props *ImageProps)) scaffui.NodeBuilder

The Path to the image (renderer-specific but probably to the file in your assets file system) Set the filter mode used for the image Set the Constraints for the image

func Input

func Input(create func(t *scaff.Tracker, props *InputProps)) scaffui.NodeBuilder

Create a new input node exposing a better interface to handle all kinds of input events coming down from scaffui.

func Padding

func Padding(create func(t *scaff.Tracker, props *PaddingProps)) scaffui.NodeBuilder

func Rectangle

func Rectangle(create func(t *scaff.Tracker, props *RectangleProps)) scaffui.NodeBuilder

func Stack

func Stack(create func(t *scaff.Tracker, props *StackProps)) scaffui.NodeBuilder

func Text

func Text(create func(t *scaff.Tracker, props *TextProps)) scaffui.NodeBuilder

func Thrower

func Thrower(create func(t *scaff.Tracker, tp *ThrowerProps)) scaffui.NodeBuilder

Types

type AlignProps

type AlignProps struct {
	VerticalAlignment  optional.O[VerticalAlignment]
	HorizontalAligment optional.O[HorizontalAlignment]

	*scaffui.AcceptChild
}

type ClickableProps

type ClickableProps struct {
	OnClick        func(button ebiten.MouseButton) bool
	OnClickOutside func() bool
	Cursor         ebiten.CursorShapeType
	*scaffui.AcceptChild
}

type ConstrainedProps

type ConstrainedProps struct {
	Constraints optional.O[scath.Constraints]
	*scaffui.AcceptChild
}

type FlexProps

type FlexProps struct {
	Direction optional.O[LayoutDirection]
	*scaffui.AcceptChildren
	// contains filtered or unexported fields
}

func (*FlexProps) Child

func (fp *FlexProps) Child(i uint, builder scaffui.NodeBuilder)

func (*FlexProps) Expanded

func (fp *FlexProps) Expanded(i uint, factor int, builder scaffui.NodeBuilder)

type HorizontalAlignment

type HorizontalAlignment uint
const (
	HorizontalAlignmentRight  HorizontalAlignment = 0
	HorizontalAlignmentCenter HorizontalAlignment = 1
	HorizontalAlignmentLeft   HorizontalAlignment = 2
)

type ImageProps

type ImageProps struct {
	Constraints optional.O[scath.Constraints]
	Path        string
	FilterMode  ebiten.Filter
	Offset      optional.O[cvnode.TilePosition]
	Frame       optional.O[cvnode.TilePosition]
	*scaffui.AcceptNoChild
}

type InputProps

type InputProps struct {

	// When a mouse button is pressed.
	OnDown func(handled, inside bool, event scaff.PressEvent) bool

	// When a mouse button is released.
	OnRelease func(handled, inside bool, event scaff.ReleaseEvent) bool

	// When the mouse is moved.
	OnMove func(handled, inside bool, event scaff.MoveEvent) bool

	// When scrolling with the mouse or potentially differnet methods when no mouse is available.
	OnScroll func(handled, inside bool, event scaff.ScrollEvent) bool

	// When a key is pressed.
	OnKeyPress func(handled bool, event scaff.KeyPressEvent) bool

	*scaffui.AcceptChild
}

Props for creating a new Input node. All of the listeners should return wether or not the event was handled, meaning no other UI components should handle the event.

type LayoutDirection

type LayoutDirection uint
const (
	LayoutTopToBottom LayoutDirection = 0
	LayoutBottomToTop LayoutDirection = 1
	LayoutLeftToRight LayoutDirection = 2
	LayoutRightToLeft LayoutDirection = 3
)

type PaddingProps

type PaddingProps struct {
	Padding optional.O[scath.Padding]
	*scaffui.AcceptChild
}

type RectangleProps

type RectangleProps struct {
	WantedConstraints scath.Constraints
	Padding           scath.Padding
	FillColor         color.Color
	BorderRadius      float64
	StrokeThickness   float64
	StrokeColor       color.Color

	*scaffui.AcceptChild
}

type StackProps

type StackProps struct {
	*scaffui.AcceptChildren
}

type TextProps

type TextProps struct {
	Text          string
	TextDirection text.Direction
	Wrapping      bool
	Font          string
	FontSize      float64

	// LineSpacing is a percentage (default 0.25) multiplied with the Font size to calculate the spacing between lines. 0 would be no line spacing at all.
	LineSpacing float64

	Color color.Color

	// PrimaryAlign sets the primary alignment direction depending on your Text direction. If you for example choose left to right as your Text direction (the default), this will be horizontal alignment.
	PrimaryAlign text.Align

	// SecondaryAlign sets the secondary alignment direction depending on your Text direction. If you for example choose left to right as your Text direction (the default), this will be vertical alignment.
	SecondaryAlign text.Align

	scaffui.AcceptNoChild
}

type ThrowerProps

type ThrowerProps struct {
	Msg string
	*scaffui.AcceptNoChild
}

type VerticalAlignment

type VerticalAlignment uint
const (
	VerticalAlignmentTop    VerticalAlignment = 0
	VerticalAlignmentCenter VerticalAlignment = 1
	VerticalAlignmentBottom VerticalAlignment = 2
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL