package main import ( "image/color" "time" "github.com/hajimehoshi/ebiten/v2" "muhq.space/muhqs-game/go/font" "muhq.space/muhqs-game/go/ui" ) type app struct { ui.Collection windowWidth int windowHeight int } func (a *app) Update() error { if a.Widgets() == nil { a.build() } if err := ui.Update(); err != nil { return err } return a.Collection.Update() } func (a *app) build() { tI := ui.NewTextInput(100, 100, 200, 200, "i", false) tI.Bg(color.White).Fg(color.Black).Centering(true) a.AddWidget(tI) a.AddWidget(ui.NewTimerBar(0, 10, a.windowWidth, 5, 30*time.Second)) a.AddWidget(ui.NewSpinner(100, 400, 50)) } func (a *app) Layout(width, height int) (int, int) { return a.windowWidth, a.windowHeight } func main() { font.InitFont() app := &app{windowWidth: 800, windowHeight: 1000} ebiten.SetWindowSize(app.windowWidth, app.windowHeight) ebiten.SetWindowTitle("Muhq's Game") _ = ebiten.RunGame(app) }