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 end
if (self.currentScene ~= nil) then if (self.currentScene ~= nil) then
self.currentScene:updateStart(dt) self.currentScene:updateScene(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)
end end
end end
@ -129,14 +122,7 @@ end
function SceneManager:draw() function SceneManager:draw()
self.controller.screen:apply() self.controller.screen:apply()
if (self.currentScene ~= nil) then if (self.currentScene ~= nil) then
self.currentScene:drawStart() self.currentScene:drawScene()
self.currentScene:drawWorld()
self.currentScene:draw()
self.currentScene:drawMenus()
self.currentScene:drawDialog()
self.currentScene:drawEnd()
self.controller.screen:drawTransition()
self.currentScene:drawOverTransition()
end end
self.controller.screen:cease() self.controller.screen:cease()
end end

View file

@ -65,6 +65,17 @@ end
-- UPDATE FUNCTIONS -- UPDATE FUNCTIONS
-- Handle stuff that happens every steps -- 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) function Scene:updateStart(dt)
end end
@ -134,6 +145,17 @@ end
-- DRAW FUNCTIONS -- DRAW FUNCTIONS
-- Draw the scene and its content -- 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() function Scene:drawStart()
end end