Class Application

  • All Implemented Interfaces:
    Renderable, Updatable

    public class Application
    extends java.lang.Object
    implements Updatable, Renderable
    Implements a mechanism on top of the renderer that divides the application life cycle into a number of separate scenes. One scene is marked as currently active, and will receive frame updates and render graphics for as a long as it is active. Scenes will also receive notifications whenever the active scene changes.
    • Constructor Detail

      • Application

        public Application​(Renderer renderer)
    • Method Detail

      • changeScene

        public void changeScene​(Scene requestedScene)
        Requests to change the active scene after the current frame has been completed.
        Throws:
        java.lang.IllegalStateException - if a different scene has already been requested, but that scene has not yet started.
      • getActiveScene

        public Scene getActiveScene()
      • update

        public void update​(float deltaTime)
        Description copied from interface: Updatable
        Updates this object for the current frame.
        Specified by:
        update in interface Updatable
        Parameters:
        deltaTime - Elapsed time since the last frame, in seconds.
      • getRenderer

        @Deprecated
        public Renderer getRenderer()
        Deprecated.
        The purpose of this class is to wrap the renderer, so scenes should not access it directly. When needing to access one of the renderer's fields, use one of the more specific methods provided by this class instead.
        Returns the renderer that is used by this application.
      • getCanvas

        public Canvas getCanvas()
      • loadImage

        public Image loadImage​(FilePointer file)
        Convenience method that returns the image located in the specified file. If this is the first time the image is requested, it is loaded. If the image was loaded before, it is retrieved from the cache.
      • getApplicationData

        public ApplicationData getApplicationData​(java.lang.String appName)
      • getAverageFPS

        public float getAverageFPS()
      • getAverageFrameTime

        public float getAverageFrameTime()