mirror of
https://github.com/bakpakin/tiny-ecs.git
synced 2024-11-17 04:44:23 +00:00
Add tests. Add getters and setters for entity and system count.
This commit is contained in:
parent
c5c27c679c
commit
53ef1f2d36
@ -151,7 +151,20 @@ describe('tiny-ecs:', function()
|
||||
assert.equals(timePassed, 1)
|
||||
assert.are_not.equal(entity1.xform.x, entityTemplate1.xform.x)
|
||||
end)
|
||||
|
||||
|
||||
it("Clear Entities", function()
|
||||
world:clearEntities()
|
||||
world:update(1)
|
||||
assert.equals(0, world.getEntityCount())
|
||||
end)
|
||||
|
||||
it("Clear Systems", function()
|
||||
world:clearSystems()
|
||||
world:update(1)
|
||||
assert.equals(0, world.getSystemCount())
|
||||
end)
|
||||
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
12
tiny.lua
12
tiny.lua
@ -382,6 +382,18 @@ function tiny.clearSystems(world)
|
||||
world.systemsToRemove = newSystemsToRemove
|
||||
end
|
||||
|
||||
--- Gets count of Entities in World.
|
||||
-- @param world
|
||||
function tiny.getEntityCount(world)
|
||||
return world.entityCount
|
||||
end
|
||||
|
||||
--- Gets count of Systems in World.
|
||||
-- @param world
|
||||
function tiny.getSystemsCount(world)
|
||||
return world.systemCount
|
||||
end
|
||||
|
||||
--- Sets if a System is active in a world. If the system is active, it will
|
||||
-- update automatically when World:update(dt) is called. Otherwise, the user
|
||||
-- must call World:updateSystem(system, dt) to update the unactivated system.
|
||||
|
Loading…
Reference in New Issue
Block a user