Documentation ¶
Index ¶
- type Scene
- type UI
- func (u *UI) AddFont(font *common.Font) error
- func (u *UI) AddImage(img *common.Image) error
- func (u *UI) AddScene(name string, scene *Scene) error
- func (u *UI) CurrentScene() *Scene
- func (u *UI) DefaultFont(name string) error
- func (u *UI) Draw(screen *ebiten.Image)
- func (u *UI) Font(name string) (*common.Font, error)
- func (u *UI) Image(name string) (*common.Image, error)
- func (u *UI) NewButton(name string, scene string, text string, x float64, y float64, width int, ...) (*button.Element, error)
- func (u *UI) NewFontTTF(name string, fontData []byte, opts *truetype.Options, r rune) (*common.Font, error)
- func (u *UI) NewImage(name string, f io.Reader, filter ebiten.Filter) (*common.Image, error)
- func (u *UI) NewLabel(name string, scene string, text string, x float64, y float64, ...) (*label.Element, error)
- func (u *UI) NewProgress(name string, scene string, text string, x float64, y float64, width int, ...) (*progress.Element, error)
- func (ui *UI) NewScene(name string) (*Scene, error)
- func (u *UI) NewSprite(name string, scene string, x float64, y float64, imageName string) (*sprite.Element, error)
- func (u *UI) RemoveFont(name string) error
- func (u *UI) Resolution() image.Point
- func (u *UI) Scene(name string) (*Scene, error)
- func (u *UI) SetCurrentScene(name string) error
- func (u *UI) SetDefaultFont(name string) error
- func (u *UI) SetResolution(resolution image.Point)
- func (u *UI) Update(image *ebiten.Image) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
Scene represents a layout of ui
func (*Scene) AddElement ¶
func (s *Scene) AddElement(e element.Interfacer) error
AddElement adds an element to the scene list
func (*Scene) Element ¶
func (s *Scene) Element(name string) (element.Interfacer, error)
Element returns an element based on name
func (*Scene) RemoveElement ¶
RemoveElement flags an element to be removed next update
type UI ¶
type UI struct {
// contains filtered or unexported fields
}
UI contains core game components
func (*UI) DefaultFont ¶ added in v0.0.4
DefaultFont returns the current default font
func (*UI) NewButton ¶
func (u *UI) NewButton(name string, scene string, text string, x float64, y float64, width int, height int, textColor color.Color, pressedSliceName string, unpressedSliceName string) (*button.Element, error)
NewButton creates a new button instance
func (*UI) NewFontTTF ¶ added in v0.0.4
func (u *UI) NewFontTTF(name string, fontData []byte, opts *truetype.Options, r rune) (*common.Font, error)
NewFontTTF instantiates a truetype font. truetype.Parse() can be used to load a TTF to fontData
func (*UI) NewLabel ¶
func (u *UI) NewLabel(name string, scene string, text string, x float64, y float64, textColor color.Color) (*label.Element, error)
NewLabel creates a new label instance
func (*UI) NewProgress ¶ added in v0.0.11
func (u *UI) NewProgress(name string, scene string, text string, x float64, y float64, width int, height int, progressImageName string, fillImageName string) (*progress.Element, error)
NewProgress creates a new progress bar instance
func (*UI) NewSprite ¶ added in v0.0.6
func (u *UI) NewSprite(name string, scene string, x float64, y float64, imageName string) (*sprite.Element, error)
NewSprite creates a new button instance
func (*UI) RemoveFont ¶ added in v0.0.4
RemoveFont is used to unload and remove a font
func (*UI) SetCurrentScene ¶
SetCurrentScene sets current scene
func (*UI) SetDefaultFont ¶ added in v0.0.4
SetDefaultFont updates all elements to use a new default font
func (*UI) SetResolution ¶
SetResolution changes the resolution of the UI