mirror of
https://github.com/Reuh/ubiquitousse.git
synced 2025-10-28 01:29:31 +00:00
Optionals arguments to scene.draw and scene.update
This commit is contained in:
parent
35c528f858
commit
52b3389e13
1 changed files with 8 additions and 6 deletions
14
scene.lua
14
scene.lua
|
|
@ -52,8 +52,8 @@ scene = {
|
||||||
suspend = function() end, -- Called when suspending a scene, and expecting to come back (scene won't be unloaded).
|
suspend = function() end, -- Called when suspending a scene, and expecting to come back (scene won't be unloaded).
|
||||||
resume = function() end, -- Called when resuming a suspended scene (after calling suspend).
|
resume = function() end, -- Called when resuming a suspended scene (after calling suspend).
|
||||||
|
|
||||||
update = function(dt) end, -- Called on each abstract.event.update on the current scene.
|
update = function(dt, ...) end, -- Called on each abstract.event.update on the current scene.
|
||||||
draw = function() end -- Called on each abstract.event.draw on the current scene.
|
draw = function(...) end -- Called on each abstract.event.draw on the current scene.
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
@ -96,19 +96,21 @@ scene = {
|
||||||
--- Update the current scene.
|
--- Update the current scene.
|
||||||
-- Should be called in abstract.event.update.
|
-- Should be called in abstract.event.update.
|
||||||
-- @tparam number dt the delta-time (milisecond)
|
-- @tparam number dt the delta-time (milisecond)
|
||||||
|
-- @param ... arguments to pass to the scene's update function after dt
|
||||||
-- @impl abstract
|
-- @impl abstract
|
||||||
update = function(dt)
|
update = function(dt, ...)
|
||||||
if scene.current then
|
if scene.current then
|
||||||
scene.current.time.update(dt)
|
scene.current.time.update(dt)
|
||||||
scene.current.update(dt)
|
scene.current.update(dt, ...)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
--- Draw the current scene.
|
--- Draw the current scene.
|
||||||
-- Should be called in abstract.event.draw.
|
-- Should be called in abstract.event.draw.
|
||||||
|
-- @param ... arguments to pass to the scene's draw function
|
||||||
-- @impl abstract
|
-- @impl abstract
|
||||||
draw = function()
|
draw = function(...)
|
||||||
if scene.current then scene.current.draw() end
|
if scene.current then scene.current.draw(...) end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue