mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-17 04:30:57 +01:00
fixed exit function with q, added evolution trace to options fixed inverse
This commit is contained in:
22
play.go
22
play.go
@@ -5,7 +5,6 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
"github.com/hajimehoshi/ebiten/v2/inpututil"
|
||||
@@ -162,11 +161,15 @@ func (scene *ScenePlay) Reset() {
|
||||
}
|
||||
|
||||
// check user input
|
||||
func (scene *ScenePlay) CheckInput() {
|
||||
func (scene *ScenePlay) CheckExit() error {
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyQ) {
|
||||
os.Exit(0)
|
||||
return ebiten.Termination
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (scene *ScenePlay) CheckInput() {
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyEscape) {
|
||||
scene.SetNext(Menu)
|
||||
}
|
||||
@@ -176,7 +179,6 @@ func (scene *ScenePlay) CheckInput() {
|
||||
}
|
||||
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyC) {
|
||||
fmt.Println("mark mode on")
|
||||
scene.Config.Markmode = true
|
||||
scene.Config.Paused = true
|
||||
}
|
||||
@@ -297,6 +299,10 @@ func (scene *ScenePlay) CheckMarkInput() {
|
||||
return
|
||||
}
|
||||
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyEscape) {
|
||||
scene.Config.Markmode = false
|
||||
}
|
||||
|
||||
if ebiten.IsMouseButtonPressed(ebiten.MouseButton0) {
|
||||
if !scene.MarkTaken {
|
||||
scene.Mark = scene.GetWorldCursorPos()
|
||||
@@ -391,6 +397,10 @@ func (scene *ScenePlay) Update() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if quit := scene.CheckExit(); quit != nil {
|
||||
return quit
|
||||
}
|
||||
|
||||
scene.CheckInput()
|
||||
scene.CheckDraggingInput()
|
||||
scene.CheckMarkInput()
|
||||
@@ -498,6 +508,10 @@ func (scene *ScenePlay) DrawDebug(screen *ebiten.Image) {
|
||||
paused = "-- paused --"
|
||||
}
|
||||
|
||||
if scene.Config.Markmode {
|
||||
paused = "-- mark --"
|
||||
}
|
||||
|
||||
x, y := ebiten.CursorPosition()
|
||||
debug := fmt.Sprintf(
|
||||
DEBUG_FORMAT,
|
||||
|
||||
Reference in New Issue
Block a user