Interface Scene

All Known Implementing Classes:
Demo2D, Demo3D, DemoIsometric, Effect, OrientationLockScreen, ParticleWipe, PerformanceMonitor, SplashScreen, SwipeTracker
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Scene
Applications are split into *scenes*. Simple applications may consist of a single scene, but larger applications can be split into multiple scenes, each representing a discrete phase of the application.

Only one scene can be active at the same time, but it is possible to attach sub-scenes to the currently active scene. These sub-scenes can contain their own logic, but cannot outlive their parent scene. When the active scene is changed, both the scene itself and its sub-scenes will be terminated and the stage will be cleared in preparation for the next scene.

The currently active scene (and its sub-scenes) receive access to the SceneContext, which is provided by the renderer via callback methods.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    end(SceneContext context)
    Clean-up logic that is performed every time the scene ends.
    default boolean
    Indicates the scene has been completed and no longer wishes to receive frame updates.
    default void
    Initialization logic that should be performed when the scene is started.
    void
    update(SceneContext context, float deltaTime)
    Called during every frame update for as long as the scene is active.
  • Method Details

    • start

      default void start(SceneContext context)
      Initialization logic that should be performed when the scene is started. Note that this method is called *every* time the scene is started, not just the first time.

      This method is optional, the default implementation does nothing.

    • update

      void update(SceneContext context, float deltaTime)
      Called during every frame update for as long as the scene is active. deltaTime indicates the elapsed time since the last frame, in seconds.
    • end

      default void end(SceneContext context)
      Clean-up logic that is performed every time the scene ends.

      This method is optional, the default implementation does nothing.

    • isCompleted

      default boolean isCompleted()
      Indicates the scene has been completed and no longer wishes to receive frame updates.

      If this scene is the currently active scene, it might not actually end until a new scene is requested.

      If this scene is a completed sub-scene, meaning there is a parent scene which is still active, this sub-scene will end after the current frame.