Add code for preWrap and postWrap to system.

This commit is contained in:
Calvin Rose 2016-04-13 14:28:38 -04:00
parent d9c296dae6
commit df5c84033b

View File

@ -765,6 +765,15 @@ function tiny.update(world, dt, filter)
local systems = world.systems local systems = world.systems
-- Iterate through Systems IN REVERSE ORDER
for i = #systems, 1, -1 do
local system = systems[i]
local preWrap = system.preWrap
if preWrap and system.active and ((not filter) or filter(world, system)) then
preWrap(system, dt)
end
end
-- Iterate through Systems IN ORDER -- Iterate through Systems IN ORDER
for i = 1, #systems do for i = 1, #systems do
local system = systems[i] local system = systems[i]
@ -797,6 +806,16 @@ function tiny.update(world, dt, filter)
system.modified = false system.modified = false
end end
end end
-- Iterate through Systems IN ORDER AGAIN
for i = 1, #systems do
local system = systems[i]
local postWrap = system.postWrap
if postWrap and system.active and ((not filter) or filter(world, system)) then
postWrap(system, dt)
end
end
end end
--- Removes all Entities from the World. --- Removes all Entities from the World.