Documentation ¶
Index ¶
- func GetLogo() []image.Image
- type Box
- func (b *Box) Bounds() image.Rectangle
- func (b *Box) Child() Drawable
- func (b *Box) Draw(screen *ebiten.Image)
- func (b *Box) PreferredSize() (int, int)
- func (b *Box) SetBorder(c color.Color)
- func (b *Box) SetMargin(margin int)
- func (b *Box) SetPadding(padding int)
- func (b *Box) SetPosition(x, y int)
- func (b *Box) SetSize(sx, sy int)
- func (b *Box) SetVisible(visible bool)
- func (b *Box) Update() error
- type Button
- type ButtonHandler
- type Drawable
- type Grid
- func (g *Grid) Append(child Drawable)
- func (g *Grid) Bounds() image.Rectangle
- func (g *Grid) Children() []Drawable
- func (g *Grid) Clear()
- func (g *Grid) Draw(screen *ebiten.Image)
- func (g *Grid) PreferredSize() (int, int)
- func (g *Grid) SetPosition(x, y int)
- func (g *Grid) SetSize(sx, sy int)
- func (g *Grid) SetVisible(visible bool)
- func (g *Grid) Update() error
- type Rectangle
- func (r *Rectangle) Bounds() image.Rectangle
- func (r *Rectangle) Draw(screen *ebiten.Image)
- func (r *Rectangle) PreferredSize() (int, int)
- func (r *Rectangle) SetColor(c color.Color)
- func (r *Rectangle) SetPosition(x, y int)
- func (r *Rectangle) SetSize(sx, sy int)
- func (r *Rectangle) SetVisible(visible bool)
- func (r *Rectangle) Update() error
- type Selected
- type Toolbar
- func (t *Toolbar) Append(b *Button)
- func (t *Toolbar) Bounds() image.Rectangle
- func (t *Toolbar) Draw(screen *ebiten.Image)
- func (t *Toolbar) PreferredSize() (sx, sy int)
- func (t *Toolbar) SetPosition(x, y int)
- func (t *Toolbar) SetSize(sx, sy int)
- func (t *Toolbar) SetVisible(visible bool)
- func (t *Toolbar) Update() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
Box is a rectangle which may have padding and/or a colored border, as well as a single Child
func (*Box) PreferredSize ¶
PreferredSize calculates the width and height of the box including the margin and padding
func (*Box) SetPadding ¶
SetPadding changes the width of the Border
func (*Box) SetPosition ¶
SetPosition changes the XY corrdinate of the upper-left pixel of the Box
func (*Box) SetVisible ¶
SetVisible changes the visibility of the Box
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
Button is a square button for performing actions
func NewButton ¶
func NewButton(img *model.Sprite, scale int, callback ButtonHandler) *Button
NewButton creates a new empty Sprite of the specified size, scale (multiplier), and ButtonHandler
func (*Button) Draw ¶
func (b *Button) Draw(screen *ebiten.Image)
Draw renders the Sprite to a screen
func (*Button) PreferredSize ¶
PreferredSize calculates the desired width and height of the Sprite
func (*Button) SetPosition ¶
SetPosition changes the XY coordinate of the upper-left pixel
func (*Button) SetVisible ¶
SetVisible changes the visibility of the Sprite
type ButtonHandler ¶
type ButtonHandler func(btn ebiten.MouseButton)
ButtonHandler is a callback to be used when a mouse button is clicked
type Drawable ¶
type Drawable interface { // Bounds returns a rectangle indicating the visible boundaries of the Drawable Bounds() image.Rectangle // Draw renders this Drawable to a screen Draw(screen *ebiten.Image) // SetPosition sets the XY coordinate of the upper-left pixel SetPosition(x, y int) // SetSize changes the width and height of the Drawable SetSize(sx, sy int) // PreferredSize calculates the desired width and height of the Drawable PreferredSize() (sx, sy int) // SetVisible changes the visible of the Drawable SetVisible(visible bool) // Update changes the internal state of the Drawable and/or its Children Update() error }
Drawable is an object which can be rendered to a screen and may have its own state
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
Grid is a 2D matrix of Drawables
func (*Grid) Bounds ¶
Bounds returns a rectangle indicating the boundaries of the Grid if completely filled
func (*Grid) Draw ¶
func (g *Grid) Draw(screen *ebiten.Image)
Draw renders the Grid to a screen
Children are drawn row by row, from left to right, until no more rows or children are available
func (*Grid) PreferredSize ¶
PreferredSize indicated the width and height of the Grid if completely filled
func (*Grid) SetPosition ¶
SetPosition changes the XY coordinate of the upper-left pixel
Additionally, each child's position is modified, setting any extra children to invisible
func (*Grid) SetVisible ¶
SetVisible changes the visibility of the Grid and its Children
type Rectangle ¶
type Rectangle struct {
// contains filtered or unexported fields
}
Rectangle is a colored box
func NewRectangle ¶
NewRectangle creates a new Rectangle of the specified width and height
func (*Rectangle) Draw ¶
func (r *Rectangle) Draw(screen *ebiten.Image)
Draw renders the Rectangle to a screen
func (*Rectangle) PreferredSize ¶
PreferredSize calculates the desired width and height of the Rectangle
func (*Rectangle) SetPosition ¶
SetPosition changes the XY coordinate of the upper-left pixel
func (*Rectangle) SetVisible ¶
SetVisible changes the visibility of the Rectangle
type Selected ¶
type Selected int
Selected indicated whether or not a UI element is selected and how it was selected
type Toolbar ¶
type Toolbar struct {
// contains filtered or unexported fields
}
Toolbar is a grid of toolbar icons for carrying out specific actions
func (*Toolbar) Bounds ¶
Bounds returns a rectangle indicating the visible boundaries of the Toolbar
func (*Toolbar) Draw ¶
func (t *Toolbar) Draw(screen *ebiten.Image)
Draw renders the Toolbar to a screen
func (*Toolbar) PreferredSize ¶
PreferredSize calculates the desired width and height of the Toolbar
func (*Toolbar) SetPosition ¶
SetPosition changes the XY coordinate of the upper-left pixel
func (*Toolbar) SetVisible ¶
SetVisible changes the visibility of the Toolbar