aboutsummaryrefslogtreecommitdiff
path: root/go/client/startMenu.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-16 18:57:15 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:50:10 +0200
commit63ad22242562b1e66353694f2a17df6d1c64a8fd (patch)
treef91a3a98e554e58a30d5bb0a34b021c7fb206311 /go/client/startMenu.go
parentc0ab1110429be3a2a1664084469952ea082961c1 (diff)
downloadmuhqs-game-63ad22242562b1e66353694f2a17df6d1c64a8fd.tar.gz
muhqs-game-63ad22242562b1e66353694f2a17df6d1c64a8fd.zip
move more ui logic into Collection
* Generalize hover detection and move it into ui.Collection * Implement transparencu for the prompt banner
Diffstat (limited to 'go/client/startMenu.go')
-rw-r--r--go/client/startMenu.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/go/client/startMenu.go b/go/client/startMenu.go
index 29a4a18c..94ec3aef 100644
--- a/go/client/startMenu.go
+++ b/go/client/startMenu.go
@@ -17,8 +17,7 @@ const (
type StartMenu struct {
ui.Collection
- app *app
- width, height int
+ app *app
deckInput *ui.TextInput
@@ -36,8 +35,8 @@ func NewStartMenu(app *app) *StartMenu {
func (m *StartMenu) build() {
deckInput := ui.NewTextInput(
- (m.width-DECK_LIST_WIDTH)/2,
- (m.height-DECK_LIST_HEIGHT)/2,
+ (m.Width-DECK_LIST_WIDTH)/2,
+ (m.Height-DECK_LIST_HEIGHT)/2,
DECK_LIST_WIDTH,
DECK_LIST_HEIGHT,
"deck",
@@ -52,7 +51,7 @@ func (m *StartMenu) build() {
m.AddWidget(deckInput)
m.AddWidget(ui.NewFixedTextBox(
- (m.width-START_BUTTON_WIDTH)/2-START_BUTTON_WIDTH,
+ (m.Width-START_BUTTON_WIDTH)/2-START_BUTTON_WIDTH,
deckInput.Y-START_BUTTON_HEIGHT,
START_BUTTON_WIDTH,
START_BUTTON_HEIGHT,
@@ -60,7 +59,7 @@ func (m *StartMenu) build() {
).Centering(true))
mapInput := ui.NewTextInput(
- (m.width-START_BUTTON_WIDTH)/2,
+ (m.Width-START_BUTTON_WIDTH)/2,
deckInput.Y-START_BUTTON_HEIGHT,
START_BUTTON_WIDTH,
START_BUTTON_HEIGHT,
@@ -74,7 +73,7 @@ func (m *StartMenu) build() {
m.AddWidget(mapInput)
m.AddWidget(ui.NewFixedTextBox(
- (m.width-START_BUTTON_WIDTH)/2-START_BUTTON_WIDTH,
+ (m.Width-START_BUTTON_WIDTH)/2-START_BUTTON_WIDTH,
mapInput.Y-START_BUTTON_HEIGHT,
START_BUTTON_WIDTH,
START_BUTTON_HEIGHT,
@@ -82,7 +81,7 @@ func (m *StartMenu) build() {
).Centering(true))
playerInput := ui.NewTextInput(
- (m.width-START_BUTTON_WIDTH)/2,
+ (m.Width-START_BUTTON_WIDTH)/2,
mapInput.Y-START_BUTTON_HEIGHT,
START_BUTTON_WIDTH,
START_BUTTON_HEIGHT,
@@ -96,18 +95,18 @@ func (m *StartMenu) build() {
m.AddWidget(playerInput)
m.AddWidget(ui.NewSimpleButton(
- (m.width-START_BUTTON_WIDTH)/2+START_BUTTON_WIDTH/2,
+ (m.Width-START_BUTTON_WIDTH)/2+START_BUTTON_WIDTH/2,
deckInput.Y+deckInput.Height,
START_BUTTON_WIDTH,
START_BUTTON_HEIGHT,
"Sealed",
func(*ui.SimpleButton) {
- sealed := NewSealed(m.width, m.height, m.app)
+ sealed := NewSealed(m.Width, m.Height, m.app)
m.app.pushActivity(sealed)
}))
m.AddWidget(ui.NewSimpleButton(
- (m.width-START_BUTTON_WIDTH)/2-START_BUTTON_WIDTH/2,
+ (m.Width-START_BUTTON_WIDTH)/2-START_BUTTON_WIDTH/2,
deckInput.Y+deckInput.Height,
START_BUTTON_WIDTH,
START_BUTTON_HEIGHT,
@@ -129,7 +128,7 @@ func (m *StartMenu) Update() error {
}
func (m *StartMenu) Layout(width, height int) (int, int) {
- return m.width, m.height
+ return m.Width, m.Height
}
func (m *StartMenu) startGame() {