Class JFXRenderer

java.lang.Object
nl.colorize.multimedialib.renderer.jfx.JFXRenderer
All Implemented Interfaces:
Renderer

public class JFXRenderer extends Object implements Renderer
Renderer based on OpenJFX, which was previously known as JavaFX. Note that JavaFX is only used for the animation loop, graphics, and input. Other renderer capabilities are identical to the Java2D renderer, since both are based on the Java standard library.
  • Method Details

    • start

      public void start(Scene initialScene, ErrorHandler errorHandler)
      Description copied from interface: Renderer
      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.

      Specified by:
      start in interface Renderer
    • terminate

      public void terminate()
      Description copied from interface: Renderer
      Ends the animation loop, stops this renderer, and quits the application. Renderer instances cannot be reused, restarting a previously terminated renderer is not possible.
      Specified by:
      terminate in interface Renderer
    • getDisplayMode

      public DisplayMode getDisplayMode()
      Specified by:
      getDisplayMode in interface Renderer
    • getGraphicsMode

      public GraphicsMode getGraphicsMode()
      Specified by:
      getGraphicsMode in interface Renderer
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • launch

      public static JFXRenderer launch(DisplayMode displayMode, WindowOptions windowOptions)
      Launches the JavaFX renderer. Note that JavaFX does not support multiple instances of the renderer to be active simultaneously.
      Throws:
      IllegalStateException - if this method is called at a moment when another JFXRenderer instance is already active.
    • accessInstance

      protected static JFXRenderer accessInstance()
      Returns the single currently active JFXRenderer instance. This method is used to access the renderer from the JavaFX application thread.
      Throws:
      IllegalStateException - when trying to call this method before the renderer has been initialized.
    • getWindowOptions

      public WindowOptions getWindowOptions()
    • getGraphics

      public JFXGraphics getGraphics()
    • getInput

      public JFXInput getInput()
    • getMediaLoader

      public JFXMediaLoader getMediaLoader()
    • getNetwork

      public Network getNetwork()
    • getContext

      public SceneContext getContext()
    • getErrorHandler

      public ErrorHandler getErrorHandler()