fix: lock inputs between scenes
This commit is contained in:
parent
e962396ee1
commit
508b044669
2 changed files with 10 additions and 3 deletions
|
@ -40,8 +40,8 @@ function Scene:new()
|
||||||
self.menusystem = MenuSystem(self)
|
self.menusystem = MenuSystem(self)
|
||||||
self.sources = core.input:getSources()
|
self.sources = core.input:getSources()
|
||||||
|
|
||||||
self.inputLocked = false
|
self.inputLocked = true
|
||||||
self.inputLockedTimer = 0
|
self.inputLockedTimer = 2
|
||||||
|
|
||||||
self:initWorld()
|
self:initWorld()
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,14 @@ local SceneManager = Object:extend()
|
||||||
function SceneManager:new(controller)
|
function SceneManager:new(controller)
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
self.currentScene = nil
|
self.currentScene = nil
|
||||||
|
self.nextScene = nil
|
||||||
|
|
||||||
self.storage = {}
|
self.storage = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function SceneManager:setScene(scene)
|
function SceneManager:setScene(scene)
|
||||||
self.currentScene = scene
|
--self.currentScene = nil
|
||||||
|
self.nextScene = scene
|
||||||
end
|
end
|
||||||
|
|
||||||
function SceneManager:storeCurrentScene(name)
|
function SceneManager:storeCurrentScene(name)
|
||||||
|
@ -63,6 +65,11 @@ end
|
||||||
-- Update the current scene and its subobjects
|
-- Update the current scene and its subobjects
|
||||||
|
|
||||||
function SceneManager:update(dt)
|
function SceneManager:update(dt)
|
||||||
|
if (self.nextScene ~= nil) then
|
||||||
|
self.currentScene = self.nextScene
|
||||||
|
self.nextScene = nil
|
||||||
|
end
|
||||||
|
|
||||||
if (self.currentScene ~= nil) then
|
if (self.currentScene ~= nil) then
|
||||||
self.currentScene:updateStart(dt)
|
self.currentScene:updateStart(dt)
|
||||||
self.currentScene:setKeys()
|
self.currentScene:setKeys()
|
||||||
|
|
Loading…
Reference in a new issue