2 Commits

Author SHA1 Message Date
bakpakin
f0e6ce7880 Update to version 1.1-7. 2015-08-05 21:01:53 -04:00
bakpakin
26f8259f2b Add tiny.refresh for updating a World without updating Systems. 2015-07-29 12:40:13 -04:00
2 changed files with 35 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
package = "tiny-ecs"
version = "1.1-7"
source = {
url = "git://github.com/bakpakin/tiny-ecs",
tag = "1.1-7"
}
description = {
summary = "Entity Component System for Lua.",
detailed = [[
Pure Lua implementation of an easy to use, compact, fast, and flexible
Entity Component System. Works well with Object Orientation.
]],
homepage = "https://github.com/bakpakin/tiny-ecs",
license = "MIT"
}
dependencies = {
"lua >= 5.1"
}
build = {
type = "builtin",
modules = {
tiny = "tiny.lua"
}
}
+11 -2
View File
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-- @author Calvin Rose -- @author Calvin Rose
-- @license MIT -- @license MIT
-- @copyright 2015 -- @copyright 2015
local tiny = { _VERSION = "1.1-6" } local tiny = { _VERSION = "1.1-7" }
-- Local versions of standard lua functions -- Local versions of standard lua functions
local tinsert = table.insert local tinsert = table.insert
@@ -435,7 +435,7 @@ end
tiny_removeSystem = tiny.removeSystem tiny_removeSystem = tiny.removeSystem
--- Shortcut for removing multiple Entities and Systems from the World. Returns --- 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, ...) function tiny.remove(world, ...)
local obj local obj
for i = 1, select("#", ...) do for i = 1, select("#", ...) do
@@ -609,6 +609,14 @@ function tiny_manageEntities(world)
world.entityCount = entityCount world.entityCount = entityCount
end 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`, --- 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 -- 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 -- Systems. If `filter` is not supplied, all Systems are updated. Put this
@@ -712,6 +720,7 @@ worldMetaTable = {
remove = tiny.remove, remove = tiny.remove,
removeEntity = tiny.removeEntity, removeEntity = tiny.removeEntity,
removeSystem = tiny.removeSystem, removeSystem = tiny.removeSystem,
refresh = tiny.refresh,
update = tiny.update, update = tiny.update,
clearEntities = tiny.clearEntities, clearEntities = tiny.clearEntities,
clearSystems = tiny.clearSystems, clearSystems = tiny.clearSystems,