mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-16 20:20:57 +01:00
another try, but fails as well + added todos
This commit is contained in:
5
TODO.md
5
TODO.md
@@ -9,3 +9,8 @@
|
||||
- looks like a race condition
|
||||
- obviously with K there are more loops before actually switching
|
||||
scenes, which doesn't happen with ESC
|
||||
|
||||
|
||||
- if grid lines is disabled, they appear anyway in the first frame (then disappear)
|
||||
|
||||
- changing options mid-game has no effect in most cases, even after a restart
|
||||
|
||||
24
game.go
24
game.go
@@ -53,22 +53,26 @@ func (game *Game) Update() error {
|
||||
scene := game.GetCurrentScene()
|
||||
scene.Update()
|
||||
|
||||
next := scene.GetNext()
|
||||
|
||||
if next != game.CurrentScene {
|
||||
// make sure we stay on the selected scene
|
||||
scene.ResetNext()
|
||||
|
||||
// finally switch
|
||||
game.CurrentScene = next
|
||||
}
|
||||
|
||||
fmt.Printf("Clear Screen: %t\n", ebiten.IsScreenClearedEveryFrame())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (game *Game) Draw(screen *ebiten.Image) {
|
||||
var nextscene Scene
|
||||
scene := game.GetCurrentScene()
|
||||
|
||||
next := scene.GetNext()
|
||||
if next != game.CurrentScene {
|
||||
scene.ResetNext()
|
||||
game.CurrentScene = next
|
||||
nextscene = game.GetCurrentScene()
|
||||
ebiten.SetScreenClearedEveryFrame(nextscene.Clearscreen())
|
||||
}
|
||||
|
||||
scene.Draw(screen)
|
||||
|
||||
if nextscene != nil {
|
||||
nextscene.Draw(screen)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ func (scene *SceneMenu) Update() error {
|
||||
}
|
||||
|
||||
func (scene *SceneMenu) Draw(screen *ebiten.Image) {
|
||||
ebiten.SetScreenClearedEveryFrame(false)
|
||||
scene.Ui.Draw(screen)
|
||||
}
|
||||
|
||||
@@ -82,6 +81,7 @@ func (scene *SceneMenu) Init() {
|
||||
|
||||
random := NewMenuButton("Start with random patterns",
|
||||
func(args *widget.ButtonClickedEventArgs) {
|
||||
scene.Config.Empty = false
|
||||
scene.Config.Restart = true
|
||||
scene.Leave()
|
||||
})
|
||||
|
||||
@@ -60,7 +60,6 @@ func (scene *SceneOptions) Update() error {
|
||||
}
|
||||
|
||||
func (scene *SceneOptions) Draw(screen *ebiten.Image) {
|
||||
ebiten.SetScreenClearedEveryFrame(false)
|
||||
scene.Ui.Draw(screen)
|
||||
}
|
||||
|
||||
|
||||
@@ -403,8 +403,6 @@ 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