Class Renderer

java.lang.Object
com.deco2800.game.rendering.Renderer
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public class Renderer extends Object implements com.badlogic.gdx.utils.Disposable
Core rendering system for the game. Controls the game's camera and runs rendering on all renderables each frame.
  • Constructor Details

    • Renderer

      public Renderer(CameraComponent camera)
      Create a new renderer with default settings
      Parameters:
      camera - camera to render to
    • Renderer

      public Renderer(CameraComponent camera, float gameWidth, com.badlogic.gdx.graphics.g2d.SpriteBatch batch, com.badlogic.gdx.scenes.scene2d.Stage stage, RenderService renderService, DebugRenderer debugRenderer)
      Create a renderer
      Parameters:
      camera - Camera to use for rendering.
      gameWidth - Desired game width in metres the screen should show. Height is then based on * the aspect ratio.
      batch - Batch to render to.
      stage - Scene2D stage for UI rendering
      renderService - Render service to use
      debugRenderer - Debug renderer to render
  • Method Details

    • getCamera

      public CameraComponent getCamera()
    • render

      public void render()
      Render everything to the render service.
    • resize

      public void resize(int width, int height)
      Resize the renderer to a new screen size.
      Parameters:
      width - new screen width
      height - new screen height
    • getDebug

      public DebugRenderer getDebug()
      Returns:
      The debug renderer attached to this renderer
    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
    • getStage

      public com.badlogic.gdx.scenes.scene2d.Stage getStage()