mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-16 20:20:57 +01:00
toggle directly in scene's Draw, but fails too
This commit is contained in:
7
game.go
7
game.go
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
@@ -51,9 +53,6 @@ func (game *Game) Update() error {
|
||||
scene := game.GetCurrentScene()
|
||||
scene.Update()
|
||||
|
||||
// FIXME: should work, but doesn't
|
||||
//ebiten.SetScreenClearedEveryFrame(scene.Clearscreen())
|
||||
|
||||
next := scene.GetNext()
|
||||
|
||||
if next != game.CurrentScene {
|
||||
@@ -64,7 +63,7 @@ func (game *Game) Update() error {
|
||||
game.CurrentScene = next
|
||||
}
|
||||
|
||||
//fmt.Printf("Clear Screen: %t\n", ebiten.IsScreenClearedEveryFrame())
|
||||
fmt.Printf("Clear Screen: %t\n", ebiten.IsScreenClearedEveryFrame())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -62,17 +62,11 @@ func (scene *SceneMenu) Update() error {
|
||||
}
|
||||
|
||||
func (scene *SceneMenu) Draw(screen *ebiten.Image) {
|
||||
//op := &ebiten.DrawImageOptions{}
|
||||
// op.GeoM.Reset()
|
||||
// op.GeoM.Translate(0, 0)
|
||||
|
||||
// screen.DrawImage(scene.Game.Screen, op)
|
||||
|
||||
ebiten.SetScreenClearedEveryFrame(false)
|
||||
scene.Ui.Draw(screen)
|
||||
}
|
||||
|
||||
func (scene *SceneMenu) Leave() {
|
||||
ebiten.SetScreenClearedEveryFrame(true)
|
||||
scene.SetNext(Play)
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ func (scene *SceneOptions) Update() error {
|
||||
}
|
||||
|
||||
func (scene *SceneOptions) Draw(screen *ebiten.Image) {
|
||||
ebiten.SetScreenClearedEveryFrame(false)
|
||||
scene.Ui.Draw(screen)
|
||||
}
|
||||
|
||||
|
||||
@@ -158,16 +158,7 @@ func (scene *ScenePlay) CheckInput() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// FIXME: works from here
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyK) {
|
||||
scene.Clear = !scene.Clear
|
||||
fmt.Printf("Clear: %t\n", scene.Clear)
|
||||
ebiten.SetScreenClearedEveryFrame(scene.Clear)
|
||||
}
|
||||
|
||||
// FIXME: and this does have no effect. WHY?!?!?
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyEscape) {
|
||||
ebiten.SetScreenClearedEveryFrame(false)
|
||||
scene.SetNext(Menu)
|
||||
}
|
||||
|
||||
@@ -412,6 +403,8 @@ func (scene *ScenePlay) ToggleCellOnCursorPos(alive int64) {
|
||||
|
||||
// draw the new grid state
|
||||
func (scene *ScenePlay) Draw(screen *ebiten.Image) {
|
||||
ebiten.SetScreenClearedEveryFrame(true)
|
||||
|
||||
// we fill the whole screen with a background color, the cells
|
||||
// themselfes will be 1px smaller as their nominal size, producing
|
||||
// a nice grey grid with grid lines
|
||||
|
||||
Reference in New Issue
Block a user