Documentation
¶
Index ¶
- Variables
- func DrawButtonBackground(screen *ebiten.Image, hover bool, x, y, w, h float64)
- func DrawInputBackground(screen *ebiten.Image, focused bool, x, y, w, h float64)
- func DrawNeutralTooltip(screen *ebiten.Image, x, y, w, h float64)
- func DrawTextTooltip(screen *ebiten.Image, cursorX, cursorY int, preferredSide TooltipSide, ...)
- func DrawTooltipBackground(screen *ebiten.Image, x, y, w, h float64)
- func ImmediateDraw(screen *ebiten.Image, child Component)
- type AvailableCraftsList
- func (b AvailableCraftsList) Align(alignment ComponentAlignment) *baseComponent
- func (b AvailableCraftsList) Alignment() ComponentAlignment
- func (b AvailableCraftsList) HasCustomStyles() bool
- func (b AvailableCraftsList) ID() uint64
- func (craftList *AvailableCraftsList) SetAvailableCrafts(availableCrafts []types.Craft)
- func (b AvailableCraftsList) SetParent(parent Component)
- func (craftList *AvailableCraftsList) SetSelectedCraft(selectedCraft int)
- func (b AvailableCraftsList) Style() *ComponentStyle
- type BackgroundColorComponent
- func (b *BackgroundColorComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *BackgroundColorComponent) Alignment() ComponentAlignment
- func (b *BackgroundColorComponent) CapacityForChild(_ Component) (float64, float64)
- func (b *BackgroundColorComponent) Children() []Component
- func (b *BackgroundColorComponent) ComputedSize() (float64, float64)
- func (b *BackgroundColorComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *BackgroundColorComponent) HasCustomStyles() bool
- func (b *BackgroundColorComponent) ID() uint64
- func (b *BackgroundColorComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (b *BackgroundColorComponent) MaxSize() (float64, float64)
- func (b *BackgroundColorComponent) SetParent(parent Component)
- func (b *BackgroundColorComponent) Style() *ComponentStyle
- func (b *BackgroundColorComponent) Update() error
- type BackgroundImageComponent
- func BackgroundImage(mode BackgroundImageRenderingMode, texture *ebiten.Image, child Component) *BackgroundImageComponent
- func StretchBackgroundImage(texture types.Texture, child Component) *BackgroundImageComponent
- func TileBackgroundImage(texture types.Texture, child Component) *BackgroundImageComponent
- func (b *BackgroundImageComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *BackgroundImageComponent) Alignment() ComponentAlignment
- func (b *BackgroundImageComponent) CapacityForChild(_ Component) (float64, float64)
- func (b *BackgroundImageComponent) Children() []Component
- func (b *BackgroundImageComponent) ComputedSize() (float64, float64)
- func (b *BackgroundImageComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *BackgroundImageComponent) HasCustomStyles() bool
- func (b *BackgroundImageComponent) ID() uint64
- func (b *BackgroundImageComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (b *BackgroundImageComponent) MaxSize() (float64, float64)
- func (b *BackgroundImageComponent) SetParent(parent Component)
- func (b *BackgroundImageComponent) Style() *ComponentStyle
- func (b *BackgroundImageComponent) Update() error
- type BackgroundImageRenderingMode
- type ButtonComponent
- func (b *ButtonComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *ButtonComponent) Alignment() ComponentAlignment
- func (b *ButtonComponent[T]) CapacityForChild(_ Component) (float64, float64)
- func (b *ButtonComponent[T]) Children() []Component
- func (b *ButtonComponent[T]) ComputedSize() (float64, float64)
- func (b *ButtonComponent[T]) Draw(screen *ebiten.Image, x, y float64) error
- func (b *ButtonComponent) HasCustomStyles() bool
- func (b *ButtonComponent) ID() uint64
- func (b *ButtonComponent[T]) IsPressed() bool
- func (b *ButtonComponent[T]) MaxCapacityForChild(_ Component) (float64, float64)
- func (b *ButtonComponent[T]) MaxSize() (float64, float64)
- func (b *ButtonComponent[T]) Press()
- func (b *ButtonComponent) SetParent(parent Component)
- func (b *ButtonComponent) Style() *ComponentStyle
- func (b *ButtonComponent[T]) Update() error
- type ButtonView
- type CenterComponent
- func (b *CenterComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *CenterComponent) Alignment() ComponentAlignment
- func (c *CenterComponent) CapacityForChild(_ Component) (float64, float64)
- func (c *CenterComponent) Children() []Component
- func (c *CenterComponent) ComputedSize() (w, h float64)
- func (c *CenterComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *CenterComponent) HasCustomStyles() bool
- func (b *CenterComponent) ID() uint64
- func (c *CenterComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (c *CenterComponent) MaxSize() (float64, float64)
- func (b *CenterComponent) SetParent(parent Component)
- func (b *CenterComponent) Style() *ComponentStyle
- func (c *CenterComponent) Update() error
- type CompassComponent
- func (b *CompassComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *CompassComponent) Alignment() ComponentAlignment
- func (compass *CompassComponent) CapacityForChild(_ Component) (float64, float64)
- func (compass *CompassComponent) Children() []Component
- func (compass *CompassComponent) ComputedSize() (float64, float64)
- func (compass *CompassComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *CompassComponent) HasCustomStyles() bool
- func (b *CompassComponent) ID() uint64
- func (compass *CompassComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (compass *CompassComponent) MaxSize() (float64, float64)
- func (b *CompassComponent) SetParent(parent Component)
- func (b *CompassComponent) Style() *ComponentStyle
- func (compass *CompassComponent) Update() error
- type Component
- type ComponentAlignment
- type ComponentStyle
- type CraftDescription
- func (b CraftDescription) Align(alignment ComponentAlignment) *baseComponent
- func (b CraftDescription) Alignment() ComponentAlignment
- func (b CraftDescription) HasCustomStyles() bool
- func (b CraftDescription) ID() uint64
- func (craftDescription *CraftDescription) SetCraft(craft types.Craft)
- func (b CraftDescription) SetParent(parent Component)
- func (b CraftDescription) Style() *ComponentStyle
- type FocusView
- type FormComponent
- func (b *FormComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *FormComponent) Alignment() ComponentAlignment
- func (f *FormComponent) CapacityForChild(_ Component) (float64, float64)
- func (f *FormComponent) Children() []Component
- func (f *FormComponent) ComputedSize() (float64, float64)
- func (f *FormComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *FormComponent) HasCustomStyles() bool
- func (b *FormComponent) ID() uint64
- func (f *FormComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (f *FormComponent) MaxSize() (float64, float64)
- func (b *FormComponent) SetParent(parent Component)
- func (b *FormComponent) Style() *ComponentStyle
- func (f *FormComponent) Update() error
- type FormPrompt
- type ImageComponent
- func (b *ImageComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *ImageComponent) Alignment() ComponentAlignment
- func (image *ImageComponent) CapacityForChild(_ Component) (float64, float64)
- func (image *ImageComponent) Children() []Component
- func (image *ImageComponent) ComputedSize() (float64, float64)
- func (image *ImageComponent) DisableScaling() *ImageComponent
- func (image *ImageComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *ImageComponent) HasCustomStyles() bool
- func (b *ImageComponent) ID() uint64
- func (image *ImageComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (image *ImageComponent) MaxSize() (float64, float64)
- func (b *ImageComponent) SetParent(parent Component)
- func (b *ImageComponent) Style() *ComponentStyle
- func (image *ImageComponent) Update() error
- type InputComponent
- func (b *InputComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *InputComponent) Alignment() ComponentAlignment
- func (i *InputComponent) CapacityForChild(_ Component) (float64, float64)
- func (i *InputComponent) Children() []Component
- func (i *InputComponent) ComputedSize() (float64, float64)
- func (i *InputComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *InputComponent) Focused() bool
- func (b *InputComponent) HasCustomStyles() bool
- func (b *InputComponent) ID() uint64
- func (i *InputComponent) Input() string
- func (i *InputComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (i *InputComponent) MaxSize() (float64, float64)
- func (b *InputComponent) SetFocused(focused bool)
- func (i *InputComponent) SetInput(input string)
- func (b *InputComponent) SetParent(parent Component)
- func (b *InputComponent) Style() *ComponentStyle
- func (i *InputComponent) Update() error
- func (i *InputComponent) WithMaxInputLength(length int) *InputComponent
- type InputView
- type ItemSlotComponent
- func (b ItemSlotComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b ItemSlotComponent) Alignment() ComponentAlignment
- func (slot *ItemSlotComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b ItemSlotComponent) HasCustomStyles() bool
- func (b ItemSlotComponent) ID() uint64
- func (b ItemSlotComponent) SetParent(parent Component)
- func (b ItemSlotComponent) Style() *ComponentStyle
- func (slot *ItemSlotComponent) Update() error
- type LabelComponent
- func (b *LabelComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *LabelComponent) Alignment() ComponentAlignment
- func (l *LabelComponent) CapacityForChild(_ Component) (float64, float64)
- func (l *LabelComponent) Children() []Component
- func (l *LabelComponent) ComputedSize() (float64, float64)
- func (l *LabelComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *LabelComponent) HasCustomStyles() bool
- func (b *LabelComponent) ID() uint64
- func (l *LabelComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (l *LabelComponent) MaxSize() (float64, float64)
- func (b *LabelComponent) SetParent(parent Component)
- func (l *LabelComponent) SetText(text string)
- func (b *LabelComponent) Style() *ComponentStyle
- func (l *LabelComponent) Text() string
- func (l *LabelComponent) Update() error
- func (l *LabelComponent) WithTextColor(newColor color.Color) *LabelComponent
- func (l *LabelComponent) WithTextSize(size float64) *LabelComponent
- func (l *LabelComponent) WithoutTextShadow() *LabelComponent
- type OverlayComponent
- func (b *OverlayComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *OverlayComponent) Alignment() ComponentAlignment
- func (overlay *OverlayComponent) CapacityForChild(_ Component) (float64, float64)
- func (overlay *OverlayComponent) Children() []Component
- func (overlay *OverlayComponent) ComputedSize() (float64, float64)
- func (overlay *OverlayComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *OverlayComponent) HasCustomStyles() bool
- func (b *OverlayComponent) ID() uint64
- func (overlay *OverlayComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (overlay *OverlayComponent) MaxSize() (float64, float64)
- func (b *OverlayComponent) SetParent(parent Component)
- func (b *OverlayComponent) Style() *ComponentStyle
- func (overlay *OverlayComponent) Update() error
- type PaddingComponent
- func (b *PaddingComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *PaddingComponent) Alignment() ComponentAlignment
- func (p *PaddingComponent) CapacityForChild(_ Component) (float64, float64)
- func (p *PaddingComponent) Children() []Component
- func (p *PaddingComponent) ComputedSize() (float64, float64)
- func (p *PaddingComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *PaddingComponent) HasCustomStyles() bool
- func (b *PaddingComponent) ID() uint64
- func (p *PaddingComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (p *PaddingComponent) MaxSize() (float64, float64)
- func (b *PaddingComponent) SetParent(parent Component)
- func (b *PaddingComponent) Style() *ComponentStyle
- func (p *PaddingComponent) Update() error
- type Position
- type PositionComponent
- func (b *PositionComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *PositionComponent) Alignment() ComponentAlignment
- func (position *PositionComponent) CapacityForChild(_ Component) (float64, float64)
- func (position *PositionComponent) Children() []Component
- func (position *PositionComponent) ComputedSize() (float64, float64)
- func (position *PositionComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *PositionComponent) HasCustomStyles() bool
- func (b *PositionComponent) ID() uint64
- func (position *PositionComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (position *PositionComponent) MaxSize() (float64, float64)
- func (b *PositionComponent) SetParent(parent Component)
- func (b *PositionComponent) Style() *ComponentStyle
- func (position *PositionComponent) Update() error
- type ScreenComponent
- func (s *ScreenComponent) Alignment() ComponentAlignment
- func (s *ScreenComponent) CapacityForChild(_ Component) (float64, float64)
- func (s *ScreenComponent) Children() []Component
- func (s *ScreenComponent) ComputedSize() (float64, float64)
- func (s *ScreenComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (s *ScreenComponent) HasCustomStyles() bool
- func (s *ScreenComponent) ID() uint64
- func (s *ScreenComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (s *ScreenComponent) MaxSize() (float64, float64)
- func (s *ScreenComponent) SetParent(_ Component)
- func (s *ScreenComponent) Style() *ComponentStyle
- func (s *ScreenComponent) Update() error
- type StackComponent
- func (s *StackComponent) AddChild(child Component)
- func (b *StackComponent) Align(alignment ComponentAlignment) *baseComponent
- func (s *StackComponent) AlignChildren(alignment ComponentAlignment) *StackComponent
- func (b *StackComponent) Alignment() ComponentAlignment
- func (s *StackComponent) CapacityForChild(child Component) (float64, float64)
- func (s *StackComponent) Children() []Component
- func (s *StackComponent) ComputedSize() (w, h float64)
- func (s *StackComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *StackComponent) HasCustomStyles() bool
- func (b *StackComponent) ID() uint64
- func (s *StackComponent) MaxCapacityForChild(child Component) (float64, float64)
- func (s *StackComponent) MaxSize() (float64, float64)
- func (s *StackComponent) ReplaceChild(oldChild Component, newChild Component)
- func (b *StackComponent) SetParent(parent Component)
- func (b *StackComponent) Style() *ComponentStyle
- func (s *StackComponent) Update() error
- func (s *StackComponent) WithChildren(children ...Component) *StackComponent
- func (s *StackComponent) WithDirection(direction StackDirection) *StackComponent
- func (s *StackComponent) WithProportions(proportions ...float64) *StackComponent
- func (s *StackComponent) WithSpacing(spacing float64) *StackComponent
- type StackDirection
- type StackOptions
- type StyledComponent
- func (b *StyledComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *StyledComponent) Alignment() ComponentAlignment
- func (styled *StyledComponent) CapacityForChild(_ Component) (float64, float64)
- func (styled *StyledComponent) Children() []Component
- func (styled *StyledComponent) ComputedSize() (float64, float64)
- func (styled *StyledComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *StyledComponent) HasCustomStyles() bool
- func (b *StyledComponent) ID() uint64
- func (styled *StyledComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (styled *StyledComponent) MaxSize() (float64, float64)
- func (b *StyledComponent) SetParent(parent Component)
- func (b *StyledComponent) Style() *ComponentStyle
- func (styled *StyledComponent) Update() error
- func (styled *StyledComponent) WithChild(child Component) *StyledComponent
- func (styled *StyledComponent) WithTextColor(color color.Color) *StyledComponent
- func (styled *StyledComponent) WithTextShadow(shadow bool) *StyledComponent
- func (styled *StyledComponent) WithTextSize(size float64) *StyledComponent
- type TextView
- type TooltipComponent
- func (b *TooltipComponent) Align(alignment ComponentAlignment) *baseComponent
- func (b *TooltipComponent) Alignment() ComponentAlignment
- func (tooltip *TooltipComponent) CapacityForChild(_ Component) (float64, float64)
- func (tooltip *TooltipComponent) Children() []Component
- func (tooltip *TooltipComponent) ComputedSize() (float64, float64)
- func (tooltip *TooltipComponent) Draw(screen *ebiten.Image, x, y float64) error
- func (b *TooltipComponent) HasCustomStyles() bool
- func (b *TooltipComponent) ID() uint64
- func (tooltip *TooltipComponent) MaxCapacityForChild(_ Component) (float64, float64)
- func (tooltip *TooltipComponent) MaxSize() (float64, float64)
- func (b *TooltipComponent) SetParent(parent Component)
- func (b *TooltipComponent) Style() *ComponentStyle
- func (tooltip *TooltipComponent) Update() error
- func (tooltip *TooltipComponent) WithNeutralColor() *TooltipComponent
- type TooltipSide
- type TooltipTexture
Constants ¶
This section is empty.
Variables ¶
var Em = font.CharHeight / 2 * float64(config.UIScaling)
Em equals letter height divided by 2
Minimum width for input elements, such as buttons and input fields
Functions ¶
func DrawButtonBackground ¶
func DrawInputBackground ¶
func DrawNeutralTooltip ¶
Draws a tooltip with neutral (gray) background color
func DrawTextTooltip ¶
func DrawTextTooltip(screen *ebiten.Image, cursorX, cursorY int, preferredSide TooltipSide, text string)
Renders a tooltip at specified coordinates, with a specified side relative to the cursor. Or, if no preferredSide is specified, an optimal side will be picked.
func DrawTooltipBackground ¶
func ImmediateDraw ¶
A simple wrapper that initializes the screen component and immediately draws it
Types ¶
type AvailableCraftsList ¶
type AvailableCraftsList struct {
*StackComponent
// contains filtered or unexported fields
}
func NewAvailableCraftsList ¶
func NewAvailableCraftsList(availableCrafts []types.Craft, selectedCraft int) *AvailableCraftsList
func (AvailableCraftsList) Align ¶
func (b AvailableCraftsList) Align(alignment ComponentAlignment) *baseComponent
func (AvailableCraftsList) Alignment ¶
func (b AvailableCraftsList) Alignment() ComponentAlignment
func (AvailableCraftsList) HasCustomStyles ¶
func (b AvailableCraftsList) HasCustomStyles() bool
func (*AvailableCraftsList) SetAvailableCrafts ¶
func (craftList *AvailableCraftsList) SetAvailableCrafts(availableCrafts []types.Craft)
Update the list of available crafts. Also updates the UI
func (*AvailableCraftsList) SetSelectedCraft ¶
func (craftList *AvailableCraftsList) SetSelectedCraft(selectedCraft int)
func (AvailableCraftsList) Style ¶
func (b AvailableCraftsList) Style() *ComponentStyle
type BackgroundColorComponent ¶
type BackgroundColorComponent struct {
// contains filtered or unexported fields
}
func Background ¶
func Background(clr color.Color, child Component) *BackgroundColorComponent
Similar to BackgroundColor, but takes the same space occupied by the child, essentially drawing background "behind" the child component.
func BackgroundColor ¶
func BackgroundColor(clr color.Color, child Component) *BackgroundColorComponent
func BackgroundColorAlpha ¶
func BackgroundColorAlpha(clr color.Color, alpha uint8, child Component) *BackgroundColorComponent
Same as BackgroundColor, but draws a background with alpha value. Useful for modal dialogs
func (*BackgroundColorComponent) Align ¶
func (b *BackgroundColorComponent) Align(alignment ComponentAlignment) *baseComponent
func (*BackgroundColorComponent) Alignment ¶
func (b *BackgroundColorComponent) Alignment() ComponentAlignment
func (*BackgroundColorComponent) CapacityForChild ¶
func (b *BackgroundColorComponent) CapacityForChild(_ Component) (float64, float64)
func (*BackgroundColorComponent) Children ¶
func (b *BackgroundColorComponent) Children() []Component
func (*BackgroundColorComponent) ComputedSize ¶
func (b *BackgroundColorComponent) ComputedSize() (float64, float64)
func (*BackgroundColorComponent) Draw ¶
func (b *BackgroundColorComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*BackgroundColorComponent) HasCustomStyles ¶
func (b *BackgroundColorComponent) HasCustomStyles() bool
func (*BackgroundColorComponent) MaxCapacityForChild ¶
func (b *BackgroundColorComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*BackgroundColorComponent) MaxSize ¶
func (b *BackgroundColorComponent) MaxSize() (float64, float64)
func (*BackgroundColorComponent) SetParent ¶
func (b *BackgroundColorComponent) SetParent(parent Component)
func (*BackgroundColorComponent) Style ¶
func (b *BackgroundColorComponent) Style() *ComponentStyle
func (*BackgroundColorComponent) Update ¶
func (b *BackgroundColorComponent) Update() error
type BackgroundImageComponent ¶
type BackgroundImageComponent struct {
// contains filtered or unexported fields
}
func BackgroundImage ¶
func BackgroundImage(mode BackgroundImageRenderingMode, texture *ebiten.Image, child Component) *BackgroundImageComponent
func StretchBackgroundImage ¶
func StretchBackgroundImage(texture types.Texture, child Component) *BackgroundImageComponent
func TileBackgroundImage ¶
func TileBackgroundImage(texture types.Texture, child Component) *BackgroundImageComponent
func (*BackgroundImageComponent) Align ¶
func (b *BackgroundImageComponent) Align(alignment ComponentAlignment) *baseComponent
func (*BackgroundImageComponent) Alignment ¶
func (b *BackgroundImageComponent) Alignment() ComponentAlignment
func (*BackgroundImageComponent) CapacityForChild ¶
func (b *BackgroundImageComponent) CapacityForChild(_ Component) (float64, float64)
func (*BackgroundImageComponent) Children ¶
func (b *BackgroundImageComponent) Children() []Component
func (*BackgroundImageComponent) ComputedSize ¶
func (b *BackgroundImageComponent) ComputedSize() (float64, float64)
func (*BackgroundImageComponent) Draw ¶
func (b *BackgroundImageComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*BackgroundImageComponent) HasCustomStyles ¶
func (b *BackgroundImageComponent) HasCustomStyles() bool
func (*BackgroundImageComponent) MaxCapacityForChild ¶
func (b *BackgroundImageComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*BackgroundImageComponent) MaxSize ¶
func (b *BackgroundImageComponent) MaxSize() (float64, float64)
func (*BackgroundImageComponent) SetParent ¶
func (b *BackgroundImageComponent) SetParent(parent Component)
func (*BackgroundImageComponent) Style ¶
func (b *BackgroundImageComponent) Style() *ComponentStyle
func (*BackgroundImageComponent) Update ¶
func (b *BackgroundImageComponent) Update() error
type BackgroundImageRenderingMode ¶
type BackgroundImageRenderingMode uint
const ( BackgroundStretch BackgroundImageRenderingMode = iota BackgroundTile )
type ButtonComponent ¶
type ButtonComponent[T any] struct { // contains filtered or unexported fields }
func Button ¶
func Button[T any](callback chan T, value T, child Component) *ButtonComponent[T]
func (*ButtonComponent) Align ¶
func (b *ButtonComponent) Align(alignment ComponentAlignment) *baseComponent
func (*ButtonComponent) Alignment ¶
func (b *ButtonComponent) Alignment() ComponentAlignment
func (*ButtonComponent[T]) CapacityForChild ¶
func (b *ButtonComponent[T]) CapacityForChild(_ Component) (float64, float64)
func (*ButtonComponent[T]) Children ¶
func (b *ButtonComponent[T]) Children() []Component
func (*ButtonComponent[T]) ComputedSize ¶
func (b *ButtonComponent[T]) ComputedSize() (float64, float64)
func (*ButtonComponent[T]) Draw ¶
func (b *ButtonComponent[T]) Draw(screen *ebiten.Image, x, y float64) error
func (*ButtonComponent) HasCustomStyles ¶
func (b *ButtonComponent) HasCustomStyles() bool
func (*ButtonComponent[T]) IsPressed ¶
func (b *ButtonComponent[T]) IsPressed() bool
func (*ButtonComponent[T]) MaxCapacityForChild ¶
func (b *ButtonComponent[T]) MaxCapacityForChild(_ Component) (float64, float64)
func (*ButtonComponent[T]) MaxSize ¶
func (b *ButtonComponent[T]) MaxSize() (float64, float64)
func (*ButtonComponent[T]) Press ¶
func (b *ButtonComponent[T]) Press()
func (*ButtonComponent) Style ¶
func (b *ButtonComponent) Style() *ComponentStyle
func (*ButtonComponent[T]) Update ¶
func (b *ButtonComponent[T]) Update() error
type ButtonView ¶
ButtonView is an interface for components that can be clicked
type CenterComponent ¶
type CenterComponent struct {
// contains filtered or unexported fields
}
func Center ¶
func Center(child Component) *CenterComponent
Center the component on both Vertical and Horizontal axis
func HCenter ¶
func HCenter(child Component) *CenterComponent
func VCenter ¶
func VCenter(child Component) *CenterComponent
func (*CenterComponent) Align ¶
func (b *CenterComponent) Align(alignment ComponentAlignment) *baseComponent
func (*CenterComponent) Alignment ¶
func (b *CenterComponent) Alignment() ComponentAlignment
func (*CenterComponent) CapacityForChild ¶
func (c *CenterComponent) CapacityForChild(_ Component) (float64, float64)
func (*CenterComponent) Children ¶
func (c *CenterComponent) Children() []Component
func (*CenterComponent) ComputedSize ¶
func (c *CenterComponent) ComputedSize() (w, h float64)
func (*CenterComponent) Draw ¶
func (c *CenterComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*CenterComponent) HasCustomStyles ¶
func (b *CenterComponent) HasCustomStyles() bool
func (*CenterComponent) MaxCapacityForChild ¶
func (c *CenterComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*CenterComponent) MaxSize ¶
func (c *CenterComponent) MaxSize() (float64, float64)
func (*CenterComponent) Style ¶
func (b *CenterComponent) Style() *ComponentStyle
func (*CenterComponent) Update ¶
func (c *CenterComponent) Update() error
type CompassComponent ¶
type CompassComponent struct {
// contains filtered or unexported fields
}
func NewCompassComponent ¶
func NewCompassComponent() *CompassComponent
func (*CompassComponent) Align ¶
func (b *CompassComponent) Align(alignment ComponentAlignment) *baseComponent
func (*CompassComponent) Alignment ¶
func (b *CompassComponent) Alignment() ComponentAlignment
func (*CompassComponent) CapacityForChild ¶
func (compass *CompassComponent) CapacityForChild(_ Component) (float64, float64)
func (*CompassComponent) Children ¶
func (compass *CompassComponent) Children() []Component
func (*CompassComponent) ComputedSize ¶
func (compass *CompassComponent) ComputedSize() (float64, float64)
func (*CompassComponent) Draw ¶
func (compass *CompassComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*CompassComponent) HasCustomStyles ¶
func (b *CompassComponent) HasCustomStyles() bool
func (*CompassComponent) MaxCapacityForChild ¶
func (compass *CompassComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*CompassComponent) MaxSize ¶
func (compass *CompassComponent) MaxSize() (float64, float64)
func (*CompassComponent) Style ¶
func (b *CompassComponent) Style() *ComponentStyle
func (*CompassComponent) Update ¶
func (compass *CompassComponent) Update() error
type Component ¶
type Component interface {
SetParent(parent Component)
Children() []Component
// Alignment of the child inside the parent container
Alignment() ComponentAlignment
// MaxSize returns maximum space that the component could theoretically occupy
MaxSize() (float64, float64)
// Returns actual size of the component
ComputedSize() (float64, float64)
// Returns available space that the child could take in its parent, considering the parent's current size.
CapacityForChild(child Component) (float64, float64)
// Returns practical maximum space, that the child could take in its parent
// For most component's this is the same as CapacityForChild
MaxCapacityForChild(child Component) (float64, float64)
// Update is pretty much useless,
// because for many widgets to update, we need to know their size,
// and their size can't be calculated without access to graphics.
// So, instead, all those operations are done in Draw() function.
// But, things not dependent on graphics can be done there
Update() error
Draw(screen *ebiten.Image, x, y float64) error
// ID returns unique identifier of the component, so it can be compared to others
ID() uint64
Style() *ComponentStyle
HasCustomStyles() bool
}
Component is the base interface for all components
type ComponentAlignment ¶
type ComponentAlignment int
Used to hint the parent container how the component should be aligned inside it
const ( AlignNone ComponentAlignment = iota AlignStart AlignCenter AlignEnd )
type ComponentStyle ¶
type CraftDescription ¶
type CraftDescription struct {
*StyledComponent
// contains filtered or unexported fields
}
func NewCraftDescription ¶
func NewCraftDescription() *CraftDescription
func (CraftDescription) Align ¶
func (b CraftDescription) Align(alignment ComponentAlignment) *baseComponent
func (CraftDescription) Alignment ¶
func (b CraftDescription) Alignment() ComponentAlignment
func (CraftDescription) HasCustomStyles ¶
func (b CraftDescription) HasCustomStyles() bool
func (*CraftDescription) SetCraft ¶
func (craftDescription *CraftDescription) SetCraft(craft types.Craft)
func (CraftDescription) Style ¶
func (b CraftDescription) Style() *ComponentStyle
type FormComponent ¶
type FormComponent struct {
// contains filtered or unexported fields
}
a simple wrapper around basic components, to simplify creation of prompts
func Form ¶
func Form(submitButtonTitle string, formData chan []string, prompts ...FormPrompt) *FormComponent
When compose button is pressed, form data will be sent through `formData` channel, in the proper order
func (*FormComponent) Align ¶
func (b *FormComponent) Align(alignment ComponentAlignment) *baseComponent
func (*FormComponent) Alignment ¶
func (b *FormComponent) Alignment() ComponentAlignment
func (*FormComponent) CapacityForChild ¶
func (f *FormComponent) CapacityForChild(_ Component) (float64, float64)
func (*FormComponent) Children ¶
func (f *FormComponent) Children() []Component
func (*FormComponent) ComputedSize ¶
func (f *FormComponent) ComputedSize() (float64, float64)
func (*FormComponent) HasCustomStyles ¶
func (b *FormComponent) HasCustomStyles() bool
func (*FormComponent) MaxCapacityForChild ¶
func (f *FormComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*FormComponent) MaxSize ¶
func (f *FormComponent) MaxSize() (float64, float64)
func (*FormComponent) Style ¶
func (b *FormComponent) Style() *ComponentStyle
func (*FormComponent) Update ¶
func (f *FormComponent) Update() error
type FormPrompt ¶
type FormPrompt struct {
Title string
// contains filtered or unexported fields
}
type ImageComponent ¶
type ImageComponent struct {
// contains filtered or unexported fields
}
func (*ImageComponent) Align ¶
func (b *ImageComponent) Align(alignment ComponentAlignment) *baseComponent
func (*ImageComponent) Alignment ¶
func (b *ImageComponent) Alignment() ComponentAlignment
func (*ImageComponent) CapacityForChild ¶
func (image *ImageComponent) CapacityForChild(_ Component) (float64, float64)
func (*ImageComponent) Children ¶
func (image *ImageComponent) Children() []Component
func (*ImageComponent) ComputedSize ¶
func (image *ImageComponent) ComputedSize() (float64, float64)
func (*ImageComponent) DisableScaling ¶
func (image *ImageComponent) DisableScaling() *ImageComponent
func (*ImageComponent) Draw ¶
func (image *ImageComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*ImageComponent) HasCustomStyles ¶
func (b *ImageComponent) HasCustomStyles() bool
func (*ImageComponent) MaxCapacityForChild ¶
func (image *ImageComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*ImageComponent) MaxSize ¶
func (image *ImageComponent) MaxSize() (float64, float64)
func (*ImageComponent) Style ¶
func (b *ImageComponent) Style() *ComponentStyle
func (*ImageComponent) Update ¶
func (image *ImageComponent) Update() error
type InputComponent ¶
type InputComponent struct {
// contains filtered or unexported fields
}
func Input ¶
func Input(handler func(string), enterKey ebiten.Key, initialFocus bool) *InputComponent
func (*InputComponent) Align ¶
func (b *InputComponent) Align(alignment ComponentAlignment) *baseComponent
func (*InputComponent) Alignment ¶
func (b *InputComponent) Alignment() ComponentAlignment
func (*InputComponent) CapacityForChild ¶
func (i *InputComponent) CapacityForChild(_ Component) (float64, float64)
func (*InputComponent) Children ¶
func (i *InputComponent) Children() []Component
func (*InputComponent) ComputedSize ¶
func (i *InputComponent) ComputedSize() (float64, float64)
func (*InputComponent) Draw ¶
func (i *InputComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*InputComponent) HasCustomStyles ¶
func (b *InputComponent) HasCustomStyles() bool
func (*InputComponent) Input ¶
func (i *InputComponent) Input() string
func (*InputComponent) MaxCapacityForChild ¶
func (i *InputComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*InputComponent) MaxSize ¶
func (i *InputComponent) MaxSize() (float64, float64)
func (*InputComponent) SetFocused ¶
func (b *InputComponent) SetFocused(focused bool)
func (*InputComponent) SetInput ¶
func (i *InputComponent) SetInput(input string)
func (*InputComponent) Style ¶
func (b *InputComponent) Style() *ComponentStyle
func (*InputComponent) Update ¶
func (i *InputComponent) Update() error
func (*InputComponent) WithMaxInputLength ¶
func (i *InputComponent) WithMaxInputLength(length int) *InputComponent
Sets maximum input length
type ItemSlotComponent ¶
type ItemSlotComponent struct {
*TooltipComponent
// contains filtered or unexported fields
}
func ItemSlot ¶
func ItemSlot(slot *types.ItemSlot) *ItemSlotComponent
func (ItemSlotComponent) Align ¶
func (b ItemSlotComponent) Align(alignment ComponentAlignment) *baseComponent
func (ItemSlotComponent) Alignment ¶
func (b ItemSlotComponent) Alignment() ComponentAlignment
func (*ItemSlotComponent) Draw ¶
func (slot *ItemSlotComponent) Draw(screen *ebiten.Image, x, y float64) error
func (ItemSlotComponent) HasCustomStyles ¶
func (b ItemSlotComponent) HasCustomStyles() bool
func (ItemSlotComponent) Style ¶
func (b ItemSlotComponent) Style() *ComponentStyle
func (*ItemSlotComponent) Update ¶
func (slot *ItemSlotComponent) Update() error
type LabelComponent ¶
type LabelComponent struct {
// contains filtered or unexported fields
}
func ColoredLabel ¶
func ColoredLabel(s string, color color.Color) *LabelComponent
func CustomLabel ¶
func CustomLabel(s string, color color.Color, scaling float64) *LabelComponent
func Label ¶
func Label(s string) *LabelComponent
func LabelF ¶
func LabelF(format string, a ...any) *LabelComponent
func (*LabelComponent) Align ¶
func (b *LabelComponent) Align(alignment ComponentAlignment) *baseComponent
func (*LabelComponent) Alignment ¶
func (b *LabelComponent) Alignment() ComponentAlignment
func (*LabelComponent) CapacityForChild ¶
func (l *LabelComponent) CapacityForChild(_ Component) (float64, float64)
func (*LabelComponent) Children ¶
func (l *LabelComponent) Children() []Component
func (*LabelComponent) ComputedSize ¶
func (l *LabelComponent) ComputedSize() (float64, float64)
func (*LabelComponent) Draw ¶
func (l *LabelComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*LabelComponent) HasCustomStyles ¶
func (b *LabelComponent) HasCustomStyles() bool
func (*LabelComponent) MaxCapacityForChild ¶
func (l *LabelComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*LabelComponent) MaxSize ¶
func (l *LabelComponent) MaxSize() (float64, float64)
func (*LabelComponent) SetText ¶
func (l *LabelComponent) SetText(text string)
func (*LabelComponent) Style ¶
func (b *LabelComponent) Style() *ComponentStyle
func (*LabelComponent) Text ¶
func (l *LabelComponent) Text() string
func (*LabelComponent) Update ¶
func (l *LabelComponent) Update() error
func (*LabelComponent) WithTextColor ¶
func (l *LabelComponent) WithTextColor(newColor color.Color) *LabelComponent
func (*LabelComponent) WithTextSize ¶
func (l *LabelComponent) WithTextSize(size float64) *LabelComponent
func (*LabelComponent) WithoutTextShadow ¶
func (l *LabelComponent) WithoutTextShadow() *LabelComponent
type OverlayComponent ¶
type OverlayComponent struct {
// contains filtered or unexported fields
}
func Overlay ¶
func Overlay(children ...Component) *OverlayComponent
func (*OverlayComponent) Align ¶
func (b *OverlayComponent) Align(alignment ComponentAlignment) *baseComponent
func (*OverlayComponent) Alignment ¶
func (b *OverlayComponent) Alignment() ComponentAlignment
func (*OverlayComponent) CapacityForChild ¶
func (overlay *OverlayComponent) CapacityForChild(_ Component) (float64, float64)
func (*OverlayComponent) Children ¶
func (overlay *OverlayComponent) Children() []Component
func (*OverlayComponent) ComputedSize ¶
func (overlay *OverlayComponent) ComputedSize() (float64, float64)
func (*OverlayComponent) Draw ¶
func (overlay *OverlayComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*OverlayComponent) HasCustomStyles ¶
func (b *OverlayComponent) HasCustomStyles() bool
func (*OverlayComponent) MaxCapacityForChild ¶
func (overlay *OverlayComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*OverlayComponent) MaxSize ¶
func (overlay *OverlayComponent) MaxSize() (float64, float64)
func (*OverlayComponent) Style ¶
func (b *OverlayComponent) Style() *ComponentStyle
func (*OverlayComponent) Update ¶
func (overlay *OverlayComponent) Update() error
type PaddingComponent ¶
type PaddingComponent struct {
// contains filtered or unexported fields
}
func Padding ¶
func Padding(amount float64, child Component) *PaddingComponent
Adds padding on all sides
func PaddingX ¶
func PaddingX(amount float64, child Component) *PaddingComponent
func PaddingXY ¶
func PaddingXY(amountX, amountY float64, child Component) *PaddingComponent
func PaddingY ¶
func PaddingY(amount float64, child Component) *PaddingComponent
func (*PaddingComponent) Align ¶
func (b *PaddingComponent) Align(alignment ComponentAlignment) *baseComponent
func (*PaddingComponent) Alignment ¶
func (b *PaddingComponent) Alignment() ComponentAlignment
func (*PaddingComponent) CapacityForChild ¶
func (p *PaddingComponent) CapacityForChild(_ Component) (float64, float64)
func (*PaddingComponent) Children ¶
func (p *PaddingComponent) Children() []Component
func (*PaddingComponent) ComputedSize ¶
func (p *PaddingComponent) ComputedSize() (float64, float64)
func (*PaddingComponent) Draw ¶
func (p *PaddingComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*PaddingComponent) HasCustomStyles ¶
func (b *PaddingComponent) HasCustomStyles() bool
func (*PaddingComponent) MaxCapacityForChild ¶
func (p *PaddingComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*PaddingComponent) MaxSize ¶
func (p *PaddingComponent) MaxSize() (float64, float64)
func (*PaddingComponent) Style ¶
func (b *PaddingComponent) Style() *ComponentStyle
func (*PaddingComponent) Update ¶
func (p *PaddingComponent) Update() error
type PositionComponent ¶
type PositionComponent struct {
// contains filtered or unexported fields
}
func PositionSelf ¶
func PositionSelf(position Position, child Component) *PositionComponent
Position the component absolutely within the container
func (*PositionComponent) Align ¶
func (b *PositionComponent) Align(alignment ComponentAlignment) *baseComponent
func (*PositionComponent) Alignment ¶
func (b *PositionComponent) Alignment() ComponentAlignment
func (*PositionComponent) CapacityForChild ¶
func (position *PositionComponent) CapacityForChild(_ Component) (float64, float64)
func (*PositionComponent) Children ¶
func (position *PositionComponent) Children() []Component
func (*PositionComponent) ComputedSize ¶
func (position *PositionComponent) ComputedSize() (float64, float64)
func (*PositionComponent) Draw ¶
func (position *PositionComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*PositionComponent) HasCustomStyles ¶
func (b *PositionComponent) HasCustomStyles() bool
func (*PositionComponent) MaxCapacityForChild ¶
func (position *PositionComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*PositionComponent) MaxSize ¶
func (position *PositionComponent) MaxSize() (float64, float64)
func (*PositionComponent) Style ¶
func (b *PositionComponent) Style() *ComponentStyle
func (*PositionComponent) Update ¶
func (position *PositionComponent) Update() error
type ScreenComponent ¶
type ScreenComponent struct {
// contains filtered or unexported fields
}
ScreenComponent is the root component
func Screen ¶
func Screen(child Component) *ScreenComponent
func (*ScreenComponent) Alignment ¶
func (s *ScreenComponent) Alignment() ComponentAlignment
func (*ScreenComponent) CapacityForChild ¶
func (s *ScreenComponent) CapacityForChild(_ Component) (float64, float64)
func (*ScreenComponent) Children ¶
func (s *ScreenComponent) Children() []Component
func (*ScreenComponent) ComputedSize ¶
func (s *ScreenComponent) ComputedSize() (float64, float64)
func (*ScreenComponent) Draw ¶
func (s *ScreenComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*ScreenComponent) HasCustomStyles ¶
func (s *ScreenComponent) HasCustomStyles() bool
func (*ScreenComponent) ID ¶
func (s *ScreenComponent) ID() uint64
func (*ScreenComponent) MaxCapacityForChild ¶
func (s *ScreenComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*ScreenComponent) MaxSize ¶
func (s *ScreenComponent) MaxSize() (float64, float64)
func (*ScreenComponent) SetParent ¶
func (s *ScreenComponent) SetParent(_ Component)
func (*ScreenComponent) Style ¶
func (s *ScreenComponent) Style() *ComponentStyle
func (*ScreenComponent) Update ¶
func (s *ScreenComponent) Update() error
type StackComponent ¶
type StackComponent struct {
// contains filtered or unexported fields
}
func HStack ¶
func HStack(children ...Component) *StackComponent
func VStack ¶
func VStack(children ...Component) *StackComponent
func (*StackComponent) AddChild ¶
func (s *StackComponent) AddChild(child Component)
func (*StackComponent) Align ¶
func (b *StackComponent) Align(alignment ComponentAlignment) *baseComponent
func (*StackComponent) AlignChildren ¶
func (s *StackComponent) AlignChildren(alignment ComponentAlignment) *StackComponent
func (*StackComponent) Alignment ¶
func (b *StackComponent) Alignment() ComponentAlignment
func (*StackComponent) CapacityForChild ¶
func (s *StackComponent) CapacityForChild(child Component) (float64, float64)
func (*StackComponent) Children ¶
func (s *StackComponent) Children() []Component
func (*StackComponent) ComputedSize ¶
func (s *StackComponent) ComputedSize() (w, h float64)
func (*StackComponent) Draw ¶
func (s *StackComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*StackComponent) HasCustomStyles ¶
func (b *StackComponent) HasCustomStyles() bool
func (*StackComponent) MaxCapacityForChild ¶
func (s *StackComponent) MaxCapacityForChild(child Component) (float64, float64)
func (*StackComponent) MaxSize ¶
func (s *StackComponent) MaxSize() (float64, float64)
func (*StackComponent) ReplaceChild ¶
func (s *StackComponent) ReplaceChild(oldChild Component, newChild Component)
func (*StackComponent) Style ¶
func (b *StackComponent) Style() *ComponentStyle
func (*StackComponent) Update ¶
func (s *StackComponent) Update() error
func (*StackComponent) WithChildren ¶
func (s *StackComponent) WithChildren(children ...Component) *StackComponent
func (*StackComponent) WithDirection ¶
func (s *StackComponent) WithDirection(direction StackDirection) *StackComponent
func (*StackComponent) WithProportions ¶
func (s *StackComponent) WithProportions(proportions ...float64) *StackComponent
func (*StackComponent) WithSpacing ¶
func (s *StackComponent) WithSpacing(spacing float64) *StackComponent
type StackDirection ¶
type StackDirection uint
const ( VerticalStack StackDirection = iota HorizontalStack )
type StackOptions ¶
type StackOptions struct {
Direction StackDirection
Spacing float64 // spacing between each child
Proportions []float64 // how much % of the parent space will each child occupy
AlignChildren ComponentAlignment // explicit alignment of all childrens
}
type StyledComponent ¶
type StyledComponent struct {
// contains filtered or unexported fields
}
func Styled ¶
func Styled(child Component) *StyledComponent
Apply custom styles to a child component
func (*StyledComponent) Align ¶
func (b *StyledComponent) Align(alignment ComponentAlignment) *baseComponent
func (*StyledComponent) Alignment ¶
func (b *StyledComponent) Alignment() ComponentAlignment
func (*StyledComponent) CapacityForChild ¶
func (styled *StyledComponent) CapacityForChild(_ Component) (float64, float64)
func (*StyledComponent) Children ¶
func (styled *StyledComponent) Children() []Component
func (*StyledComponent) ComputedSize ¶
func (styled *StyledComponent) ComputedSize() (float64, float64)
func (*StyledComponent) Draw ¶
func (styled *StyledComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*StyledComponent) HasCustomStyles ¶
func (b *StyledComponent) HasCustomStyles() bool
func (*StyledComponent) MaxCapacityForChild ¶
func (styled *StyledComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*StyledComponent) MaxSize ¶
func (styled *StyledComponent) MaxSize() (float64, float64)
func (*StyledComponent) Style ¶
func (b *StyledComponent) Style() *ComponentStyle
func (*StyledComponent) Update ¶
func (styled *StyledComponent) Update() error
func (*StyledComponent) WithChild ¶
func (styled *StyledComponent) WithChild(child Component) *StyledComponent
func (*StyledComponent) WithTextColor ¶
func (styled *StyledComponent) WithTextColor(color color.Color) *StyledComponent
func (*StyledComponent) WithTextShadow ¶
func (styled *StyledComponent) WithTextShadow(shadow bool) *StyledComponent
func (*StyledComponent) WithTextSize ¶
func (styled *StyledComponent) WithTextSize(size float64) *StyledComponent
type TooltipComponent ¶
type TooltipComponent struct {
// contains filtered or unexported fields
}
func Tooltip ¶
func Tooltip(child Component) *TooltipComponent
func (*TooltipComponent) Align ¶
func (b *TooltipComponent) Align(alignment ComponentAlignment) *baseComponent
func (*TooltipComponent) Alignment ¶
func (b *TooltipComponent) Alignment() ComponentAlignment
func (*TooltipComponent) CapacityForChild ¶
func (tooltip *TooltipComponent) CapacityForChild(_ Component) (float64, float64)
func (*TooltipComponent) Children ¶
func (tooltip *TooltipComponent) Children() []Component
func (*TooltipComponent) ComputedSize ¶
func (tooltip *TooltipComponent) ComputedSize() (float64, float64)
func (*TooltipComponent) Draw ¶
func (tooltip *TooltipComponent) Draw(screen *ebiten.Image, x, y float64) error
func (*TooltipComponent) HasCustomStyles ¶
func (b *TooltipComponent) HasCustomStyles() bool
func (*TooltipComponent) MaxCapacityForChild ¶
func (tooltip *TooltipComponent) MaxCapacityForChild(_ Component) (float64, float64)
func (*TooltipComponent) MaxSize ¶
func (tooltip *TooltipComponent) MaxSize() (float64, float64)
func (*TooltipComponent) Style ¶
func (b *TooltipComponent) Style() *ComponentStyle
func (*TooltipComponent) Update ¶
func (tooltip *TooltipComponent) Update() error
func (*TooltipComponent) WithNeutralColor ¶
func (tooltip *TooltipComponent) WithNeutralColor() *TooltipComponent
Uses an alternative tooltip texture made from neutral gray colors
type TooltipSide ¶
type TooltipSide int
Which side of the cursor to prefer for displaying the tooltip. By default, the tooltip is displayed where it fits. If there are multiple sides it can fit on, we pick the direction with the most free pixels (pixels to the edge of the screen) in both axis. The default order is: BottomRight, BottomLeft, TopRight, TopLeft
const ( None TooltipSide = iota BottomRight BottomLeft TopRight TopLeft )
type TooltipTexture ¶
type TooltipTexture struct {
TopLeft *ebiten.Image
Top *ebiten.Image
TopRight *ebiten.Image
Left *ebiten.Image
Center *ebiten.Image
Right *ebiten.Image
BottomLeft *ebiten.Image
Bottom *ebiten.Image
BottomRight *ebiten.Image
}
func AssembleTooltipTexture ¶
func AssembleTooltipTexture(texture *ebiten.Image) TooltipTexture
Divide the tooltip texture into sub-textures for rendering