ui

package
v0.0.0-...-934685d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyUp = iota
	KeyDown
	KeyLeft
	KeyRight
	KeySpace
	KeyEcs
	CountKey
	KeyAny
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicComponent

type BasicComponent struct {
	RECT Rect
	// contains filtered or unexported fields
}

func NewConponent

func NewConponent(t, l, h, w int, parent ParentCom) *BasicComponent

func (*BasicComponent) Close

func (bc *BasicComponent) Close(msg any)

func (*BasicComponent) ID

func (bc *BasicComponent) ID() int

func (*BasicComponent) Layout

func (bc *BasicComponent) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*BasicComponent) Parent

func (bc *BasicComponent) Parent() ParentCom

func (*BasicComponent) Rect

func (bc *BasicComponent) Rect() Rect

func (*BasicComponent) SetSize

func (bc *BasicComponent) SetSize(height, width int)

func (*BasicComponent) Update

func (bc *BasicComponent) Update() error

type BasicWindow

type BasicWindow struct {
	BasicComponent

	// handler
	OnOpen func()
	// contains filtered or unexported fields
}

func NewBasicWindow

func NewBasicWindow(parent ParentCom) *BasicWindow

func (*BasicWindow) AddComponent

func (bw *BasicWindow) AddComponent(c Component)

func (*BasicWindow) Close

func (bw *BasicWindow) Close(msg any)

func (*BasicWindow) CompleteFadein

func (bw *BasicWindow) CompleteFadein()

func (*BasicWindow) Draw

func (bw *BasicWindow) Draw(screen *ebiten.Image)

func (*BasicWindow) FadeIn

func (bw *BasicWindow) FadeIn(timeInTick int)

func (*BasicWindow) FadeOut

func (bw *BasicWindow) FadeOut(timeInTick int)

func (*BasicWindow) GetPalette

func (bw *BasicWindow) GetPalette() []color.RGBA

func (*BasicWindow) ID

func (bw *BasicWindow) ID() int

func (*BasicWindow) Notify

func (bw *BasicWindow) Notify(subId int, event ComEvent, msg any)

func (*BasicWindow) RemoveComponent

func (bw *BasicWindow) RemoveComponent(c Component)

func (*BasicWindow) SetPalette

func (bw *BasicWindow) SetPalette(plt []color.RGBA)

func (*BasicWindow) Timer

func (bw *BasicWindow) Timer() *utils.TimerManager

func (*BasicWindow) Update

func (bw *BasicWindow) Update() error

type ComEvent

type ComEvent int
const (
	OnWinClose ComEvent = iota
)

type Component

type Component interface {
	ebiten.Game

	ID() int
	Rect() Rect
	Parent() ParentCom
}

type Input

type Input struct {
	// contains filtered or unexported fields
}
var DefaultInput Input

func (*Input) Pressed

func (i *Input) Pressed(key int) bool

func (*Input) Update

func (i *Input) Update() error

type Label

type Label struct {
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(text []rune, face font.Face) Label

func (Label) Draw

func (l Label) Draw(screen *ebiten.Image, x, y int, shadow bool, c color.Color)
type Menu struct {
	BasicComponent

	OnSelect func(int)
	// contains filtered or unexported fields
}

func NewMenu

func NewMenu(t, l, h, w int, p ParentCom, face font.Face, canClose bool) *Menu
func (m *Menu) AddItem(label []rune, pos Pos)
func (m *Menu) Close(msg any)
func (m *Menu) Draw(screen *ebiten.Image)
func (m *Menu) Update() error
type MenuItem struct {
	//Value   int
	Label []rune
	//Enabled bool
	Pos Pos
}

type ParentCom

type ParentCom interface {
	Timer() *utils.TimerManager
	Notify(subId int, event ComEvent, msg any)
}

type Pos

type Pos struct {
	X, Y int
}

type Rect

type Rect struct {
	Top, Left, Height, Width int
}

func (Rect) Cover

func (r Rect) Cover(x, y int) bool

type Window

type Window interface {
	Component
	Close(msg any)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL