Class Stage

java.lang.Object
nl.colorize.multimedialib.stage.Stage
All Implemented Interfaces:
Updatable

public class Stage extends Object implements Updatable
The stage contains all graphics that are part of the current scene. Depending on the renderer and current platform, the stage can contain 2D and/or 3D graphics. The stage is structured as a scene graph, and can be traversed using a StageVisitor. This is used by the renderer at the end of each frame update, so the stage can be rendered.

While the scene has full control over the stage, this control cannot outlive the scene itself: at the end of the scene the contents of the stage are cleared so the next scene can take over.

  • Constructor Details

  • Method Details

    • update

      public void update(float deltaTime)
      Description copied from interface: Updatable
      Updates this object for the current frame. deltaTime indicates the elapsed time since the last frame update, in seconds.
      Specified by:
      update in interface Updatable
    • addContainer

      public Container addContainer()
      Creates a new container, then adds it to the root of the scene graph. Returns the container that was just created. This is a convenience method to easily create top-level containers.
    • addContainer

      public Container addContainer(String name)
      Creates a new container with the specified name, then adds it to the root of the scene graph. Returns the container that was just created. This is a convenience method to easily create top-level containers.
    • visit

      public void visit(StageVisitor visitor)
      Visits all graphics currently on the stage, in the order in which they should be drawn. This method is called by the renderer following each frame update.
    • clear

      public void clear()
      Removes all 2D and 3D graphics from the stage. This is always called at the end of a scene, but can also be used manually mid-scene.
    • toString

      public String toString()
      Returns a textual representation of the stage's current contents, which can be used for testing and debugging purposes.
      Overrides:
      toString in class Object
    • getCanvas

      public Canvas getCanvas()
    • getFrameStats

      public FrameStats getFrameStats()
    • getRoot

      public Container getRoot()
    • getWorld

      public World3D getWorld()
    • getBackgroundColor

      public ColorRGB getBackgroundColor()
    • setBackgroundColor

      public void setBackgroundColor(ColorRGB backgroundColor)