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)
self.estImpair = (math.floor(i / 2) ~= (i / 2))
self.world:update(dt)
end
function TestScene:mousepressed(x, y)
@ -79,8 +77,6 @@ function TestScene:draw()
utils.graphics.resetColor()
end
self.world:draw()
end
return TestScene

View file

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

View file

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

View file

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