From ea694c3659c801effaaf3361d3713f20517de3f5 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 12 Jul 2017 09:52:06 +0200 Subject: SceneManager has Controller and Love2D callbacks --- main.lua | 8 ++++---- not/SceneManager.lua | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/main.lua b/main.lua index 74c3571..869cac8 100644 --- a/main.lua +++ b/main.lua @@ -46,7 +46,7 @@ function love.load () end function love.draw () - sceneManager:getScene():draw() + sceneManager:draw() if debug then local scale = getScale() love.graphics.setFont(Font) @@ -57,7 +57,7 @@ function love.draw () end end -function love.update (dt) sceneManager:getScene():update(dt) end +function love.update (dt) sceneManager:update(dt) end function love.quit () Settings.save() end -- Pass input to Controller @@ -69,12 +69,12 @@ function love.keyreleased (key) Controller.keyreleased(key) end -- Controller callbacks function Controller.controlpressed (set, action, key) - sceneManager:getScene():controlpressed(set, action, key) + sceneManager:controlpressed(set, action, key) if key == "f5" then debug = not debug end end function Controller.controlreleased (set, action, key) - sceneManager:getScene():controlreleased(set, action, key) + sceneManager:controlreleased(set, action, key) end diff --git a/not/SceneManager.lua b/not/SceneManager.lua index 367a4c0..2e429c2 100644 --- a/not/SceneManager.lua +++ b/not/SceneManager.lua @@ -14,4 +14,20 @@ function SceneManager:getScene () return self.scene end +function SceneManager:update (dt) + self:getScene():update(dt) +end + +function SceneManager:draw () + self:getScene():draw() +end + +function SceneManager:controlpressed (set, action, key) + self:getScene():controlpressed(set, action, key) +end + +function SceneManager:controlreleased (set, action, key) + self:getScene():controlreleased(set, action, key) +end + return SceneManager -- cgit v1.1