mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2024-11-17 04:44:23 +00:00
Add tiny.refresh for updating a World without updating Systems.
This commit is contained in:
parent
b1c7e2ba83
commit
26f8259f2b
13
tiny.lua
13
tiny.lua
@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
-- @author Calvin Rose
|
||||
-- @license MIT
|
||||
-- @copyright 2015
|
||||
local tiny = { _VERSION = "1.1-6" }
|
||||
local tiny = { _VERSION = "scm" }
|
||||
|
||||
-- Local versions of standard lua functions
|
||||
local tinsert = table.insert
|
||||
@ -435,7 +435,7 @@ end
|
||||
tiny_removeSystem = tiny.removeSystem
|
||||
|
||||
--- Shortcut for removing multiple Entities and Systems from the World. Returns
|
||||
-- all rmeove Systems and Entities
|
||||
-- all removed Systems and Entities
|
||||
function tiny.remove(world, ...)
|
||||
local obj
|
||||
for i = 1, select("#", ...) do
|
||||
@ -609,6 +609,14 @@ function tiny_manageEntities(world)
|
||||
world.entityCount = entityCount
|
||||
end
|
||||
|
||||
--- Manages Entities and Systems marked for deletion or addition. Call this
|
||||
-- before modifying Systems and Entities outside of a call to `tiny.update`.
|
||||
-- Do not call this within a call to `tiny.update`.
|
||||
function tiny.refresh(world)
|
||||
tiny_manageSystems(world)
|
||||
tiny_manageEntities(world)
|
||||
end
|
||||
|
||||
--- Updates the World by dt (delta time). Takes an optional parameter, `filter`,
|
||||
-- which is a Filter that selects Systems from the World, and updates only those
|
||||
-- Systems. If `filter` is not supplied, all Systems are updated. Put this
|
||||
@ -712,6 +720,7 @@ worldMetaTable = {
|
||||
remove = tiny.remove,
|
||||
removeEntity = tiny.removeEntity,
|
||||
removeSystem = tiny.removeSystem,
|
||||
refresh = tiny.refresh,
|
||||
update = tiny.update,
|
||||
clearEntities = tiny.clearEntities,
|
||||
clearSystems = tiny.clearSystems,
|
||||
|
Loading…
Reference in New Issue
Block a user