aboutsummaryrefslogtreecommitdiff
path: root/go/ui
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-09-03 13:10:15 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-09-03 13:10:15 +0200
commitada59f2f5b2c2be0999131fe98af985effb5829d (patch)
treeb5f4b1114794c551333489252c7e7fbb2b424f27 /go/ui
parent67faa0f3bf6fb047d19372c9b671a45887b99f6e (diff)
downloadmuhqs-game-ada59f2f5b2c2be0999131fe98af985effb5829d.tar.gz
muhqs-game-ada59f2f5b2c2be0999131fe98af985effb5829d.zip
show all store available store cards when prompting to buy a card
Diffstat (limited to 'go/ui')
-rw-r--r--go/ui/mapView.go8
-rw-r--r--go/ui/textBox.go10
2 files changed, 13 insertions, 5 deletions
diff --git a/go/ui/mapView.go b/go/ui/mapView.go
index 83404241..528ce6db 100644
--- a/go/ui/mapView.go
+++ b/go/ui/mapView.go
@@ -428,6 +428,14 @@ func (vw *MapView) FindObjectAt(screenX, screenY int) any {
return nil
}
+func (vw *MapView) GetScreenPosition(t *game.Tile) (int, int) {
+ scaled_tile_wdth := int(float64(TILE_WIDTH) * vw.scale)
+ scaled_tile_hght := int(float64(TILE_HEIGHT) * vw.scale)
+ x := scaled_tile_wdth * t.Position.X
+ y := scaled_tile_hght * t.Position.Y
+ return x, y
+}
+
func (vw *MapView) HighlightPositions(pos []game.Position, col color.Color) {
highlights := make(map[game.Position][]color.Color)
for _, p := range pos {
diff --git a/go/ui/textBox.go b/go/ui/textBox.go
index e2238078..1b0cae5e 100644
--- a/go/ui/textBox.go
+++ b/go/ui/textBox.go
@@ -141,7 +141,7 @@ type PocList struct {
hoverCardView
centerX int
bottomY int
- poc game.PileOfCards
+ Poc game.PileOfCards
}
func NewPocList(centerX, bottomY int, poc game.PileOfCards, c *Collection) *PocList {
@@ -149,7 +149,7 @@ func NewPocList(centerX, bottomY int, poc game.PileOfCards, c *Collection) *PocL
TextBox: *(NewAutoTextBox(-1, -1, "").Centering(true)),
centerX: centerX,
bottomY: bottomY,
- poc: poc,
+ Poc: poc,
}
w.hoverCardView.init(w, c)
@@ -165,7 +165,7 @@ func NewPocList(centerX, bottomY int, poc game.PileOfCards, c *Collection) *PocL
func (w *PocList) setText() {
w.Width, w.Height = -1, -1
t := ""
- for _, c := range w.poc.Cards() {
+ for _, c := range w.Poc.Cards() {
t = fmt.Sprintf("%s%s\n", t, c.Name)
}
@@ -185,7 +185,7 @@ func (w *PocList) FindObjectAt(_x, _y int) any {
return nil
}
- cards := w.poc.Cards()
+ cards := w.Poc.Cards()
if len(cards) == 0 {
return nil
}
@@ -193,7 +193,7 @@ func (w *PocList) FindObjectAt(_x, _y int) any {
y := _y - w.Y
_, height := text.Measure(w.text, w.font, w.font.Size*w.lineSpacing)
- i := y / (int(height) / w.poc.Size())
+ i := y / (int(height) / w.Poc.Size())
if i >= len(cards) {
return nil