Class RenderConfig
main method. Application code will not directly
interact with the renderer. The renderer runs in a separate thread, and
will invoke callback methods that receive the SceneContext to
interact with the underlying renderer.
The renderer configuration consists of the following aspects:
Renderer: MultimediaLib supports multiple renderer implementations. Applications can select a renderer implementation based on the target platform(s) and whether the application uses 2D or 3D graphics.
Canvas: Defines how the renderer should display graphics
for the current screen size and resolution. See Canvas for more
information.
Framerate: The renderer will attempt to perform frame updates as close as possible to the target framerate.
Window: Defines how the application window should be
displayed on desktop platforms. See WindowOptions for more
information.
Error handler: The default error handler will log the error and then terminate the renderer. Additional error handlers can be added in order to customize this behavior.
Global handlers: The configuration can define "global"
handlers that are always active, independent of the currently active
scene. Global handlers can also be registered at runtime, using
SceneContext.attachGlobal(Scene).
Simulation mode: During development, the launcher can
"simulate" the behavior of mobile platforms when running on desktop
platforms. This is comparable to "responsive design mode" in desktop
browsers. Simulation mode can be activated programmatically, but it can
also be enabled using the system property multimedialib.simulation.
-
Method Summary
Modifier and TypeMethodDescriptionstatic RenderConfigforBrowser(String renderer, GraphicsMode graphicsMode, Canvas canvas) Starts configuring the browser-based renderer with the specified name and graphics mode.static RenderConfigforDesktop(String renderer, GraphicsMode graphicsMode, Canvas canvas) Starts configuring the desktop platform renderer with the specified name and graphics mode.intstatic RenderConfigheadless(GraphicsMode graphicsMode, Canvas canvas) Starts configuring a headless renderer that will simulate the requested graphics mode.booleanvoidsetErrorHandler(ErrorHandler errorHandler) voidsetFramerate(int framerate) voidsetSimulationMode(String simulationMode) voidUses this configuration to start the renderer, initially displaying the provided scene.
-
Method Details
-
isSimulationMode
public boolean isSimulationMode() -
start
Uses this configuration to start the renderer, initially displaying the provided scene. Once the renderer has been started, this configuration will be available to the scene at runtime via theSceneContext.- Throws:
UnsupportedOperationException- if the renderer does not support the graphics mode defined in this configuration.
-
forDesktop
Starts configuring the desktop platform renderer with the specified name and graphics mode.- Throws:
IllegalStateException- if the current platform is not a desktop platform.IllegalArgumentException- if no desktop renderer with the requested name exists.UnsupportedOperationException- if the requested renderer does not support the requested graphics mode.
-
forBrowser
Starts configuring the browser-based renderer with the specified name and graphics mode.- Throws:
IllegalStateException- if the current platform is not browser-based.IllegalArgumentException- if no browser-based renderer with the requested name exists.UnsupportedOperationException- if the requested renderer does not support the requested graphics mode.
-
headless
Starts configuring a headless renderer that will simulate the requested graphics mode. -
getLauncher
-
getGraphicsMode
-
getCanvas
-
getFramerate
public int getFramerate() -
getWindowOptions
-
getErrorHandler
-
getGlobalHandlers
-
getSimulationMode
-
setFramerate
public void setFramerate(int framerate) -
setErrorHandler
-
setSimulationMode
-