okay giant ux refactor to hopefully make it cleaner

This commit is contained in:
2025-08-31 13:29:52 -04:00
parent 430259475b
commit dda0a83202
12 changed files with 214 additions and 198 deletions

View File

@@ -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 {