var Bindings = &Shortcuts{ ConfirmKeyboard: []ebiten.Key{ebiten.KeyEnter, ebiten.KeyKPEnter}, ConfirmMouse: []ebiten.MouseButton{ebiten.MouseButtonLeft}, ConfirmGamepad: []ebiten.GamepadButton{ebiten.GamepadButton0}, }
var Style = &Attributes{ TextFont: defaultFont(), TextColorLight: color.RGBA{255, 255, 255, 255}, TextColorDark: color.RGBA{0, 0, 0, 255}, TextBgColor: transparent, BorderColor: color.RGBA{0, 0, 0, 255}, InputBgColor: color.RGBA{0, 128, 0, 255}, ButtonBgColor: color.RGBA{255, 255, 255, 255}, ButtonBgColorDisabled: color.RGBA{110, 110, 110, 255}, }
func Draw(screen *ebiten.Image) error
func Layout(outsideWidth, outsideHeight int)
func SetRoot(w Widget)
func Update() error
type Attributes struct { TextFont font.Face TextColorLight color.Color TextColorDark color.Color TextBgColor color.Color BorderColor color.Color InputBgColor color.Color ButtonTextColor color.Color ButtonBgColor color.Color ButtonBgColorDisabled color.Color }
type Box struct { sync.Mutex // contains filtered or unexported fields }
func NewBox() *Box
func (b *Box) AddChild(w ...Widget)
func (b *Box) Children() []Widget
func (b *Box) Rect() image.Rectangle
func (b *Box) SetRect(r image.Rectangle)
type Button struct { *Box // contains filtered or unexported fields }
func NewButton(label string, onSelected func() error) *Button
func (b *Button) Draw(screen *ebiten.Image) error
func (b *Button) HandleKeyboard() (handled bool, err error)
func (b *Button) HandleMouse(cursor image.Point, pressed bool, clicked bool) (handled bool, err error)
func (b *Button) SetRect(r image.Rectangle)
type Flex struct { *Box // contains filtered or unexported fields }
func NewFlex() *Flex
func (f *Flex) Draw(screen *ebiten.Image) error
func (f *Flex) HandleKeyboard() (handled bool, err error)
func (f *Flex) HandleMouse(cursor image.Point, pressed bool, clicked bool) (handled bool, err error)
func (f *Flex) SetRect(r image.Rectangle)
func (f *Flex) SetVertical(v bool)
type Input struct { *Box Field *messeji.InputField }
func NewInput(prefix string, text string, onSelected func(text string) (handled bool)) *Input
func (i *Input) Clear()
Clear clears the field's buffer.
func (i *Input) Draw(screen *ebiten.Image) error
func (i *Input) HandleKeyboard() (handled bool, err error)
func (i *Input) HandleMouse(cursor image.Point, pressed bool, clicked bool) (handled bool, err error)
func (i *Input) SetRect(r image.Rectangle)
func (i *Input) Text() string
func (i *Input) Write(p []byte) (n int, err error)
Write writes to the field's buffer.
type Shortcuts struct { ConfirmKeyboard []ebiten.Key ConfirmMouse []ebiten.MouseButton ConfirmGamepad []ebiten.GamepadButton }
type Text struct { *Box Field *messeji.TextField }
func NewText(text string) *Text
func (t *Text) Clear()
Clear clears the field's buffer.
func (t *Text) Draw(screen *ebiten.Image) error
func (t *Text) HandleKeyboard() (handled bool, err error)
func (t *Text) HandleMouse(cursor image.Point, pressed bool, clicked bool) (handled bool, err error)
func (t *Text) SetRect(r image.Rectangle)
func (t *Text) Text() string
func (t *Text) Write(p []byte) (n int, err error)
Write writes to the field's buffer.
type Widget interface { Rect() image.Rectangle SetRect(r image.Rectangle) HandleMouse(cursor image.Point, pressed bool, clicked bool) (handled bool, err error) HandleKeyboard() (handled bool, err error) Draw(screen *ebiten.Image) error Children() []Widget }
Window displays and passes input to only one child widget at a time.
type Window struct { *Box // contains filtered or unexported fields }
func NewWindow() *Window
func (w *Window) AddChild(wgt ...Widget)
func (w *Window) AddChildWithLabel(wgt Widget, label string)
func (w *Window) Draw(screen *ebiten.Image) error
func (w *Window) HandleKeyboard() (handled bool, err error)
func (w *Window) HandleMouse(cursor image.Point, pressed bool, clicked bool) (handled bool, err error)
func (w *Window) SetRect(r image.Rectangle)