Class CameraRenderer

java.lang.Object
org.collebol.client.gui.graphics.renderer.Renderer
org.collebol.client.gui.graphics.renderer.CameraRenderer

public class CameraRenderer extends Renderer
Render objects within the canvas of the camera. Change the position of the camera and the view will change.
Since:
1.0-dev
Author:
ColleBol - contact@collebol.org
  • Constructor Details

    • CameraRenderer

      public CameraRenderer(EJGEngine e)
  • Method Details

    • renderObjects

      public void renderObjects(List<GameObject> gameObjects)
      Render GameObjects relative to the Camera.
      Parameters:
      gameObjects -
    • renderBatchObjects

      public void renderBatchObjects(Map<Integer,List<GameObject>> gameObjects)
      Render a Map with a List of GameObjects as Batch. This will improve performance a lot.
      Parameters:
      gameObjects -
      See Also:
    • renderObject

      public void renderObject(GameObject gameObject)
      Render a GameObject relative to the Camera.
      Parameters:
      gameObject -
    • renderText

      public void renderText(CameraRenderer.TextBuilder textBuilder)
      Render text relative to the camera.
      Parameters:
      textBuilder -
    • renderLight

      public void renderLight(int id, GameLocation location, float radius, float[] color)
      Render light relative to the camera.
      Parameters:
      location - the game location of the light
      radius - radius of the light (how big)
      color - the color of the light, example: new float[]{ 1.0f, 1.0f, 1.0f, 1.0f }
    • showOriginPoint

      public void showOriginPoint()
      Renders the origin point of the camera on the screen.

      This method uses OpenGL to draw a red point at the camera's origin and a circle around it.

    • showCoordinates

      public void showCoordinates()
      Displays various coordinates and camera information on the screen.

      This method retrieves the current camera and mouse positions, and renders text on the screen showing the mouse game location, camera-origin game location, mouse panel position, camera-origin panel position, camera zoom level, and camera rotation.

    • showGridLines

      public void showGridLines()
      Renders grid lines on the screen based on the camera's position and zoom level.

      This method calculates the starting positions for the grid lines based on the camera's offset and origin. It then uses OpenGL to draw yellow grid lines across the screen and blue diagonal lines forming a square.