Package com.deco2800.game.utils
Class RenderUtil
java.lang.Object
com.deco2800.game.utils.RenderUtil
Graphic utilities to help with rendering
-
Method Summary
Modifier and TypeMethodDescriptionUses EntityService to fetch the "camera" entity from which the camera component can then be located.static RenderUtil
float
Calculates and returns the pixels per unit requiredint
Utility to get screen heightvoid
renderInPixels
(com.badlogic.gdx.graphics.g2d.Batch batch, Runnable runnable) Temporarily swaps your projection to allow rendering in pixels.
-
Method Details
-
renderInPixels
Temporarily swaps your projection to allow rendering in pixels. This expects a callback function- Parameters:
batch
- the batch to draw ontorunnable
- a callback method that includes draw calls
-
getScreenHeight
public int getScreenHeight()Utility to get screen height- Returns:
- the screen height in pixels
-
getCameraComponent
Uses EntityService to fetch the "camera" entity from which the camera component can then be located.- Returns:
- the located camera component
-
getPixelsPerUnit
public float getPixelsPerUnit()Calculates and returns the pixels per unit required- Returns:
- pixels per unit
-
getInstance
-