xecs.World#
- class xecs.World[source]#
Bases:
object
Stores and manages all entities, components, and resources.
Methods
Add a component pool to the world.
Add a resource to the world.
Get a resource.
Get a view of some components.
Check if a pool for a given component type exists.
Check if the world has a resource.
- add_pool(pool)[source]#
Add a component pool to the world.
- Parameters:
pool (ComponentPool[ComponentT]) – The component pool to add.
- Return type:
None
- add_resource(resource)[source]#
Add a resource to the world.
- Parameters:
resource (Resource) – The resource to add.
- Return type:
None
- get_resource(resource)[source]#
Get a resource.
- Parameters:
resource (type[ResourceT]) – The type of the resource.
- Returns:
The resource.
- Return type:
ResourceT
- get_view(component, indices=None)[source]#
Get a view of some components.
- Parameters:
component (type[ComponentT]) – The component which you want to view.
indices (ArrayViewIndices | None) – The indices specifying which entities in the component pool you want to view.
- Returns:
A component view of your selected entities.
- Return type:
ComponentT