mirror of
https://codeberg.org/scip/golsky.git
synced 2025-12-17 04:30:57 +01:00
add test code
This commit is contained in:
@@ -27,6 +27,7 @@ func NewGame(config *Config, startscene SceneName) *Game {
|
||||
game.Scenes[Menu] = NewMenuScene(game, config)
|
||||
game.Scenes[Options] = NewOptionsScene(game, config)
|
||||
game.Scenes[Keybindings] = NewKeybindingsScene(game, config)
|
||||
game.Scenes[Toolbar] = NewToolbarScene(game, config)
|
||||
|
||||
// setup environment
|
||||
ebiten.SetWindowSize(game.ScreenWidth, game.ScreenHeight)
|
||||
@@ -67,6 +68,7 @@ func (game *Game) Update() error {
|
||||
|
||||
func (game *Game) Draw(screen *ebiten.Image) {
|
||||
// first draw primary scene[s], although there are only 1
|
||||
skip := false
|
||||
for current, scene := range game.Scenes {
|
||||
if scene.IsPrimary() {
|
||||
// primary scenes always draw
|
||||
@@ -74,11 +76,15 @@ func (game *Game) Draw(screen *ebiten.Image) {
|
||||
|
||||
if current == game.CurrentScene {
|
||||
// avoid to redraw it in the next step
|
||||
return
|
||||
skip = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if skip {
|
||||
return
|
||||
}
|
||||
|
||||
scene := game.GetCurrentScene()
|
||||
scene.Draw(screen)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user