xecs.RealTimeApp#

class xecs.RealTimeApp(num_entities)[source]#

Bases: object

An app which runs in real time.

Parameters:

num_entities (int) – The maximum number of entities which can be spawned.

Methods

add_plugin

Add a plugin.

add_pool

Add a preallocated pool of components.

add_resource

Add a resource.

add_startup_system

Add a startup system.

add_system

Add a system.

run

Run the app continuously.

update

Run the app for a single step.

add_plugin(plugin)[source]#

Add a plugin.

Parameters:

plugin (RealTimeAppPlugin) – The plugin.

Return type:

None

add_pool(pool)[source]#

Add a preallocated pool of components.

The pool will be used to hold any components which are spawned during runtime.

Parameters:

pool (ComponentPool[ComponentT]) – The component pool.

Return type:

None

add_resource(resource)[source]#

Add a resource.

Parameters:

resource (Resource) – The resource.

Return type:

None

add_startup_system(system)[source]#

Add a startup system.

Parameters:

system (Callable[[...], Any]) – The startup system.

Return type:

None

add_system(system, run_condition=None)[source]#

Add a system.

Parameters:
  • system (Callable[[...], Any]) – The system.

  • run_condition (Duration | None) – The time step between runs of the system. If None the system will run every frame.

Return type:

None

run(frame_time=Duration.from_nanos(int(1e9 / 60)), max_run_time=None)[source]#

Run the app continuously.

Parameters:
  • frame_time (Duration) – The time between frames.

  • max_run_time (Duration | None) – The maximum time to run the app for.

Return type:

None

update()[source]#

Run the app for a single step.

Return type:

None