Package nl.colorize.multimedialib.scene
Class Application
- java.lang.Object
-
- nl.colorize.multimedialib.scene.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidchangeScene(Scene requestedScene)Requests to change the active scene after the current frame has been completed.ScenegetActiveScene()ApplicationDatagetApplicationData(java.lang.String appName)floatgetAverageFramerate()floatgetAverageFrameTime()CanvasgetCanvas()java.lang.StringgetDistributionChannel()Returns the distribution channel that was used to obtain the application.InputDevicegetInputDevice()InternetAccessgetInternetAccess()MediaManagergetMedia()MediaLoadergetMediaLoader()nl.colorize.util.PlatformFamilygetPlatform()RenderergetRenderer()Deprecated.There should be no need for scenes to interact with the renderer directly.java.lang.StringgetScreenSize()Returns the dimensions of the screen that contain the application window.StagegetStage()voidlockScreenOrientation()Restricts the application to landscape orientation.voidrender(Renderer renderer, GraphicsContext2D graphics)static Applicationstart(Renderer renderer)Deprecated.Usestart(Renderer, Scene)instead.static voidstart(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.voidupdate(Renderer renderer, float deltaTime)
-
-
-
Method Detail
-
update
public void update(Renderer renderer, float deltaTime)
- Specified by:
updatein interfaceRenderCallback
-
render
public void render(Renderer renderer, GraphicsContext2D graphics)
- Specified by:
renderin interfaceRenderCallback
-
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()
-
getInputDevice
public InputDevice getInputDevice()
-
getMediaLoader
public MediaLoader getMediaLoader()
-
getMedia
public MediaManager getMedia()
-
getApplicationData
public ApplicationData getApplicationData(java.lang.String appName)
-
getInternetAccess
public InternetAccess getInternetAccess()
-
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 formatwidthxheight. 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.Usestart(Renderer, Scene)instead.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 callingchangeScene(Scene).
-
-