Class HeadlessRenderer

  • All Implemented Interfaces:
    Renderer

    public class HeadlessRenderer
    extends Java2DRenderer
    Headless implementation of a Java2DRenderer. This is primarily intended for testing purposes in environments where graphics are not available. Graphics are displayed on an image instead.
    • Constructor Detail

      • HeadlessRenderer

        public HeadlessRenderer​(Canvas canvas,
                                int framerate,
                                WindowOptions windowOptions)
    • Method Detail

      • prepareWindowBuffer

        protected java.awt.image.BufferStrategy prepareWindowBuffer()
        Description copied from class: Java2DRenderer
        Prepares the window buffer for the current frame. This buffer will be used to display the graphics once the entire frame has been rendered.
        Overrides:
        prepareWindowBuffer in class Java2DRenderer
      • blitGraphicsContext

        protected void blitGraphicsContext​(java.awt.image.BufferStrategy windowBuffer)
        Description copied from class: Java2DRenderer
        Updates the window graphics with the contents of the buffer.
        Overrides:
        blitGraphicsContext in class Java2DRenderer
      • getImage

        public java.awt.image.BufferedImage getImage()
      • saveScreenshot

        public void saveScreenshot​(java.io.File dest)