okay giant ux refactor to hopefully make it cleaner
This commit is contained in:
@@ -4,21 +4,37 @@ import (
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
type InitFunc func(Bounds) Element
|
||||
type InitFunc func() Element
|
||||
|
||||
type Element interface {
|
||||
Size() (w, h float64)
|
||||
|
||||
Draw(image *ebiten.Image)
|
||||
Draw(*ebiten.Image)
|
||||
SetAnchor(Point)
|
||||
Anchor() Point
|
||||
Size() (w, h int)
|
||||
Children() []Element
|
||||
}
|
||||
|
||||
type Point struct {
|
||||
X, Y float64
|
||||
X, Y int
|
||||
}
|
||||
|
||||
func (p Point) Delta(p2 Point) Point {
|
||||
return Point{
|
||||
X: p2.X - p.X,
|
||||
Y: p2.Y - p.Y,
|
||||
}
|
||||
}
|
||||
|
||||
func (p Point) Add(p2 Point) Point {
|
||||
return Point{
|
||||
X: p.X + p2.X,
|
||||
Y: p.Y + p2.Y,
|
||||
}
|
||||
}
|
||||
|
||||
type Bounds struct {
|
||||
Min Point
|
||||
Width, Height float64
|
||||
Width, Height int
|
||||
}
|
||||
|
||||
func (b *Bounds) Contains(p Point) bool {
|
||||
|
||||
Reference in New Issue
Block a user