Skip to content

Commit

Permalink
giuwidget: style menu
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Mar 21, 2022
1 parent 098f400 commit 04fe6bd
Showing 1 changed file with 41 additions and 10 deletions.
51 changes: 41 additions & 10 deletions pkg/giuwidget/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const id = "Tic-Tac-Go-game"
const (
buttonsSpacing = 3
defaultBoardSize = 3
inputIntW = 30
inputIntW = 40
menuFontSize = 30
headerFontSize = 80
)

// GameWidget represents a giu implementation of tic-tac-go.
Expand Down Expand Up @@ -55,21 +57,50 @@ func (g *GameWidget) Build() {

giu.Layout{
giu.Align(giu.AlignCenter).To(
giu.Style().SetFontSize(headerFontSize).To(
giu.Row(
giu.Style().SetColor(giu.StyleColorText, colornames.Red).To(
giu.Label("TIC"),
),
giu.Label("-"),
giu.Style().SetColor(giu.StyleColorText, colornames.Blue).To(
giu.Label("TAC"),
),
giu.Label("-"),
giu.Style().SetColor(giu.StyleColorText, colornames.Green).To(
giu.Label("GO"),
),
),
),
giu.Row(
giu.Label("Width: "),
giu.InputInt(&state.w).Size(inputIntW),
giu.Style().SetFontSize(menuFontSize).To(
giu.Label("Width: "),
),
giu.Style().SetFontSize(menuFontSize).To(
giu.InputInt(&state.w).Size(inputIntW),
),
),
giu.Row(
giu.Label("Heigh: "),
giu.InputInt(&state.h).Size(inputIntW),
giu.Style().SetFontSize(menuFontSize).To(
giu.Label("Heigh: "),
),
giu.Style().SetFontSize(menuFontSize).To(
giu.InputInt(&state.h).Size(inputIntW),
),
),
giu.Row(
giu.Label("Chain Length: "),
giu.InputInt(&state.chainLen).Size(inputIntW),
giu.Style().SetFontSize(menuFontSize).To(
giu.Label("Chain Length: "),
),
giu.Style().SetFontSize(menuFontSize).To(
giu.InputInt(&state.chainLen).Size(inputIntW),
),
),
giu.Style().SetFontSize(menuFontSize).To(
giu.Button("START GAME").OnClick(func() {
g.runGame()
}),
),
giu.Button("play new game").OnClick(func() {
g.runGame()
}),
),
}.Build()
}
Expand Down

0 comments on commit 04fe6bd

Please sign in to comment.