Class World

java.lang.Object
dev.prozilla.pine.core.scene.World
All Implemented Interfaces:
Destructible, Initializable, InputHandler, Renderable, Updatable

public class World extends Object implements Initializable, InputHandler, Updatable, Renderable, Destructible
An isolated collection of entities, components and systems that live inside a scene.
  • Field Details

  • Constructor Details

  • Method Details

    • initSystems

      public void initSystems()
      Initializes all systems in this world.
    • useStandardSystems

      public void useStandardSystems()
      Adds all standard systems to the list of initial systems.
    • init

      public void init() throws IllegalStateException
      Executes all initialization systems in this world.
      Specified by:
      init in interface Initializable
      Throws:
      IllegalStateException
    • input

      public void input(float deltaTime)
      Executes all input systems in this world.
      Specified by:
      input in interface InputHandler
      Parameters:
      deltaTime - Delta time in seconds
    • update

      public void update(float deltaTime)
      Executes all update systems in this world.
      Specified by:
      update in interface Updatable
      Parameters:
      deltaTime - Delta time in seconds
    • render

      public void render(Renderer renderer)
      Executes all render systems in this world.
      Specified by:
      render in interface Renderable
    • destroy

      public void destroy()
      Description copied from interface: Destructible
      Destroys this object.
      Specified by:
      destroy in interface Destructible
    • addEntity

      public Entity addEntity(Prefab prefab)
      Instantiates a prefab into this world at (0, 0).
      Parameters:
      prefab - The prefab to instantiate
      Returns:
      The instantiated entity
    • addEntity

      public Entity addEntity(Prefab prefab, float x, float y)
      Instantiates a prefab into this world.
      Parameters:
      prefab - The prefab to instantiate
      x - X position
      y - Y position
      Returns:
      The instantiated entity
    • addEntity

      public Entity addEntity(Entity entity)
      Adds an entity into this world.
      Parameters:
      entity - The entity to add
      Returns:
      The added entity
    • removeEntity

      public void removeEntity(Entity entity)
    • activateEntity

      public void activateEntity(Entity entity)
    • addComponent

      public Component addComponent(Entity entity, Component component)
      Adds a component to an entity in this world.
      Parameters:
      entity - The entity
      component - The component to add to the entity
      Returns:
      The added component
    • removeComponent

      public void removeComponent(Entity entity, Component component)
      Removes a component from an entity in this world.
      Parameters:
      entity - The entity
      component - The component to remove from the entity
    • addSystem

      public <S extends SystemBuilder<? extends SystemBase, S>> SystemBase addSystem(S systemBuilder)
      Builds a system and adds it to this world.
      Type Parameters:
      S - Type of the system builder
      Parameters:
      systemBuilder - Builder of the system
      Returns:
      System that was built and added
    • addSystem

      public SystemBase addSystem(SystemBase system)
      Adds a system to this world.
      Parameters:
      system - The system to add
      Returns:
      The added system
    • calculateDepth

      public void calculateDepth()
    • isActive

      public boolean isActive()