added workaround for clearscreen problem, fixed grid line option

This commit is contained in:
2024-05-31 14:19:30 +02:00
parent 73be8b93f4
commit 320c666af9
7 changed files with 90 additions and 39 deletions

View File

@@ -10,6 +10,7 @@ type Game struct {
CurrentScene SceneName
Config *Config
Scale float32
Screen *ebiten.Image
}
func NewGame(config *Config, startscene SceneName) *Game {
@@ -30,7 +31,8 @@ func NewGame(config *Config, startscene SceneName) *Game {
ebiten.SetWindowSize(game.ScreenWidth, game.ScreenHeight)
ebiten.SetWindowTitle("golsky - conway's game of life")
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
ebiten.SetScreenClearedEveryFrame(false)
game.Screen = ebiten.NewImage(game.ScreenWidth, game.ScreenHeight)
return game
}
@@ -48,6 +50,8 @@ func (game *Game) Update() error {
scene := game.GetCurrentScene()
scene.Update()
//ebiten.SetScreenClearedEveryFrame(scene.Clearscreen())
next := scene.GetNext()
if next != game.CurrentScene {
@@ -63,5 +67,6 @@ func (game *Game) Update() error {
func (game *Game) Draw(screen *ebiten.Image) {
scene := game.GetCurrentScene()
ebiten.SetScreenClearedEveryFrame(scene.Clearscreen())
scene.Draw(screen)
}