Package com.csse3200.game.rendering
Class DebugRenderer
java.lang.Object
com.csse3200.game.rendering.DebugRenderer
Provides functionality to draw lines/shapes to the screen for debug purposes.
-
Constructor Summary
ConstructorDescriptionDebugRenderer
(com.badlogic.gdx.physics.box2d.Box2DDebugRenderer physicsRenderer, com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
drawLine
(com.badlogic.gdx.math.Vector2 from, com.badlogic.gdx.math.Vector2 to) Draw a line between two positionsvoid
drawLine
(com.badlogic.gdx.math.Vector2 from, com.badlogic.gdx.math.Vector2 to, com.badlogic.gdx.graphics.Color color, float lineWidth) Draw a line between two positionsvoid
drawRectangle
(com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 size) Draw a rectanglevoid
drawRectangle
(com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 size, com.badlogic.gdx.graphics.Color color, float lineWidth) Draw a rectangleboolean
void
render
(com.badlogic.gdx.math.Matrix4 projMatrix) void
renderPhysicsWorld
(com.badlogic.gdx.physics.box2d.World physicsWorld) void
setActive
(boolean active)
-
Constructor Details
-
DebugRenderer
public DebugRenderer() -
DebugRenderer
public DebugRenderer(com.badlogic.gdx.physics.box2d.Box2DDebugRenderer physicsRenderer, com.badlogic.gdx.graphics.glutils.ShapeRenderer shapeRenderer)
-
-
Method Details
-
renderPhysicsWorld
public void renderPhysicsWorld(com.badlogic.gdx.physics.box2d.World physicsWorld) -
drawLine
public void drawLine(com.badlogic.gdx.math.Vector2 from, com.badlogic.gdx.math.Vector2 to) Draw a line between two positions- Parameters:
from
- start positionto
- end position
-
drawLine
public void drawLine(com.badlogic.gdx.math.Vector2 from, com.badlogic.gdx.math.Vector2 to, com.badlogic.gdx.graphics.Color color, float lineWidth) Draw a line between two positions- Parameters:
from
- start positionto
- end positioncolor
- line colorlineWidth
- line width
-
drawRectangle
public void drawRectangle(com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 size) Draw a rectangle- Parameters:
pos
- position of bottom left cornersize
- width/height
-
drawRectangle
public void drawRectangle(com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 size, com.badlogic.gdx.graphics.Color color, float lineWidth) Draw a rectangle- Parameters:
pos
- position of bottom left cornersize
- width/heightcolor
- line colorlineWidth
- line width
-
setActive
public void setActive(boolean active) - Parameters:
active
- true to enable debug drawing, false to disable
-
getActive
public boolean getActive() -
render
public void render(com.badlogic.gdx.math.Matrix4 projMatrix)
-