mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2024-11-17 04:44:23 +00:00
Add code for preWrap and postWrap to system.
This commit is contained in:
parent
d9c296dae6
commit
df5c84033b
19
tiny.lua
19
tiny.lua
@ -765,6 +765,15 @@ function tiny.update(world, dt, filter)
|
||||
|
||||
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
|
||||
for i = 1, #systems do
|
||||
local system = systems[i]
|
||||
@ -797,6 +806,16 @@ function tiny.update(world, dt, filter)
|
||||
system.modified = false
|
||||
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
|
||||
|
||||
--- Removes all Entities from the World.
|
||||
|
Loading…
Reference in New Issue
Block a user