playground header skeleton, playground screen into separated files

This commit is contained in:
2023-07-07 20:33:58 +02:00
parent 9a7be89da6
commit 09959a8932
6 changed files with 74 additions and 26 deletions

View File

@@ -16,6 +16,7 @@ func (e *Engine) PlaygroundUpdate() {
func (e *Engine) PlaygroundDraw(screen *ebiten.Image) {
e.PlaygroundBackgroundDraw(screen)
e.PlaygroundHeaderDraw(screen)
e.PlaygroundPlatformsDraw(screen)
e.PlaygroundItemsDraw(screen)
e.PlaygroundNPCsDraw(screen)
@@ -27,32 +28,6 @@ func (e *Engine) PlaygroundBackgroundDraw(screen *ebiten.Image) {
e.PlaygroundAssetDraw(screen, playground.Render, konstructor.Position{})
}
func (e *Engine) PlaygroundPlatformsDraw(screen *ebiten.Image) {
playground := e.GetPlayground()
for _, platform := range playground.Platforms {
e.PlaygroundAssetDraw(screen, platform.Type.Render, platform.Position)
}
}
func (e *Engine) PlaygroundItemsDraw(screen *ebiten.Image) {
playground := e.GetPlayground()
for _, item := range playground.Items {
e.PlaygroundAssetDraw(screen, item.Type.Render, item.Position)
}
}
func (e *Engine) PlaygroundNPCsDraw(screen *ebiten.Image) {
playground := e.GetPlayground()
for _, npc := range playground.NPCs {
e.PlaygroundAssetDraw(screen, npc.Type.Render, npc.Position)
}
}
func (e *Engine) PlaygroundDefaultPlayerDraw(screen *ebiten.Image) {
player := e.Domain.GetDefaultPlayer()
e.PlaygroundAssetDraw(screen, player.Type.Render, player.Position)
}
func (e *Engine) GetPlayground() konstructor.Playground {
level := e.Domain.GetLevel(e.KContext.CurrentLevel)
return level.Playgrounds[e.KContext.CurrentPlayground]