org.jbox2d.testbed
Class ProcessingDebugDraw

java.lang.Object
  extended by org.jbox2d.dynamics.DebugDraw
      extended by org.jbox2d.testbed.ProcessingDebugDraw

public class ProcessingDebugDraw
extends DebugDraw

Implementation of DebugDraw using Processing (http://www.processing.org)

Author:
ewjordan

Field Summary
 float fontHeight
           
 processing.core.PApplet g
           
 processing.core.PFont m_font
           
 float scaleFactor
           
static ProcessingDebugDraw screen
           
 float transX
           
 float transY
           
 float yFlip
           
 
Fields inherited from class org.jbox2d.dynamics.DebugDraw
e_aabbBit, e_centerOfMassBit, e_coreShapeBit, e_jointBit, e_obbBit, e_pairBit, e_shapeBit, m_drawFlags
 
Constructor Summary
ProcessingDebugDraw(processing.core.PApplet pApplet)
           
 
Method Summary
 void drawCircle(Vec2 center, float radius, javax.vecmath.Color3f color)
           
 void drawPoint(Vec2 position, float f, javax.vecmath.Color3f color)
           
 void drawPolygon(Vec2[] vertices, int vertexCount, javax.vecmath.Color3f color)
           
 void drawSegment(Vec2 p1, Vec2 p2, javax.vecmath.Color3f color)
           
 void drawSolidCircle(Vec2 center, float radius, Vec2 axis, javax.vecmath.Color3f color)
           
 void drawSolidPolygon(Vec2[] vertices, int vertexCount, javax.vecmath.Color3f color)
           
 void drawString(float x, float y, java.lang.String s, javax.vecmath.Color3f color)
           
 void drawXForm(XForm xf)
           
 Vec2 screenToWorld(float x, float y)
           
 Vec2 screenToWorld(Vec2 screen)
           
 void setCamera(float x, float y, float scale)
          Stub method to overload for camera movement/zoom.
 Vec2 worldToScreen(float x, float y)
           
 Vec2 worldToScreen(Vec2 world)
           
 
Methods inherited from class org.jbox2d.dynamics.DebugDraw
appendFlags, clearFlags, getFlags, setFlags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

screen

public static ProcessingDebugDraw screen

g

public processing.core.PApplet g

m_font

public processing.core.PFont m_font

fontHeight

public float fontHeight

transX

public float transX

transY

public float transY

scaleFactor

public float scaleFactor

yFlip

public float yFlip
Constructor Detail

ProcessingDebugDraw

public ProcessingDebugDraw(processing.core.PApplet pApplet)
Method Detail

setCamera

public void setCamera(float x,
                      float y,
                      float scale)
Description copied from class: DebugDraw
Stub method to overload for camera movement/zoom.

Overrides:
setCamera in class DebugDraw
Parameters:
x - - x coordinate of camera
y - - y coordinate of camera
scale - - zoom factor

worldToScreen

public Vec2 worldToScreen(Vec2 world)
Overrides:
worldToScreen in class DebugDraw
Parameters:
world - World position
Returns:
Screen position

worldToScreen

public Vec2 worldToScreen(float x,
                          float y)
Overrides:
worldToScreen in class DebugDraw
Parameters:
x - World x position
y - World y position
Returns:
Screen position

screenToWorld

public Vec2 screenToWorld(Vec2 screen)
Overrides:
screenToWorld in class DebugDraw
Parameters:
screen - Screen position
Returns:
World position

screenToWorld

public Vec2 screenToWorld(float x,
                          float y)
Overrides:
screenToWorld in class DebugDraw
Parameters:
x - Screen x position
y - Screey y position
Returns:
World position

drawCircle

public void drawCircle(Vec2 center,
                       float radius,
                       javax.vecmath.Color3f color)
Specified by:
drawCircle in class DebugDraw

drawSolidCircle

public void drawSolidCircle(Vec2 center,
                            float radius,
                            Vec2 axis,
                            javax.vecmath.Color3f color)
Specified by:
drawSolidCircle in class DebugDraw

drawPolygon

public void drawPolygon(Vec2[] vertices,
                        int vertexCount,
                        javax.vecmath.Color3f color)
Specified by:
drawPolygon in class DebugDraw

drawSolidPolygon

public void drawSolidPolygon(Vec2[] vertices,
                             int vertexCount,
                             javax.vecmath.Color3f color)
Specified by:
drawSolidPolygon in class DebugDraw

drawSegment

public void drawSegment(Vec2 p1,
                        Vec2 p2,
                        javax.vecmath.Color3f color)
Specified by:
drawSegment in class DebugDraw

drawXForm

public void drawXForm(XForm xf)
Specified by:
drawXForm in class DebugDraw

drawString

public void drawString(float x,
                       float y,
                       java.lang.String s,
                       javax.vecmath.Color3f color)
Specified by:
drawString in class DebugDraw

drawPoint

public void drawPoint(Vec2 position,
                      float f,
                      javax.vecmath.Color3f color)
Specified by:
drawPoint in class DebugDraw