Interface Scene

All Known Implementing Classes:
Demo2D, Demo3D, Effect, OrientationLockScreen, ParticleWipe, PerformanceMonitor, 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
MultimediaLib applications are split into a number of scenes, each representing a discrete phase of the application. Only one scene can be active at the same time, but sub-scenes can be attached to split large or complex scenes into different parts. The currently active scene, and its attached sub-scenes, will receive frame updates for as long as the parent scene is active.
  • 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
    resize(SceneContext context, int canvasWidth, int canvasHeight)
    Called when the canvas size has changed, for example because the window has been resized or because the device orientation has changed.
    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.

    • resize

      default void resize(SceneContext context, int canvasWidth, int canvasHeight)
      Called when the canvas size has changed, for example because the window has been resized or because the device orientation has changed. Note canvasWidth and canvasHeight are based on the current canvas size, which might be different from the "native" screen size.
    • 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.