From a059fa9bb1ace39cf5fdcfd489a90f5d778c9344 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 20 Aug 2025 14:44:06 +0200 Subject: add game and settings menus --- go/client/game.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'go/client/game.go') diff --git a/go/client/game.go b/go/client/game.go index eae065c6..f4262f67 100644 --- a/go/client/game.go +++ b/go/client/game.go @@ -34,17 +34,17 @@ const ( STATE_BAR_WIDTH = 300 POC_BUTTON_WIDTH = 150 - - AUTO_PROGRESS_PROMPT = true ) type Game struct { - app *app + app *app + settings *settings keyBindings keyBindings selectedObject any + menuButton *ui.ImageButton handLayer *ui.HandView discardBtn *ui.ImageButton stateBar *ui.StateBar @@ -77,6 +77,7 @@ type Game struct { func newGame(app *app, gameState game.State) *Game { g := &Game{ app: app, + settings: newSettings(), gameState: gameState, keyBindings: make(keyBindings), Collection: ui.Collection{ @@ -92,6 +93,16 @@ func newGame(app *app, gameState game.State) *Game { g.keyBindings[ebiten.KeyEscape] = reset g.keyBindings[ebiten.KeyQ] = func(ui.InputEvent, *Game) (bool, error) { return false, ebiten.Termination } + menuImg := ebiten.NewImageFromImage(assets.GetIcon("menu.png")) + g.menuButton = ui.NewImageButton( + g.Width-menuImg.Bounds().Dx()-10, + 10, + menuImg, + func(*ui.ImageButton) { + activities.PushActivity(newGameMenu(g)) + }) + g.AddWidget(g.menuButton) + g.passButton = ui.NewSimpleButton(g.Width-PASS_BUTTON_WIDTH, g.Height-DEFAULT_BUTTON_HEIGHT, PASS_BUTTON_WIDTH, @@ -504,7 +515,7 @@ func (g *Game) updateButtons() { passButtonLabel = "confirm" } - if AUTO_PROGRESS_PROMPT && !targets.Cur().AllowSelection() { + if g.settings.gameplay["autoProgressPrompt"].(bool) && !targets.Cur().AllowSelection() { g.progressPrompt() return } -- cgit v1.2.3