Class SolaEcs

java.lang.Object
technology.sola.ecs.SolaEcs

@NullMarked public class SolaEcs extends Object
SolaEcs is a wrapper for a collection of EcsSystem.
  • Constructor Details

    • SolaEcs

      public SolaEcs()
      Creates an empty SolaEcs.
    • SolaEcs

      public SolaEcs(World initialWorld, EcsSystem... initialSystems)
      Creates a new SolaEcs initialized with a World and EcsSystems.
      Parameters:
      initialWorld - the World to initialize with
      initialSystems - the EcsSystems to initialize with
  • Method Details

    • getWorld

      public World getWorld()
      Returns the World the collection of EcsSystems is currently acting on.
      Returns:
      the World that will be updated
    • setWorld

      public void setWorld(World world)
      Update the World the collection of EcsSystems acts on.
      Parameters:
      world - the World to update
    • updateWorld

      public void updateWorld(float deltaTime)
      Called when the World should be updated. All active EcsSystem.update(technology.sola.ecs.World, float) methods will be called. After these updates any Entity that were queued to be destroyed will be cleaned up.
      Parameters:
      deltaTime - the delta time between updates
    • addSystems

      public void addSystems(EcsSystem... ecsSystems)
      Adds EcsSystems to the collection.
      Parameters:
      ecsSystems - the EcsSystems to add
    • addSystem

      public void addSystem(EcsSystem ecsSystem)
      Adds an EcsSystem to the collection.
      Parameters:
      ecsSystem - the EcsSystem to add
    • removeSystem

      public void removeSystem(EcsSystem ecsSystem)
      Removed an EcsSystem from the collection.
      Parameters:
      ecsSystem - the EcsSystem to remove
    • getSystem

      public <T extends EcsSystem> T getSystem(Class<T> ecsSystemClass)
      Returns the EcsSystem corresponding to the passed class.
      Type Parameters:
      T - the type extending EcsSystem
      Parameters:
      ecsSystemClass - the class for the desired EcsSystem
      Returns:
      the EcsSystem
      Throws:
      EcsSystemNotFoundException - when not found
    • getSystems

      public List<EcsSystem> getSystems()
      Returns:
      a List of the current EcsSystems
    • systemIterator

      public Iterator<EcsSystem> systemIterator()
      Returns:
      an Iterator for the EcsSystems
    • activeSystemIterator

      public Iterator<EcsSystem> activeSystemIterator()
      Returns:
      an Iterator for the EcsSystems that are currently active