blob: 2e429c2376854332db8a4a0647f81cea50d375d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
--- `SceneManager`
-- Used for changing single active scene.
-- TODO: Extend functionality for more than one active scene (eg. overlay menu).
SceneManager = require "not.Object":extends()
function SceneManager:changeScene (scene)
if self.scene ~= nil then
self.scene:delete()
end
self.scene = scene
end
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
|