mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-17 12:40:56 +01:00
removed unneeded code, fixed game exit from menu
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
"os"
|
||||
|
||||
"github.com/ebitenui/ebitenui"
|
||||
"github.com/ebitenui/ebitenui/widget"
|
||||
@@ -19,6 +18,7 @@ type SceneMenu struct {
|
||||
Ui *ebitenui.UI
|
||||
FontColor color.RGBA
|
||||
First bool
|
||||
Exit bool
|
||||
}
|
||||
|
||||
func NewMenuScene(game *Game, config *Config) Scene {
|
||||
@@ -54,6 +54,10 @@ func (scene *SceneMenu) SetNext(next SceneName) {
|
||||
func (scene *SceneMenu) Update() error {
|
||||
scene.Ui.Update()
|
||||
|
||||
if scene.Exit {
|
||||
return ebiten.Termination
|
||||
}
|
||||
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyEscape) || inpututil.IsKeyJustPressed(ebiten.KeyQ) {
|
||||
scene.Config.DelayedStart = false
|
||||
scene.Leave()
|
||||
@@ -120,7 +124,7 @@ func (scene *SceneMenu) Init() {
|
||||
|
||||
quit := NewMenuButton("Exit Golsky",
|
||||
func(args *widget.ButtonClickedEventArgs) {
|
||||
os.Exit(0)
|
||||
scene.Exit = true
|
||||
})
|
||||
|
||||
rowContainer.AddChild(empty)
|
||||
|
||||
Reference in New Issue
Block a user