gamecore/scenemanager: let the scene manager handle directly the world

This commit is contained in:
Kazhnuz 2019-05-28 19:31:42 +02:00
parent 23f17491ad
commit df4d264c21
4 changed files with 10 additions and 8 deletions

View file

@ -51,8 +51,6 @@ function TestScene:update(dt)
local i = math.floor(self.i) local i = math.floor(self.i)
self.estImpair = (math.floor(i / 2) ~= (i / 2)) self.estImpair = (math.floor(i / 2) ~= (i / 2))
self.world:update(dt)
end end
function TestScene:mousepressed(x, y) function TestScene:mousepressed(x, y)
@ -79,8 +77,6 @@ function TestScene:draw()
utils.graphics.resetColor() utils.graphics.resetColor()
end end
self.world:draw()
end end
return TestScene return TestScene

View file

@ -37,11 +37,11 @@ function MovePlayer:new()
end end
function MovePlayer:update(dt) function MovePlayer:update(dt)
self.world:update(dt)
end end
function MovePlayer:draw() function MovePlayer:draw()
self.world:draw()
end end
return MovePlayer return MovePlayer

View file

@ -39,11 +39,11 @@ function Plateformer:new()
end end
function Plateformer:update(dt) function Plateformer:update(dt)
self.world:update(dt)
end end
function Plateformer:draw() function Plateformer:draw()
self.world:draw()
end end
return Plateformer return Plateformer

View file

@ -67,6 +67,9 @@ function SceneManager:update(dt)
self.currentScene:setKeys() self.currentScene:setKeys()
self.currentScene.assets:update(dt) self.currentScene.assets:update(dt)
self.currentScene.menusystem:update(dt) self.currentScene.menusystem:update(dt)
if (self.currentScene.world ~= nil) then
self.currentScene.world:update(dt)
end
self.currentScene:update(dt) self.currentScene:update(dt)
end end
end end
@ -109,6 +112,9 @@ function SceneManager:draw()
if (self.currentScene ~= nil) then if (self.currentScene ~= nil) then
self.currentScene:draw(dt) self.currentScene:draw(dt)
self.currentScene.menusystem:draw() self.currentScene.menusystem:draw()
if (self.currentScene.world ~= nil) then
self.currentScene.world:draw()
end
end end
self.controller.screen:cease() self.controller.screen:cease()
end end