Documentation
¶
Index ¶
- type BaseElement
- func (b *BaseElement) AddChild(child UIElement)
- func (b *BaseElement) Draw(screen *ebiten.Image)
- func (b *BaseElement) GetChildren() []UIElement
- func (b *BaseElement) GetPosition() (float64, float64)
- func (b *BaseElement) GetSize() (float64, float64)
- func (b *BaseElement) HandleInput(input *InputState)
- func (b *BaseElement) IsEnabled() bool
- func (b *BaseElement) IsMouseOver(mouseX, mouseY int) bool
- func (b *BaseElement) IsVisible() bool
- func (b *BaseElement) SetEnabled(enabled bool)
- func (b *BaseElement) SetPosition(x, y float64)
- func (b *BaseElement) SetVisible(visible bool)
- func (b *BaseElement) Update(input *InputState)
- type Button
- type Container
- type ContainerDirection
- type ContainerOptions
- type Image
- type InputState
- type Label
- type UIElement
- type UIManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseElement ¶
type BaseElement struct {
X, Y float64
Width, Height float64
Visible bool
Enabled bool
Children []UIElement
Parent UIElement
}
func NewBaseElement ¶
func NewBaseElement(x, y, width, height float64) *BaseElement
func (*BaseElement) AddChild ¶
func (b *BaseElement) AddChild(child UIElement)
func (*BaseElement) Draw ¶
func (b *BaseElement) Draw(screen *ebiten.Image)
func (*BaseElement) GetChildren ¶
func (b *BaseElement) GetChildren() []UIElement
func (*BaseElement) GetPosition ¶
func (b *BaseElement) GetPosition() (float64, float64)
func (*BaseElement) GetSize ¶
func (b *BaseElement) GetSize() (float64, float64)
func (*BaseElement) HandleInput ¶
func (b *BaseElement) HandleInput(input *InputState)
func (*BaseElement) IsEnabled ¶
func (b *BaseElement) IsEnabled() bool
func (*BaseElement) IsMouseOver ¶
func (b *BaseElement) IsMouseOver(mouseX, mouseY int) bool
func (*BaseElement) IsVisible ¶
func (b *BaseElement) IsVisible() bool
func (*BaseElement) SetEnabled ¶
func (b *BaseElement) SetEnabled(enabled bool)
func (*BaseElement) SetPosition ¶
func (b *BaseElement) SetPosition(x, y float64)
func (*BaseElement) SetVisible ¶
func (b *BaseElement) SetVisible(visible bool)
func (*BaseElement) Update ¶
func (b *BaseElement) Update(input *InputState)
type Button ¶
type Button struct {
BaseElement
Text string
Font font.Face
TextColor color.Color
BackgroundColor color.Color
HoverBackgroundColor color.Color
OnClick func()
// contains filtered or unexported fields
}
func (*Button) HandleInput ¶
func (btn *Button) HandleInput(input *InputState)
func (*Button) Update ¶
func (btn *Button) Update(input *InputState)
type Container ¶
type Container struct {
BaseElement
// contains filtered or unexported fields
}
func NewContainer ¶
func NewContainer(x, y float64, op *ContainerOptions) *Container
func (*Container) AddChild ¶
AddChild places the children based on the config beside or below each other, with a defined gap between them
func (*Container) SetPosition ¶
type ContainerDirection ¶
type ContainerDirection string
const ( Undefined ContainerDirection = "undefined" Row ContainerDirection = "row" Col ContainerDirection = "col" )
type ContainerOptions ¶
type ContainerOptions struct {
Direction ContainerDirection
Gap float64
}
type Image ¶
type Image struct {
BaseElement
// contains filtered or unexported fields
}
func (*Image) Update ¶
func (img *Image) Update(input *InputState)
type InputState ¶
type UIElement ¶
type UIElement interface {
Update(input *InputState)
Draw(screen *ebiten.Image)
SetPosition(x, y float64)
GetPosition() (x, y float64)
GetSize() (width, height float64)
SetVisible(visible bool)
IsVisible() bool
SetEnabled(enabled bool)
IsEnabled() bool
AddChild(child UIElement)
HandleInput(input *InputState)
GetChildren() []UIElement
}
type UIManager ¶
type UIManager struct {
// contains filtered or unexported fields
}
func NewUIManager ¶
func NewUIManager() *UIManager
func (*UIManager) AddElement ¶
func (*UIManager) ClearElements ¶
func (m *UIManager) ClearElements()
func (*UIManager) RemoveElement ¶
Click to show internal directories.
Click to hide internal directories.