diff --git a/gamecore/scenemanager.lua b/gamecore/scenemanager.lua index 5d403ca..ad7c9d6 100644 --- a/gamecore/scenemanager.lua +++ b/gamecore/scenemanager.lua @@ -42,15 +42,19 @@ function SceneManager:update(dt) end function SceneManager:mousemoved(x, y, dx, dy) - self.currentScene.mouse.x, - self.currentScene.mouse.y = x, y - self.currentScene:mousemoved(x, y, dx, dy) - self.currentScene.menusystem:mousemoved(x, y, dx, dy) + if (self.currentScene ~= nil) then + self.currentScene.mouse.x, + self.currentScene.mouse.y = x, y + self.currentScene:mousemoved(x, y, dx, dy) + self.currentScene.menusystem:mousemoved(x, y, dx, dy) + end end function SceneManager:mousepressed( x, y, button, istouch ) - self.currentScene:mousepressed( x, y, button, istouch ) - self.currentScene.menusystem:mousepressed( x, y, button, istouch ) + if (self.currentScene ~= nil) then + self.currentScene:mousepressed( x, y, button, istouch ) + self.currentScene.menusystem:mousepressed( x, y, button, istouch ) + end end function SceneManager:clearScene()