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-01-27 16:43:50 +0100
commitc12057320c06f9b4a0bd6c9b25a1dd2d2bd8fd8d (patch)
tree77e2d4f4b1430b95fd20dc14a8c2c561a80d6bc8 /go/client/startMenu.go
parent2f01274717d62e59e4bf3b4426a2ec6a76ffac11 (diff)
downloadmuhqs-game-c12057320c06f9b4a0bd6c9b25a1dd2d2bd8fd8d.tar.gz
muhqs-game-c12057320c06f9b4a0bd6c9b25a1dd2d2bd8fd8d.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() {