diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-01-25 21:10:44 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:44 +0100 |
| commit | 8720ebf9c74d9e11001772b5c00c293fa3a8b9e5 (patch) | |
| tree | 70013771c425746318d290b5cadad0bbc1a48abb /go/client | |
| parent | 73d40903aecad3efcf7c6055c133f0db86558203 (diff) | |
| download | muhqs-game-8720ebf9c74d9e11001772b5c00c293fa3a8b9e5.tar.gz muhqs-game-8720ebf9c74d9e11001772b5c00c293fa3a8b9e5.zip | |
intermediate commit
Diffstat (limited to 'go/client')
| -rw-r--r-- | go/client/main.go | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/go/client/main.go b/go/client/main.go index f2b7e36f..a3dbeeec 100644 --- a/go/client/main.go +++ b/go/client/main.go @@ -15,7 +15,7 @@ import ( ) const ( - screenWidth = 1280 + screenWidth = 800 screenHeight = 1024 DEFAULT_BUTTON_HEIGHT = 40 @@ -26,9 +26,7 @@ const ( HOVER_THRESHOLD = 60 HAND_VIEW_HEIGHT = 500 - HAND_VIEW_WIDTH = 700 - - STATE_BAR_WIDTH = 50 + HAND_VIEW_WIDTH = 500 ) var playerColors = []color.RGBA{ @@ -142,12 +140,12 @@ func (g *Game) initPlayerUi(player *game.Player) { g.playerCtrl = game.NewChanPlayerControl() player.Ctrl = g.playerCtrl - g.handLayer = ui.NewHandView(STATE_BAR_WIDTH, g.mapView.GetHeight(), - HAND_VIEW_WIDTH, screenHeight-g.mapView.GetHeight(), player.Hand) + g.handLayer = ui.NewHandView(0, g.mapView.GetHeight(), + HAND_VIEW_WIDTH, screenHeight-g.mapView.GetHeight()-DEFAULT_BUTTON_HEIGHT, player.Hand) g.widgets = append(g.widgets, g.handLayer) - g.stateBar = ui.NewStateBar(0, screenHeight-HAND_VIEW_HEIGHT, - STATE_BAR_WIDTH, HAND_VIEW_HEIGHT, g.gameState, player) + g.stateBar = ui.NewStateBar(0, screenHeight-DEFAULT_BUTTON_HEIGHT, + screenWidth-g.passButton.Width, DEFAULT_BUTTON_HEIGHT, g.gameState, player) g.widgets = append(g.widgets, g.stateBar) } @@ -168,7 +166,7 @@ func (g *Game) removeWidget(widget ui.Widget) { } } -func (g *Game) addActionChoice(perm game.Permanent) { +func (g *Game) addActionChoice(perm game.Permanent, x, y int) { actions := perm.GetAvailActionPrototypes() if len(actions) > 0 { g.selectedObject = perm @@ -176,7 +174,7 @@ func (g *Game) addActionChoice(perm game.Permanent) { g.removeActionChoice() g.selectedObject = actions[c.GetChoosen(x, y)] } - g.actionChoice = ui.NewActionChoice(500, 200, actions, onClick) + g.actionChoice = ui.NewActionChoice(x, y, actions, onClick) g.addWidget(g.actionChoice) } } @@ -207,7 +205,6 @@ func (g *Game) passPriority() { func (g *Game) handlePlayerNotifications() { n := g.playerCtrl.RecvNotification() for n != nil { - log.Printf("Recv player notification %v\n", n) switch n.Notification { case game.PriorityNotification: g.addWidget(g.passButton) @@ -281,7 +278,7 @@ func (g *Game) Update() error { case game.Permanent: perm := obj if g.selectedObject == nil { - g.addActionChoice(perm) + g.addActionChoice(perm, x, y) } else { switch obj := g.selectedObject.(type) { case *game.AttackActionPrototype: @@ -307,7 +304,7 @@ func (g *Game) Update() error { g.mapView.HighlightPermanents(perms) case *game.Card: if obj.IsPermanent() { - spawnTiles := g.gameState.SpawnTiles(g.activePlayer) + spawnTiles := g.gameState.AvailableSpawnTiles(g.activePlayer, obj) g.mapView.HighlightTiles(spawnTiles) } } @@ -366,10 +363,9 @@ func main() { game.NewStore()) g.initPlayerUi(muhq) - enemy := g.addPlayer("enemy", - game.NewDeckFromDeckList(g.gameState.Map.StartDeckList), - game.NewStore()) - enemy.Ctrl = &game.DummyPlayerControl{enemy} + krakenId := len(g.gameState.Players) + kraken := game.NewKraken(krakenId, g.gameState, playerColors[krakenId]) + g.gameState.Players = append(g.gameState.Players, kraken) go func() { w := g.gameState.Loop() |
