diff --git a/doc/index.html b/doc/index.html index be48c6a..5d7e6fb 100644 --- a/doc/index.html +++ b/doc/index.html @@ -65,16 +65,26 @@ Filters. - tiny.requireOne (...) + tiny.requireAny (...) Makes a Filter that selects Entities with at least one of the specified Components and Filters. + + tiny.rejectAll (...) + Makes a Filter that rejects Entities with all specified Components and + Filters, and selects all other Entities. + + + tiny.rejectAny (...) + Makes a Filter that rejects Entities with at least one of the specified + Components and Filters, and selects all other Entities. +

System functions

- + @@ -129,11 +139,11 @@ - + - + @@ -156,11 +166,11 @@ value indicating if the Entity should be processed by the System.

Filters must be added to Systems by setting the filter field of the System. - Filter’s returned by tiny.requireAll and tiny.requireOne are immutable + Filter’s returned by tiny.requireAll and tiny.requireAny are immutable and can be used by multiple Systems.

local f1 = tiny.requireAll("position", "velocity", "size")
-local f2 = tiny.requireOne("position", "velocity", "size")
+local f2 = tiny.requireAny("position", "velocity", "size")
 
 local e1 = {
     position = {2, 3},
@@ -180,6 +190,15 @@ local e3 = {
 
 print(f1(nil, e1), f1(nil, e2), f1(nil, e3)) -- prints true, false, false
 print(f2(nil, e1), f2(nil, e2), f2(nil, e3)) -- prints true, true, true
+
+ +

Filters can also be passed as arguments to other Filter constructors. This is + a powerful way to create complex, custom Filters that select a very specific + set of Entities.

+ +
-- Selects Entities with an "image" Component, but not Entities with a
+-- "Player" or "Enemy" Component.
+filter = tiny.requireAll("image", tiny.rejectAny("Player", "Enemy"))
 
@@ -205,8 +224,8 @@ print(f2(nil, e1), f2(nil, e2), f2(nil, e3)) -- prints true, true, true
- - tiny.requireOne (...) + + tiny.requireAny (...)
Makes a Filter that selects Entities with at least one of the specified @@ -224,18 +243,54 @@ print(f2(nil, e1), f2(nil, e2), f2(nil, e3)) -- prints true, true, true +
+
+ + tiny.rejectAll (...) +
+
+ Makes a Filter that rejects Entities with all specified Components and + Filters, and selects all other Entities. + + +

Parameters:

+ + + + + + +
+
+ + tiny.rejectAny (...) +
+
+ Makes a Filter that rejects Entities with at least one of the specified + Components and Filters, and selects all other Entities. + + +

Parameters:

+ + + + + +

System functions

- A System is a wrapper around function callbacks for manipulating Entities. -
-
- - tiny.system (table) -
-
-

Creates a System. Systems are tables that contain at least one method; +

A System is a wrapper around function callbacks for manipulating Entities. + Systems are implemented as tables that contain at least one method; an update function that takes parameters like so:

-

For Filters, it is conveient to use tiny.requireAll or tiny.requireOne, - but one can write their own filters as well. Set the Filter of your System - like so:

+

For Filters, it is convenient to use tiny.requireAll or tiny.requireAny, + but one can write their own filters as well. Set the Filter of a System like + so:

system.filter = tiny.requireAll("a", "b", "c")
 
@@ -267,6 +322,32 @@ print(f2(nil, e1), f2(nil, e2), f2(nil, e3)) -- prints true, true, true end +

All Systems also have a few important fields that are initialized when the + system is added to the World. A few are important, and few should be less + commonly used.

+ + + + +
+
+ + tiny.system (table) +
+
+ Creates a default System.

Parameters:

@@ -276,6 +357,11 @@ end +

Returns:

+
    + + A new System or System class +
@@ -316,6 +402,11 @@ end +

Returns:

+
    + + A new Processing System or Processing System class +

See also:

@@ -352,6 +443,11 @@ end +

Returns:

+
    + + A new Sorted System or Sorted System class +

See also:

@@ -368,10 +464,9 @@ end A World is a container that manages Entities and Systems. Typically, a program uses one World at a time.

-

The tiny-ecs module is set to be the __index of all World tables, so the - often clearer syntax of world:method() can be used for any function in the - library. For example, tiny.add(world, e1, e2, e3) is the same as - world:add(e1, e2, e3). +

For all World functions except tiny.world(…), object-oriented syntax can + be used instead of the documented syntax. For example, + tiny.add(world, e1, e2, e3) is the same as world:add(e1, e2, e3).

@@ -631,7 +726,7 @@ end tiny.getEntityCount (world)
- Gets count of Entities in World. + Gets number of Entities in the World.

Parameters:

@@ -642,6 +737,11 @@ end +

Returns:

+
    + + An integer +
@@ -652,7 +752,7 @@ end tiny.getSystemCount (world)
- Gets count of Systems in World. + Gets number of Systems in World.

Parameters:

@@ -663,6 +763,11 @@ end +

Returns:

+
    + + An integer +
@@ -689,6 +794,11 @@ end +

Returns:

+
    + + An integer between 1 and world:getSystemCount() inclusive +
@@ -720,6 +830,11 @@ end +

Returns:

+
    + + Old index +
@@ -732,7 +847,7 @@ end
generated by LDoc 1.4.3 -Last updated 2015-05-04 20:16:58 +Last updated 2015-05-07 19:57:49
tiny.system (table)Creates a System.Creates a default System.
tiny.processingSystem (table)
tiny.getEntityCount (world)Gets count of Entities in World.Gets number of Entities in the World.
tiny.getSystemCount (world)Gets count of Systems in World.Gets number of Systems in World.
tiny.getSystemIndex (world, system)