Struct trex::World [] [src]

pub struct World { /* fields omitted */ }

Contains all entities and their components.

Methods

impl World
[src]

Create an empty World.

Register a new component class.

Returns true if the entity has been created and is not destroyed, otherwise false.

Examples

let mut world = trex::World::new();
let entity = world.create();
assert!(world.exists(entity));

Create a new Entity.

Assign a tag to the Entity so that it can be retrieved later.

Examples

let mut world = trex::World::new();
let entity = world.create();
world.tag(entity, "Example");
assert_eq!(world.lookup("Example"), Some(entity));

Remove the existing tag, if any, from an Entity.

Examples

let mut world = trex::World::new();
let entity = world.create();
world.tag(entity, "Example");
world.untag(entity);
assert_eq!(world.lookup("Example"), None);

Retreive an Entity using a tag.

Destroy an existing Entity. Also removes the tag and any attached components.

Examples

let mut world = trex::World::new();
let entity = world.create();
world.tag(entity, "Example");
world.destroy(entity);
assert_eq!(world.lookup("Example"), None);

Returns a list of all Entitys with a given set of components.

Attach a component to an Entity.

Remove a component from an Entity.

Returns true if the Entity has the component, otherwise false.

Get a component of an Entity.

Get a mutable component of an Entity.