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 ¶
- func Align(create func(t *scaff.Tracker, props *AlignProps)) scaffui.NodeBuilder
- func Clickable(create func(t *scaff.Tracker, props *ClickableProps)) scaffui.NodeBuilder
- func Constrained(create func(t *scaff.Tracker, props *ConstrainedProps)) scaffui.NodeBuilder
- func Flex(create func(t *scaff.Tracker, props *FlexProps)) scaffui.NodeBuilder
- func Image(create func(t *scaff.Tracker, props *ImageProps)) scaffui.NodeBuilder
- func Input(create func(t *scaff.Tracker, props *InputProps)) scaffui.NodeBuilder
- func Padding(create func(t *scaff.Tracker, props *PaddingProps)) scaffui.NodeBuilder
- func Rectangle(create func(t *scaff.Tracker, props *RectangleProps)) scaffui.NodeBuilder
- func Stack(create func(t *scaff.Tracker, props *StackProps)) scaffui.NodeBuilder
- func Text(create func(t *scaff.Tracker, props *TextProps)) scaffui.NodeBuilder
- func Thrower(create func(t *scaff.Tracker, tp *ThrowerProps)) scaffui.NodeBuilder
- type AlignProps
- type ClickableProps
- type ConstrainedProps
- type FlexProps
- type HorizontalAlignment
- type ImageProps
- type InputProps
- type LayoutDirection
- type PaddingProps
- type RectangleProps
- type StackProps
- type TextProps
- type ThrowerProps
- type VerticalAlignment
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 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 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
}
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 RectangleProps ¶
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 )
Click to show internal directories.
Click to hide internal directories.