Files
games/common/elements/v1/element.go

37 lines
689 B
Go

package elements
import (
"github.com/hajimehoshi/ebiten/v2"
)
type ElementFunc func(Dimensions) Element
type MouseState struct {
X, Y int32
LeftDown, RightDown bool
LeftChanged, RightChanged bool
}
type Clickable interface {
HandleClick(s MouseState) error
}
type Mouseable interface {
HandleMouseEnter(s MouseState) error
HandleMouseLeave(s MouseState) error
HandleMouseMove(s MouseState) error
HandleMouseDown(s MouseState) error
HandleMouseUp(s MouseState) error
}
type Element interface {
Mouseable
Clickable
Draw(image *ebiten.Image, anchorX, anchorY float64) (w, h float64)
}
type Dimensions struct {
ZX, ZY float64
WX, WY float64
}