Class Application

  • All Implemented Interfaces:
    RenderCallback

    public final class Application
    extends java.lang.Object
    implements RenderCallback
    Provides a standard application structure that divides the application into a number of 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.
    • 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()
      • lockScreenOrientation

        public void lockScreenOrientation()
        Restricts the application to landscape orientation. When attempting to use the application in portrait application, the current scene will be suspended and an image will be shown prompting to switch back to landscape orientation.
      • getRenderer

        @Deprecated
        public Renderer getRenderer()
        Deprecated.
        There should be no need for scenes to interact with the renderer directly.
        Returns the renderer that is used by this application.
      • getCanvas

        public Canvas getCanvas()
      • getStage

        public Stage getStage()
      • getApplicationData

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

        public nl.colorize.util.PlatformFamily getPlatform()
      • getDistributionChannel

        public java.lang.String getDistributionChannel()
        Returns the distribution channel that was used to obtain the application. Examples of return values are "App Store", "Download", and "Web".
      • getScreenSize

        public java.lang.String getScreenSize()
        Returns the dimensions of the screen that contain the application window. The return value is in the format widthxheight. If the application is not dislayed fullscreen but in the window, the returned dimensions will be for that window rather than for the entire screen.
      • getAverageFramerate

        public float getAverageFramerate()
      • getAverageFrameTime

        public float getAverageFrameTime()
      • start

        @Deprecated
        public static Application start​(Renderer renderer)
        Deprecated.
        Creates an application and starts it by attaching it to the specified renderer. Note that the application initially starts without an active scene, the initial scene can be played by calling changeScene(Scene).
      • start

        public static void start​(Renderer renderer,
                                 Scene initialScene)
        Creates an application, starts it by attaching it to the specified renderer, and immediately changes the initial scene so that the application starts by playing that scene.