# Class DebugDraw

java.lang.Object
com.codename1.gaming.physics.box2d.callbacks.DebugDraw

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!

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `e_aabbBit`
  < draw joint connections
  `static final int`
  `e_centerOfMassBit`
  < draw axis aligned bounding boxes
  `static final int`
  `e_dynamicTreeBit`
  < draw center of mass frame
  `static final int`
  `e_jointBit`
  < draw shapes
  `static final int`
  `e_pairBit`
  < draw core (TOI) shapes
  `static final int`
  `e_shapeBit`
  `protected int`
  `m_drawFlags`
  < draw dynamic tree.
  `protected final IViewportTransform`
  `viewportTransform`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DebugDraw(IViewportTransform viewport)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `appendFlags(int flags)`
  `void`
  `clearFlags(int flags)`
  `abstract void`
  `drawCircle(Vec2 center, float radius, Color3f color)`
  Draw a circle.
  `abstract void`
  `drawPoint(Vec2 argPoint, float argRadiusOnScreen, Color3f argColor)`
  `void`
  `drawPolygon(Vec2[] vertices, int vertexCount, Color3f color)`
  Draw a closed polygon provided in CCW order.
  `abstract void`
  `drawSegment(Vec2 p1, Vec2 p2, Color3f color)`
  Draw a line segment.
  `abstract void`
  `drawSolidCircle(Vec2 center, float radius, Vec2 axis, Color3f color)`
  Draw a solid circle.
  `abstract void`
  `drawSolidPolygon(Vec2[] vertices, int vertexCount, Color3f color)`
  Draw a solid closed polygon provided in CCW order.
  `abstract void`
  `drawString(float x, float y, String s, Color3f color)`
  Draw a string.
  `void`
  `drawString(Vec2 pos, String s, Color3f color)`
  `abstract void`
  `drawTransform(Transform xf)`
  Draw a transform.
  `int`
  `getFlags()`
  `Vec2`
  `getScreenToWorld(float screenX, float screenY)`
  takes the screen coordinates and returns the world coordinates.
  `Vec2`
  `getScreenToWorld(Vec2 argScreen)`
  takes the screen coordinates (argScreen) and returns the world coordinates
  `void`
  `getScreenToWorldToOut(float screenX, float screenY, Vec2 argWorld)`
  takes the screen coordinates and puts the corresponding world coordinates in argWorld.
  `void`
  `getScreenToWorldToOut(Vec2 argScreen, Vec2 argWorld)`
  `IViewportTransform`
  `getViewportTranform()`
  `Vec2`
  `getWorldToScreen(float worldX, float worldY)`
  Takes the world coordinates and returns the screen coordinates.
  `Vec2`
  `getWorldToScreen(Vec2 argWorld)`
  takes the world coordinate (argWorld) and returns the screen coordinates.
  `void`
  `getWorldToScreenToOut(float worldX, float worldY, Vec2 argScreen)`
  Takes the world coordinates and puts the corresponding screen coordinates in argScreen.
  `void`
  `getWorldToScreenToOut(Vec2 argWorld, Vec2 argScreen)`
  `void`
  `setCamera(float x, float y, float scale)`
  `void`
  `setFlags(int flags)`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### e_shapeBit

    public static final int e_shapeBit
    See Also:
      - Constant Field Values

  - ### e_jointBit

    public static final int e_jointBit
    < draw shapes
    See Also:
      - Constant Field Values

  - ### e_aabbBit

    public static final int e_aabbBit
    < draw joint connections
    See Also:
      - Constant Field Values

  - ### e_pairBit

    public static final int e_pairBit
    < draw core (TOI) shapes
    See Also:
      - Constant Field Values

  - ### e_centerOfMassBit

    public static final int e_centerOfMassBit
    < draw axis aligned bounding boxes
    See Also:
      - Constant Field Values

  - ### e_dynamicTreeBit

    public static final int e_dynamicTreeBit
    < draw center of mass frame
    See Also:
      - Constant Field Values

  - ### m_drawFlags

    protected int m_drawFlags
    < draw dynamic tree.

  - ### viewportTransform

    protected final IViewportTransform viewportTransform

