package main import ( "fmt" "image/color" "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() } return a.Collection.Update() } func (a *app) build() { nc := ui.NewNumberChoice(a.windowWidth-ui.NUMBER_CHOICE_WIDTH, a.windowHeight-ui.NUMBER_CHOICE_HEIGHT, 0, func(nc *ui.NumberChoice) { fmt.Println(nc.GetChoosen()) }) a.AddWidget(nc) tbBg := ui.NewFixedTextBox(100, 100, 200, 200, "c").Bg(color.White).Fg(color.Black).Centering(true) a.AddWidget(tbBg) // tb := ui.NewAutoTextBox(100, 100, "Nasenbär\nZweite Zeile") // a.AddWidget(tb) } 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) }