...

Package etk

Overview ▾

Package etk provides an Ebitengine tool kit for creating graphical user interfaces.

Variables

var Style = &Attributes{
    TextColor: color.RGBA{0, 0, 0, 255},

    BorderColor: color.RGBA{0, 0, 0, 255},

    ButtonBgColor:         color.RGBA{255, 255, 255, 255},
    ButtonBgColorDisabled: color.RGBA{110, 110, 110, 255},
}

func Draw

func Draw(screen *ebiten.Image) error

func Layout

func Layout(outsideWidth, outsideHeight int)

func SetRoot

func SetRoot(w Widget)

func Update

func Update() error

type Attributes

type Attributes struct {
    TextColor color.Color

    BorderColor color.Color

    ButtonTextColor       color.Color
    ButtonBgColor         color.Color
    ButtonBgColorDisabled color.Color
}

type Box

type Box struct {
    sync.Mutex
    // contains filtered or unexported fields
}

func NewBox

func NewBox() *Box

func (*Box) AddChild

func (b *Box) AddChild(w ...Widget)

func (*Box) Children

func (b *Box) Children() []Widget

func (*Box) Rect

func (b *Box) Rect() image.Rectangle

func (*Box) SetRect

func (b *Box) SetRect(r image.Rectangle)

type Button

type Button struct {
    *Box
    // contains filtered or unexported fields
}

func NewButton

func NewButton(label string, onSelected func()) *Button

func (*Button) Draw

func (b *Button) Draw(screen *ebiten.Image) error

func (*Button) HandleKeyboard

func (b *Button) HandleKeyboard() (handled bool, err error)

func (*Button) HandleMouse

func (b *Button) HandleMouse() (handled bool, err error)

func (*Button) SetRect

func (b *Button) SetRect(r image.Rectangle)

type Flex

type Flex struct {
    *Box
    // contains filtered or unexported fields
}

func NewFlex

func NewFlex() *Flex

func (*Flex) Draw

func (f *Flex) Draw(screen *ebiten.Image) error

func (*Flex) HandleKeyboard

func (f *Flex) HandleKeyboard() (handled bool, err error)

func (*Flex) HandleMouse

func (f *Flex) HandleMouse() (handled bool, err error)

func (*Flex) SetRect

func (f *Flex) SetRect(r image.Rectangle)

func (*Flex) SetVertical

func (f *Flex) SetVertical(v bool)

type Widget

type Widget interface {
    Rect() image.Rectangle
    SetRect(r image.Rectangle)
    HandleMouse() (handled bool, err error)
    HandleKeyboard() (handled bool, err error)
    Draw(screen *ebiten.Image) error
    Children() []Widget
}

Subdirectories

Name Synopsis
..
examples
flex
showcase