Package nl.colorize.multimedialib.scene
Class Application
- java.lang.Object
-
- nl.colorize.multimedialib.scene.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 Summary
Constructors Constructor Description Application(Renderer renderer)
-
Method Summary
All 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)floatgetAverageFPS()floatgetAverageFrameTime()CanvasgetCanvas()InputDevicegetInputDevice()InternetAccessgetInternetAccess()MediaLoadergetMediaLoader()RenderergetRenderer()Deprecated.The purpose of this class is to wrap the renderer, so scenes should not access it directly.ImageloadImage(FilePointer file)Convenience method that returns the image located in the specified file.voidrender(GraphicsContext graphics)voidupdate(float deltaTime)Updates this object for the current frame.
-
-
-
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:UpdatableUpdates this object for the current frame.
-
render
public void render(GraphicsContext graphics)
- Specified by:
renderin interfaceRenderable
-
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()
-
getInputDevice
public InputDevice getInputDevice()
-
getMediaLoader
public MediaLoader getMediaLoader()
-
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)
-
getInternetAccess
public InternetAccess getInternetAccess()
-
getAverageFPS
public float getAverageFPS()
-
getAverageFrameTime
public float getAverageFrameTime()
-
-