Interface Renderer
- All Known Implementing Classes:
GDXRenderer
,HeadlessRenderer
,Java2DRenderer
,JFXRenderer
,TeaRenderer
When started, the renderer will create the display system and then start the animation loop. Frame updates will be scheduled to match the targeted framerate. Each frame update consists of executing application logic for the current scene, after which the contents of the stage are rendered.
Application code has little direct interaction with the Renderer
instance, apart from using start(Scene, ErrorHandler)
and
terminate()
to start and stop the animation loop. The application
will then receive a callback from the renderer during every frame update,
for as long as the animation loop is active. These callbacks have access to
the underlying renderer via the SceneContext
. This explains why
renderer capabilities such as graphics and input devices cannot be accessed
directly from the Renderer
instance, since they should only be
When it comes to display mode and screen resolution, the renderer has two
different concepts: the screen and the "canvas". The former refers to the
resolution at which the graphics are displayed, the latter refers
to the resolution at which the graphics are rendered. This allows
applications to support multiple resolutions that may be different from the
native screen resolution. The canvas is accessible to the application during
frame updates, via the aforementioned SceneContext
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
start
(Scene initialScene, ErrorHandler errorHandler) Initializes this renderer and starts playing the requested scene.void
Ends the animation loop, stops this renderer, and quits the application.
-
Method Details
-
start
Initializes this renderer and starts playing the requested scene. Errors that occur during the application will be forwarded to the specified error handler.As explained in the class documentation, this is the only method in
Renderer
that can be safely called from outside the renderer's application loop.- Throws:
IllegalStateException
- when calling this method even though the renderer has already been started.
-
terminate
void terminate()Ends the animation loop, stops this renderer, and quits the application.Renderer
instances cannot be reused, restarting a previously terminated renderer is not possible.- Throws:
UnsupportedOperationException
- if this renderer does not support termination, for if the underlying platform does not support explicitly terminating applications.
-
getGraphicsMode
GraphicsMode getGraphicsMode() -
getDisplayMode
DisplayMode getDisplayMode()
-