37 lines
663 B
Go
37 lines
663 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) (w, h float64)
|
|
}
|
|
|
|
type Dimensions struct {
|
|
ZX, ZY float64
|
|
WX, WY float64
|
|
}
|