Class DebugDraw
java.lang.Object
org.jbox2d.callbacks.DebugDraw
- Direct Known Subclasses:
DebugDrawJ2D
public abstract class DebugDraw
extends java.lang.Object
Implement this abstract class to allow JBox2d to
automatically draw your physics for debugging purposes.
Not intended to replace your own custom rendering
routines!
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int< draw joint connectionsstatic final int< draw axis aligned bounding boxesstatic final int< draw center of mass framestatic final int< draw shapesstatic final int< draw core (TOI) shapesstatic final intprotected int< draw dynamic tree.protected final IViewportTransform -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendFlags(int flags) voidclearFlags(int flags) abstract voiddrawCircle(Vec2 center, float radius, Color3f color) Draw a circle.abstract voidvoiddrawPolygon(Vec2[] vertices, int vertexCount, Color3f color) Draw a closed polygon provided in CCW order.abstract voiddrawSegment(Vec2 p1, Vec2 p2, Color3f color) Draw a line segment.abstract voiddrawSolidCircle(Vec2 center, float radius, Vec2 axis, Color3f color) Draw a solid circle.abstract voiddrawSolidPolygon(Vec2[] vertices, int vertexCount, Color3f color) Draw a solid closed polygon provided in CCW order.abstract voiddrawString(float x, float y, java.lang.String s, Color3f color) Draw a string.voiddrawString(Vec2 pos, java.lang.String s, Color3f color) abstract voidDraw a transform.intgetFlags()getScreenToWorld(float screenX, float screenY) takes the screen coordinates and returns the world coordinates.getScreenToWorld(Vec2 argScreen) takes the screen coordinates (argScreen) and returns the world coordinatesvoidgetScreenToWorldToOut(float screenX, float screenY, Vec2 argWorld) takes the screen coordinates and puts the corresponding world coordinates in argWorld.voidgetScreenToWorldToOut(Vec2 argScreen, Vec2 argWorld) getWorldToScreen(float worldX, float worldY) Takes the world coordinates and returns the screen coordinates.getWorldToScreen(Vec2 argWorld) takes the world coordinate (argWorld) and returns the screen coordinates.voidgetWorldToScreenToOut(float worldX, float worldY, Vec2 argScreen) Takes the world coordinates and puts the corresponding screen coordinates in argScreen.voidgetWorldToScreenToOut(Vec2 argWorld, Vec2 argScreen) voidsetCamera(float x, float y, float scale) voidsetFlags(int flags) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
e_shapeBit
public static final int e_shapeBit- See Also:
-
e_jointBit
public static final int e_jointBit< draw shapes- See Also:
-
e_aabbBit
public static final int e_aabbBit< draw joint connections- See Also:
-
e_pairBit
public static final int e_pairBit< draw core (TOI) shapes- See Also:
-
e_centerOfMassBit
public static final int e_centerOfMassBit< draw axis aligned bounding boxes- See Also:
-
e_dynamicTreeBit
public static final int e_dynamicTreeBit< draw center of mass frame- See Also:
-
m_drawFlags
protected int m_drawFlags< draw dynamic tree. -
viewportTransform
-
-
Constructor Details
-
DebugDraw
-
-
Method Details
-
setFlags
public void setFlags(int flags) -
getFlags
public int getFlags() -
appendFlags
public void appendFlags(int flags) -
clearFlags
public void clearFlags(int flags) -
drawPolygon
Draw a closed polygon provided in CCW order. This implementation usesdrawSegment(Vec2, Vec2, Color3f)to draw each side of the polygon.- Parameters:
vertices-vertexCount-color-
-
drawPoint
-
drawSolidPolygon
-
drawCircle
-
drawSolidCircle
-
drawSegment
-
drawTransform
Draw a transform. Choose your own length scale- Parameters:
xf-
-
drawString
Draw a string.- Parameters:
x-y-s-color-
-
drawString
-
getViewportTranform
-
setCamera
public void setCamera(float x, float y, float scale) - Parameters:
x-y-scale-- See Also:
-
getScreenToWorldToOut
-
getWorldToScreenToOut
-
getWorldToScreenToOut
Takes the world coordinates and puts the corresponding screen coordinates in argScreen.- Parameters:
worldX-worldY-argScreen-
-
getWorldToScreen
-
getWorldToScreen
Takes the world coordinates and returns the screen coordinates.- Parameters:
worldX-worldY-
-
getScreenToWorldToOut
takes the screen coordinates and puts the corresponding world coordinates in argWorld.- Parameters:
screenX-screenY-argWorld-
-
getScreenToWorld
-
getScreenToWorld
takes the screen coordinates and returns the world coordinates.- Parameters:
screenX-screenY-
-