gamecore/scenes: add a wrapper around Scene changing
This commit is contained in:
parent
3b77a3c2c1
commit
4c71e262bb
2 changed files with 5 additions and 1 deletions
|
@ -40,7 +40,7 @@ function Scene:new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Scene:register()
|
function Scene:register()
|
||||||
core.scenemanager.currentScene = self
|
core.scenemanager:setScene(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Scene:update(dt)
|
function Scene:update(dt)
|
||||||
|
|
|
@ -30,6 +30,10 @@ function SceneManager:new(controller)
|
||||||
self.currentScene = nil
|
self.currentScene = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SceneManager:setScene(scene)
|
||||||
|
self.currentScene = scene
|
||||||
|
end
|
||||||
|
|
||||||
function SceneManager:update(dt)
|
function SceneManager:update(dt)
|
||||||
if (self.currentScene ~= nil) then
|
if (self.currentScene ~= nil) then
|
||||||
local keys = self.controller.input.keys
|
local keys = self.controller.input.keys
|
||||||
|
|
Loading…
Reference in a new issue