added back button

This commit is contained in:
Thomas von Dein 2024-03-17 16:29:56 +01:00
parent 449a75aa7d
commit 35057ec8a6

View File

@ -95,7 +95,7 @@ func (scene *SelectScene) SetupUI() {
widget.WidgetOpts.LayoutData(widget.RowLayoutData{
Position: widget.RowLayoutPositionCenter,
Stretch: true,
MaxHeight: 300,
MaxHeight: 200,
}),
)),
// Set the entries in the list
@ -148,14 +148,31 @@ func (scene *SelectScene) SetupUI() {
}),
)
buttonContainer := widget.NewContainer(
widget.ContainerOpts.Layout(widget.NewGridLayout(
widget.GridLayoutOpts.Columns(2),
widget.GridLayoutOpts.Padding(widget.NewInsetsSimple(30)),
widget.GridLayoutOpts.Spacing(20, 10),
widget.GridLayoutOpts.Stretch([]bool{true, false}, []bool{false, true}),
)),
)
buttonPlay := gameui.NewMenuButton("Play selected level", *assets.FontRenderer.FontNormal,
func(args *widget.ButtonClickedEventArgs) {
scene.SetNext(Play)
})
buttonAbort := gameui.NewMenuButton("Back", *assets.FontRenderer.FontNormal,
func(args *widget.ButtonClickedEventArgs) {
scene.SetNext(Menu)
})
buttonContainer.AddChild(buttonPlay)
buttonContainer.AddChild(buttonAbort)
rowContainer.AddChild(label)
rowContainer.AddChild(list)
rowContainer.AddChild(buttonPlay)
rowContainer.AddChild(buttonContainer)
scene.Ui = &ebitenui.UI{
Container: rowContainer.Container(),