fixed exit function with q, added evolution trace to options fixed inverse

This commit is contained in:
2024-06-03 18:38:18 +02:00
parent 03e1101248
commit 443b5a2bcf
5 changed files with 35 additions and 6 deletions

22
play.go
View File

@@ -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,