Class DebugDraw

java.lang.Object
org.jbox2d.callbacks.DebugDraw
Direct Known Subclasses:
DebugDrawJ2D

public abstract class DebugDraw extends 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!
Author:
Daniel Murphy
  • Field Details

    • shapeBit

      public static final int shapeBit
      Draw shapes
      See Also:
    • jointBit

      public static final int jointBit
      Draw joint connections
      See Also:
    • aabbBit

      public static final int aabbBit
      Draw axis aligned bounding boxes
      See Also:
    • pairBit

      public static final int pairBit
      Draw pairs of connected objects
      See Also:
    • centerOfMassBit

      public static final int centerOfMassBit
      Draw center of mass frame
      See Also:
    • dynamicTreeBit

      public static final int dynamicTreeBit
      Draw dynamic tree
      See Also:
    • wireframeDrawingBit

      public static final int wireframeDrawingBit
      Draw only the wireframe for drawing performance
      See Also:
    • drawFlags

      protected int drawFlags
    • viewportTransform

      protected IViewportTransform viewportTransform
  • Constructor Details

  • Method Details

    • setViewportTransform

      public void setViewportTransform(IViewportTransform viewportTransform)
    • setFlags

      public void setFlags(int flags)
    • getFlags

      public int getFlags()
    • appendFlags

      public void appendFlags(int flags)
    • clearFlags

      public void clearFlags(int flags)
    • drawPolygon

      public void drawPolygon(Vec2[] vertices, int vertexCount, Color3f color)
      Draw a closed polygon provided in CCW order. This implementation uses drawSegment(Vec2, Vec2, Color3f) to draw each side of the polygon.
    • drawPoint

      public abstract void drawPoint(Vec2 argPoint, float argRadiusOnScreen, Color3f argColor)
    • drawSolidPolygon

      public abstract void drawSolidPolygon(Vec2[] vertices, int vertexCount, Color3f color)
      Draw a solid closed polygon provided in CCW order.
    • drawCircle

      public abstract void drawCircle(Vec2 center, float radius, Color3f color)
      Draw a circle.
    • drawCircle

      public void drawCircle(Vec2 center, float radius, Vec2 axis, Color3f color)
      Draws a circle with an axis
    • drawSolidCircle

      public abstract void drawSolidCircle(Vec2 center, float radius, Vec2 axis, Color3f color)
      Draw a solid circle.
    • drawSegment

      public abstract void drawSegment(Vec2 p1, Vec2 p2, Color3f color)
      Draw a line segment.
    • drawTransform

      public abstract void drawTransform(Transform xf)
      Draw a transform. Choose your own length scale
    • drawString

      public abstract void drawString(float x, float y, String s, Color3f color)
      Draw a string.
    • drawParticles

      public abstract void drawParticles(Vec2[] centers, float radius, ParticleColor[] colors, int count)
      Draw a particle array
      Parameters:
      colors - Can be null
    • drawParticlesWireframe

      public abstract void drawParticlesWireframe(Vec2[] centers, float radius, ParticleColor[] colors, int count)
      Draw a particle array
      Parameters:
      colors - Can be null
    • flush

      public void flush()
      Called at the end of drawing a world
    • drawString

      public void drawString(Vec2 pos, String s, Color3f color)
    • getViewportTransform

      public IViewportTransform getViewportTransform()
    • setCamera

      public void setCamera(float x, float y, float scale)
      Deprecated.
      use the viewport transform in getViewportTransform()
    • getScreenToWorldToOut

      public void getScreenToWorldToOut(Vec2 argScreen, Vec2 argWorld)
    • getWorldToScreenToOut

      public void getWorldToScreenToOut(Vec2 argWorld, Vec2 argScreen)
    • getWorldToScreenToOut

      public void getWorldToScreenToOut(float worldX, float worldY, Vec2 argScreen)
      Takes the world coordinates and puts the corresponding screen coordinates in argScreen.
    • getWorldToScreen

      public Vec2 getWorldToScreen(Vec2 argWorld)
      takes the world coordinate (argWorld) and returns the screen coordinates.
    • getWorldToScreen

      public Vec2 getWorldToScreen(float worldX, float worldY)
      Takes the world coordinates and returns the screen coordinates.
    • getScreenToWorldToOut

      public void getScreenToWorldToOut(float screenX, float screenY, Vec2 argWorld)
      takes the screen coordinates and puts the corresponding world coordinates in argWorld.
    • getScreenToWorld

      public Vec2 getScreenToWorld(Vec2 argScreen)
      takes the screen coordinates (argScreen) and returns the world coordinates
    • getScreenToWorld

      public Vec2 getScreenToWorld(float screenX, float screenY)
      takes the screen coordinates and returns the world coordinates.