Class Scene

All Implemented Interfaces:
Behavior, Renderable, Closeable, AutoCloseable
Direct Known Subclasses:
BlankScene

public abstract class Scene extends Entity2DContainer
The Scene class represents a scene in a 2D environment. It can contain various systems and properties for managing an application state.
  • Constructor Details

    • Scene

      public Scene(Application application)
      Constructs a new Scene with the given application.
      Parameters:
      application - The application that the scene belongs to.
  • Method Details

    • onUpdate

      public void onUpdate(ContextTime time)
      Description copied from interface: Behavior
      This method is called when the behavior needs to be updated with the current time. It is typically used to perform any necessary calculations or updates based on the current time.
      Specified by:
      onUpdate in interface Behavior
      Overrides:
      onUpdate in class Entity2DContainer
      Parameters:
      time - The current time context.
    • system

      public <T extends SystemBehavior> T system(Class<T> systemType, int index)
      Returns a specific SystemBehavior object from the scene.
      Type Parameters:
      T - The type of the SystemBehavior object.
      Parameters:
      systemType - The class of the SystemBehavior object to retrieve.
      index - The index of the SystemBehavior object to retrieve.
      Returns:
      The specified SystemBehavior object, or null if not found.
    • system

      public <T extends SystemBehavior> T system(Class<T> systemType)
      Returns the first found SystemBehavior object from the scene.
      Type Parameters:
      T - The type of the SystemBehavior object.
      Parameters:
      systemType - The class of the SystemBehavior object to retrieve.
      Returns:
      The specified SystemBehavior object, or null if not found.
    • backGroundColor

      public Color backGroundColor()
      Returns the background color of the scene.
      Returns:
      The background color of the scene.
    • setBackGroundColor

      public Scene setBackGroundColor(Color backGroundColor)
      Sets the background color of the scene.
      Parameters:
      backGroundColor - The new background color for the scene.
      Returns:
      This Scene instance for method chaining.
    • systems

      public Set<SystemBehavior> systems()
    • setSystems

      public Scene setSystems(Set<SystemBehavior> systems)
      Sets the SystemBehavior objects in the scene.
      Parameters:
      systems - The new set of SystemBehavior objects for the scene.
      Returns:
      This Scene instance for method chaining.
    • camera

      public Transform2D camera()
      Retrieves the camera transform of the scene.
      Returns:
      The camera transform of the scene.