mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2026-07-21 23:56:50 -06:00
Add optional filter to tiny.update(world, dt, [filter])
This commit is contained in:
@@ -621,7 +621,10 @@ end
|
|||||||
-- Put this in your main loop.
|
-- Put this in your main loop.
|
||||||
-- @param world
|
-- @param world
|
||||||
-- @param dt Delta time
|
-- @param dt Delta time
|
||||||
function tiny.update(world, dt)
|
-- @param filter (Optional) A Filter that selects Systems as if they were
|
||||||
|
-- Entities, and only updates selected Systems. By default, all Systems are
|
||||||
|
-- updated.
|
||||||
|
function tiny.update(world, dt, filter)
|
||||||
|
|
||||||
tiny_manageSystems(world)
|
tiny_manageSystems(world)
|
||||||
tiny_manageEntities(world)
|
tiny_manageEntities(world)
|
||||||
@@ -632,7 +635,7 @@ function tiny.update(world, dt)
|
|||||||
-- Iterate through Systems IN ORDER
|
-- Iterate through Systems IN ORDER
|
||||||
for i = 1, #systems do
|
for i = 1, #systems do
|
||||||
system = systems[i]
|
system = systems[i]
|
||||||
if system.active then
|
if system.active and ((not filter) or filter(world, system)) then
|
||||||
|
|
||||||
-- Call the modify callback on Systems that have been modified.
|
-- Call the modify callback on Systems that have been modified.
|
||||||
onModify = system.onModify
|
onModify = system.onModify
|
||||||
|
|||||||
Reference in New Issue
Block a user