World Class
The primary instance for the framework. It contains all the managers. You must use this to create, delete and retrieve entities. It is also important to set the delta each game loop iteration, and initialize before game loop.
Item Index
Methods
Methods
changedEntity
-
entity
Ensure all systems are notified of changes to this entity. If you're adding a component to an entity after it's been added to the world, then you need to invoke this method.
Parameters:
-
entity
Entity
check
-
entities
-
performer
Performs an action on each entity.
Parameters:
-
entities
Utils.Bag -
performer
Object
createEntity
()
Entity
Create and return a new or reused entity instance. Will NOT add the entity to the world, use World.addEntity(Entity) for that.
Returns:
deleteManager
-
manager
Deletes the manager from this world.
Parameters:
-
manager
Managermanager to delete.
deleteSystem
-
system
Removed the specified system from the world.
Parameters:
-
system
Objectto be deleted from world.
disableEntity
-
entity
Disable the entity from being processed. Won't delete it, it will continue to exist but won't get processed.
Parameters:
-
entity
Entity
enableEntity
-
entity
(Re)enable the entity in the world, after it having being disabled. Won't do anything unless it was already disabled.
Parameters:
-
entity
Entity
getComponentManager
()
ComponentManager
Returns a manager that takes care of all the components in the world.
Returns:
getDelta
()
Number
Returns:
getEntity
-
entityId
Get a entity having the specified id.
Parameters:
-
entityId
Number
Returns:
getEntityManager
()
EntityManager
Returns a manager that takes care of all the entities in the world. entities of this world
Returns:
getMapper
-
type
Retrieves a ComponentMapper instance for fast retrieval of components from entities.
Parameters:
-
type
Objectof component to get mapper for.
Returns:
getSystem
-
systemType
Retrieve a system for specified system type.
Parameters:
-
systemType
Stringtype of system.
Returns:
getSystems
()
Mixed
Gives you all the systems in this world for possible iteration.
Returns:
initialize
()
Makes sure all managers systems are initialized in the order they were added
notifySystems
-
performer
-
entity
Notify all the systems
Parameters:
-
performer
ObjectObject with callback perform
-
entity
Entity
notifySystems
-
performer
-
entity
Notify all the managers
Parameters:
-
performer
ObjectObject with callback perform
-
entity
Entity
process
()
Process all non-passive systems.
setDelta
-
d
You must specify the delta for the game here.
Parameters:
-
d
Numbertime since last game loop.
setManager
-
manager
Add a manager into this world. It can be retrieved later. World will notify this manager of changes to entity.
Parameters:
-
manager
Managermanager to be added
Returns:
setSystem
-
system
-
[passive]
Adds a system to this world that will be processed by World.process()
Parameters:
-
system
EntitySystemthe system to add.
-
[passive]
Boolean optionalwether or not this system will be processed by World.process()