Fixed bug in main menu.

This commit is contained in:
Sander Schobers 2021-08-09 13:07:12 +02:00
parent 157ec6d42d
commit 6404364b8b
2 changed files with 2 additions and 1 deletions

View File

@ -41,6 +41,7 @@ func newMainMenu(app *appContext, ctx ui.Context) ui.Control {
menu.Add("Quit", func(ctx ui.Context) { ctx.Quit() }) menu.Add("Quit", func(ctx ui.Context) { ctx.Quit() })
menu.Activate(1) // play menu.Activate(1) // play
ctx.Animate()
return Center(&mainMenu{ return Center(&mainMenu{
StackPanel: ui.StackPanel{ StackPanel: ui.StackPanel{

View File

@ -25,7 +25,7 @@ func (m *Menu) Activate(i int) {
if len(m.buttons) == 0 || i < 0 { if len(m.buttons) == 0 || i < 0 {
return return
} }
m.active = i % len(m.buttons) m.updateActiveButton(i % len(m.buttons))
} }
func (m *Menu) Add(text string, click func(ui.Context)) { func (m *Menu) Add(text string, click func(ui.Context)) {