chore: make the scene handle its manager

This commit is contained in:
Kazhnuz 2021-08-20 23:02:18 +02:00
parent 2f6ab59cd6
commit 167491ecaa
2 changed files with 24 additions and 16 deletions

View file

@ -78,14 +78,7 @@ function SceneManager:update(dt)
end
if (self.currentScene ~= nil) then
self.currentScene:updateStart(dt)
self.currentScene:setKeys()
self.currentScene.assets:update(dt)
self.currentScene:updateMenus(dt)
self.currentScene:updateDialog(dt)
self.currentScene:updateWorld(dt)
self.currentScene:update(dt)
self.currentScene:updateEnd(dt)
self.currentScene:updateScene(dt)
end
end
@ -129,14 +122,7 @@ end
function SceneManager:draw()
self.controller.screen:apply()
if (self.currentScene ~= nil) then
self.currentScene:drawStart()
self.currentScene:drawWorld()
self.currentScene:draw()
self.currentScene:drawMenus()
self.currentScene:drawDialog()
self.currentScene:drawEnd()
self.controller.screen:drawTransition()
self.currentScene:drawOverTransition()
self.currentScene:drawScene()
end
self.controller.screen:cease()
end

View file

@ -65,6 +65,17 @@ end
-- UPDATE FUNCTIONS
-- Handle stuff that happens every steps
function Scene:updateScene(dt)
self:updateStart(dt)
self:setKeys()
self.assets:update(dt)
self:updateMenus(dt)
self:updateDialog(dt)
self:updateWorld(dt)
self:update(dt)
self:updateEnd(dt)
end
function Scene:updateStart(dt)
end
@ -134,6 +145,17 @@ end
-- DRAW FUNCTIONS
-- Draw the scene and its content
function Scene:drawScene()
self:drawStart()
self:drawWorld()
self:draw()
self:drawMenus()
self:drawDialog()
self:drawEnd()
core.screen:drawTransition()
self:drawOverTransition()
end
function Scene:drawStart()
end