From 04fe6bd95e6ba87c4696164a8d0fa858617a448b Mon Sep 17 00:00:00 2001 From: gucio321 Date: Mon, 21 Mar 2022 12:59:18 +0100 Subject: [PATCH] giuwidget: style menu --- pkg/giuwidget/widget.go | 51 +++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/pkg/giuwidget/widget.go b/pkg/giuwidget/widget.go index 0009cf5..bd84af7 100644 --- a/pkg/giuwidget/widget.go +++ b/pkg/giuwidget/widget.go @@ -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. @@ -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() }