- ## Constructor Details

  - ### DebugDraw

    public DebugDraw(IViewportTransform viewport)

- ## 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

    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.
    Parameters:
      `vertices` -
      `vertexCount` -
      `color` -

  - ### 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.
    Parameters:
      `vertices` -
      `vertexCount` -
      `color` -

  - ### drawCircle

    public abstract void drawCircle(Vec2 center, float radius, Color3f color)
    Draw a circle.
    Parameters:
      `center` -
      `radius` -
      `color` -

  - ### drawSolidCircle

    public abstract void drawSolidCircle(Vec2 center, float radius, Vec2 axis, Color3f color)
    Draw a solid circle.
    Parameters:
      `center` -
      `radius` -
      `axis` -
      `color` -

  - ### drawSegment

    public abstract void drawSegment(Vec2 p1, Vec2 p2, Color3f color)
    Draw a line segment.
    Parameters:
      `p1` -
      `p2` -
      `color` -

  - ### drawTransform

    public abstract void drawTransform(Transform xf)
    Draw a transform. Choose your own length scale
    Parameters:
      `xf` -

  - ### drawString

    public abstract void drawString(float x, float y, String s, Color3f color)
    Draw a string.
    Parameters:
      `x` -
      `y` -
      `s` -
      `color` -

  - ### drawString

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

  - ### getViewportTranform

    public IViewportTransform getViewportTranform()

  - ### setCamera

    public void setCamera(float x, float y, float scale)
    Parameters:
      `x` -
      `y` -
      `scale` -
    See Also:
      - `IViewportTransform.setCamera(float, float, float)`

  - ### getScreenToWorldToOut

    public void getScreenToWorldToOut(Vec2 argScreen, Vec2 argWorld)
    Parameters:
      `argScreen` -
      `argWorld` -
    See Also:
      - `IViewportTransform.getScreenToWorld(com.codename1.gaming.physics.box2d.common.Vec2, com.codename1.gaming.physics.box2d.common.Vec2)`

  - ### getWorldToScreenToOut

    public void getWorldToScreenToOut(Vec2 argWorld, Vec2 argScreen)
    Parameters:
      `argWorld` -
      `argScreen` -
    See Also:
      - `IViewportTransform.getWorldToScreen(com.codename1.gaming.physics.box2d.common.Vec2, com.codename1.gaming.physics.box2d.common.Vec2)`

  - ### getWorldToScreenToOut

    public void getWorldToScreenToOut(float worldX, float worldY, Vec2 argScreen)
    Takes the world coordinates and puts the corresponding screen coordinates in argScreen.
    Parameters:
      `worldX` -
      `worldY` -
      `argScreen` -

  - ### getWorldToScreen

    public Vec2 getWorldToScreen(Vec2 argWorld)
    takes the world coordinate (argWorld) and returns the screen coordinates.
    Parameters:
      `argWorld` -

  - ### getWorldToScreen

    public Vec2 getWorldToScreen(float worldX, float worldY)
    Takes the world coordinates and returns the screen coordinates.
    Parameters:
      `worldX` -
      `worldY` -

  - ### getScreenToWorldToOut

    public void getScreenToWorldToOut(float screenX, float screenY, Vec2 argWorld)
    takes the screen coordinates and puts the corresponding world coordinates in argWorld.
    Parameters:
      `screenX` -
      `screenY` -
      `argWorld` -

  - ### getScreenToWorld

    public Vec2 getScreenToWorld(Vec2 argScreen)
    takes the screen coordinates (argScreen) and returns the world coordinates
    Parameters:
      `argScreen` -

  - ### getScreenToWorld

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