1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-28 09:39:31 +00:00

DAMN SEQUENTIAL ORDER

This commit is contained in:
Reuh 2017-04-05 21:08:34 +02:00
parent e063f55514
commit f3b5338779
3 changed files with 6 additions and 10 deletions

View file

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

View file

@ -1,6 +1,5 @@
-- ubiquitousse.input -- ubiquitousse.input
local uqt = require((...):match("^(.-ubiquitousse)%.")) local uqt = require((...):match("^(.-ubiquitousse)%."))
local draw = uqt.draw
--- Used to store inputs which were updated this frame --- Used to store inputs which were updated this frame
-- { Input: true, ... } -- { Input: true, ... }
@ -263,6 +262,7 @@ input = {
-- @tretrun PointerInput the object -- @tretrun PointerInput the object
-- @impl ubiquitousse -- @impl ubiquitousse
pointer = function(...) pointer = function(...)
local draw = uqt.draw -- requires width and height
local pointers = {} -- pointers list local pointers = {} -- pointers list
local x, y = 0, 0 -- pointer position local x, y = 0, 0 -- pointer position
local width, height = 1, 1 -- half-dimensions of the movement area local width, height = 1, 1 -- half-dimensions of the movement area

View file

@ -1,7 +1,6 @@
-- ubiquitousse.scene -- ubiquitousse.scene
local uqt = require((...):match("^(.-ubiquitousse)%.")) local uqt = require((...):match("^(.-ubiquitousse)%."))
local m = uqt.module local m = uqt.module
local time = uqt.time
--- Returns the file path of the given module name. --- Returns the file path of the given module name.
local function getPath(modname) local function getPath(modname)
@ -53,7 +52,7 @@ scene = {
return { return {
name = name or "unamed", -- The scene name. name = name or "unamed", -- The scene name.
time = m.time and time.new(), -- Scene-specific TimerRegistry, if uqt.time is enabled. time = m.time and uqt.time.new(), -- Scene-specific TimerRegistry, if uqt.time is enabled.
enter = function(self, ...) end, -- Called when entering a scene. enter = function(self, ...) end, -- Called when entering a scene.
exit = function(self) end, -- Called when exiting a scene, and not expecting to come back (scene may be unloaded). exit = function(self) end, -- Called when exiting a scene, and not expecting to come back (scene may be unloaded).