1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 17:19:31 +00:00

Made modules indepent

This commit is contained in:
Reuh 2017-04-05 20:44:00 +02:00
parent b55c6b0dfd
commit b2d22c75d1
6 changed files with 24 additions and 12 deletions

View file

@ -1,7 +1,8 @@
-- ubiquitousse.event
local input = require((...):match("^(.-ubiquitousse)%.")..".input")
local time = require((...):match("^(.-ubiquitousse)%.")..".time")
local scene = require((...):match("^(.-ubiquitousse)%.")..".scene")
local uqt = require((...):match("^(.-ubiquitousse)%."))
local input = uqt.input
local time = uqt.time
local scene = uqt.scene
--- The events: callback functions that will be called when something interesting occurs.
-- Theses are expected to be redefined in the game.
@ -16,15 +17,15 @@ return {
-- @tparam number dt time since last call, in miliseconds
-- @impl mixed
update = function(dt)
input.update(dt)
time.update(dt)
scene.update(dt)
if input then input.update(dt) end
if time then time.update(dt) end
if scene then scene.update(dt) end
end,
--- Called each time the game expect a new frame to be drawn.
-- The screen is expected to be cleared since last frame.
-- @impl backend
draw = function()
scene.draw()
if scene then scene.draw() end
end
}