modules/scene: better comments and organisation
This commit is contained in:
parent
ab6475b3cf
commit
33143a0ba3
1 changed files with 21 additions and 5 deletions
|
@ -25,9 +25,13 @@
|
||||||
local cwd = (...):gsub('%.scenes$', '') .. "."
|
local cwd = (...):gsub('%.scenes$', '') .. "."
|
||||||
|
|
||||||
local Scene = Object:extend()
|
local Scene = Object:extend()
|
||||||
|
|
||||||
local Assets = require(cwd .. "assets")
|
local Assets = require(cwd .. "assets")
|
||||||
local MenuSystem = require(cwd .. "menusystem")
|
local MenuSystem = require(cwd .. "menusystem")
|
||||||
|
|
||||||
|
-- INIT FUNCTIONS
|
||||||
|
-- Initialize and configure the scene
|
||||||
|
|
||||||
function Scene:new()
|
function Scene:new()
|
||||||
self.mouse = {}
|
self.mouse = {}
|
||||||
self.mouse.x, self.mouse.y = core.screen:getMousePosition()
|
self.mouse.x, self.mouse.y = core.screen:getMousePosition()
|
||||||
|
@ -46,10 +50,20 @@ function Scene:register()
|
||||||
core.scenemanager:setScene(self)
|
core.scenemanager:setScene(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Scene:clear()
|
||||||
|
-- TODO: send automatic cleanups to the different elements of the scene
|
||||||
|
end
|
||||||
|
|
||||||
|
-- UPDATE FUNCTIONS
|
||||||
|
-- Handle stuff that happens every steps
|
||||||
|
|
||||||
function Scene:update(dt)
|
function Scene:update(dt)
|
||||||
-- Empty function, is just here to avoid crash
|
-- Empty function, is just here to avoid crash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- MOUSE FUNCTIONS
|
||||||
|
-- Make the scene support the pointer
|
||||||
|
|
||||||
function Scene:mousemoved(x, y, dx, dy)
|
function Scene:mousemoved(x, y, dx, dy)
|
||||||
-- Empty function, is just here to avoid crash
|
-- Empty function, is just here to avoid crash
|
||||||
end
|
end
|
||||||
|
@ -58,13 +72,15 @@ function Scene:mousepressed( x, y, button, istouch )
|
||||||
-- Empty function, is just here to avoid crash
|
-- Empty function, is just here to avoid crash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- DRAW FUNCTIONS
|
||||||
|
-- Draw the scene and its content
|
||||||
|
|
||||||
function Scene:draw()
|
function Scene:draw()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Scene:clear()
|
-- KEYBOARD FUNCTIONS
|
||||||
|
-- Handle inputs from keyboard/controllers
|
||||||
end
|
|
||||||
|
|
||||||
function Scene:setKeys()
|
function Scene:setKeys()
|
||||||
if (self.inputLocked) then
|
if (self.inputLocked) then
|
||||||
|
|
Loading…
Reference in a new issue