From 33143a0ba36f3b5954af62ccd323eee0d50ec059 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 11 Apr 2019 17:03:53 +0200 Subject: [PATCH] modules/scene: better comments and organisation --- gamecore/modules/scenes.lua | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/gamecore/modules/scenes.lua b/gamecore/modules/scenes.lua index a1840ca..d60f442 100644 --- a/gamecore/modules/scenes.lua +++ b/gamecore/modules/scenes.lua @@ -25,8 +25,12 @@ local cwd = (...):gsub('%.scenes$', '') .. "." local Scene = Object:extend() -local Assets = require(cwd .. "assets") -local MenuSystem = require(cwd .. "menusystem") + +local Assets = require(cwd .. "assets") +local MenuSystem = require(cwd .. "menusystem") + +-- INIT FUNCTIONS +-- Initialize and configure the scene function Scene:new() self.mouse = {} @@ -46,10 +50,20 @@ function Scene:register() core.scenemanager:setScene(self) 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) -- Empty function, is just here to avoid crash end +-- MOUSE FUNCTIONS +-- Make the scene support the pointer + function Scene:mousemoved(x, y, dx, dy) -- Empty function, is just here to avoid crash end @@ -58,13 +72,15 @@ function Scene:mousepressed( x, y, button, istouch ) -- Empty function, is just here to avoid crash end +-- DRAW FUNCTIONS +-- Draw the scene and its content + function Scene:draw() end -function Scene:clear() - -end +-- KEYBOARD FUNCTIONS +-- Handle inputs from keyboard/controllers function Scene:setKeys() if (self.inputLocked) then