aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-08-23 19:03:46 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-23 19:03:46 +0200
commitd2f1fbbecc36f24e131cf050071a8f073dc058d8 (patch)
tree0dc01df490b9675182d9398ba4d832e8bc8e537e
parent1ad53231c04a4b46f3d81790f434cdaeba700585 (diff)
downloadmuhqs-game-d2f1fbbecc36f24e131cf050071a8f073dc058d8.tar.gz
muhqs-game-d2f1fbbecc36f24e131cf050071a8f073dc058d8.zip
improve draft activity ui and introduce wasm specific ui constants
-rw-r--r--go/activities/draft.go8
-rw-r--r--go/ui/constants.go6
-rw-r--r--go/ui/constants_wasm.go8
3 files changed, 18 insertions, 4 deletions
diff --git a/go/activities/draft.go b/go/activities/draft.go
index 53e762a6..7e7eb2c6 100644
--- a/go/activities/draft.go
+++ b/go/activities/draft.go
@@ -52,9 +52,9 @@ func NewLocalDraft(width, height int, playerName string) *Draft {
).Centering(true))
d.setInput = ui.NewTextInput(
- (d.Width-DRAFT_BUTTON_WIDTH)/2,
+ (d.Width-3*DRAFT_BUTTON_WIDTH)/2,
(d.Height-DRAFT_BUTTON_HEIGHT)/2-3*DRAFT_BUTTON_HEIGHT,
- DRAFT_BUTTON_WIDTH,
+ DRAFT_BUTTON_WIDTH*3,
DRAFT_BUTTON_HEIGHT,
"base,magic,equipments",
)
@@ -97,7 +97,7 @@ func NewLocalDraft(width, height int, playerName string) *Draft {
).Centering(true))
aiNInput := ui.NewNumberChoice(
- (d.Width-DRAFT_BUTTON_WIDTH)/2,
+ (d.Width-ui.NUMBER_CHOICE_WIDTH_MIN)/2,
(d.Height-DRAFT_BUTTON_HEIGHT)/2-DRAFT_BUTTON_HEIGHT,
1,
nil,
@@ -163,7 +163,7 @@ func (d *Draft) Update() error {
0,
d.Width-SEALED_DECK_STRIP_WIDTH,
d.Height,
- 0.5,
+ ui.DRAFT_DECK_VIEW_SCALE,
d.player.Deck).Columns(3)
d.AddWidget(d.deckView)
default:
diff --git a/go/ui/constants.go b/go/ui/constants.go
new file mode 100644
index 00000000..052ae527
--- /dev/null
+++ b/go/ui/constants.go
@@ -0,0 +1,6 @@
+//go:build !wasm
+package ui
+
+const (
+ DRAFT_DECK_VIEW_SCALE = 0.5
+)
diff --git a/go/ui/constants_wasm.go b/go/ui/constants_wasm.go
new file mode 100644
index 00000000..e6e2bbce
--- /dev/null
+++ b/go/ui/constants_wasm.go
@@ -0,0 +1,8 @@
+package ui
+
+const (
+ // The atlas of the ebiten wasm port does not allow as big imaes as the linux version.
+ // Therefore, we scale the deck view to reduce its size.
+ // FIXME: This is only needed because the cardView rendering is very naiv.
+ DRAFT_DECK_VIEW_SCALE = 0.35
+)