Packagecom.boristhebrave.Box2DWith
Classpublic class Box2DGraphics

A re-implementation of debug drawing without the hassles of Box2D's API. By drawing into Sprites which you persist through frames, the methods here are appropriate for production release.



Public Properties
 PropertyDefined by
  awakeColor : uint = 0xE6E6E6
Box2DGraphics
  fillAlpha : Number = 0.8
Box2DGraphics
  graphics : Graphics
Box2DGraphics
  jointColor : uint = 0x80CDCD
Box2DGraphics
  lineThickness : Number = 1
Box2DGraphics
  physScale : Number
Box2DGraphics
  sleepColor : uint = 0x8080E6
Box2DGraphics
  staticColor : uint = 0x80E680
Box2DGraphics
  xformScale : Number = 3
Box2DGraphics
Public Methods
 MethodDefined by
  
Box2DGraphics(graphics:Graphics, physScale:Number)
Creates a wrapper for Graphics, with it's own set of drawing properties.
Box2DGraphics
  
drawBody(body:b2Body):void
Draws a body, including styling.
Box2DGraphics
  
drawBodyLocal(body:b2Body):void
Draws a body in local co-ordinates, including styling.
Box2DGraphics
  
drawBodyOutline(body:b2Body):void
Draws the given body, without setting any style properties.
Box2DGraphics
  
drawBodyOutlineLocal(body:b2Body):void
Draws the given body in local cordinates, without setting any style properties.
Box2DGraphics
  
drawJoint(joint:b2Joint):void
Draws a joint, including styling.
Box2DGraphics
  
drawJointOutline(joint:b2Joint):void
Draws the given joint, without setting any style properties.
Box2DGraphics
  
drawSegment(p1:b2Vec2, p2:b2Vec2):void
Draws an unstyled line.
Box2DGraphics
  
drawShapeOutline(shape:b2Shape):void
Draws the given shape in world co-ordinates, without setting any style properties.
Box2DGraphics
  
drawShapeOutlineLocal(shape:b2Shape):void
Draws the given shape in local co-ordinates, without setting any style properties.
Box2DGraphics
  
drawWorld(world:b2World):void
Draws a world, including styling.
Box2DGraphics
Property detail
awakeColorproperty
public var awakeColor:uint = 0xE6E6E6
fillAlphaproperty 
public var fillAlpha:Number = 0.8
graphicsproperty 
public var graphics:Graphics
jointColorproperty 
public var jointColor:uint = 0x80CDCD
lineThicknessproperty 
public var lineThickness:Number = 1
physScaleproperty 
public var physScale:Number
sleepColorproperty 
public var sleepColor:uint = 0x8080E6
staticColorproperty 
public var staticColor:uint = 0x80E680
xformScaleproperty 
public var xformScale:Number = 3
Constructor detail
Box2DGraphics()constructor
public function Box2DGraphics(graphics:Graphics, physScale:Number)

Creates a wrapper for Graphics, with it's own set of drawing properties.

Parameters
graphics:Graphics — The Graphics object to wrap.
 
physScale:Number — The scaling to use, in pixels/unit.
Method detail
drawBody()method
public function drawBody(body:b2Body):void

Draws a body, including styling.

Parameters
body:b2Body
drawBodyLocal()method 
public function drawBodyLocal(body:b2Body):void

Draws a body in local co-ordinates, including styling.

Parameters
body:b2Body
drawBodyOutline()method 
public function drawBodyOutline(body:b2Body):void

Draws the given body, without setting any style properties. Use this instead of drawBody if you want a more customized looking shape.

Parameters
body:b2Body
drawBodyOutlineLocal()method 
public function drawBodyOutlineLocal(body:b2Body):void

Draws the given body in local cordinates, without setting any style properties. Use this instead of drawBodyLocal if you want a more customized looking shape.

Parameters
body:b2Body
drawJoint()method 
public function drawJoint(joint:b2Joint):void

Draws a joint, including styling.

Parameters
joint:b2Joint
drawJointOutline()method 
public function drawJointOutline(joint:b2Joint):void

Draws the given joint, without setting any style properties. Use this instead of drawJoint if you want a more customized looking shape.

Parameters
joint:b2Joint
drawSegment()method 
public function drawSegment(p1:b2Vec2, p2:b2Vec2):void

Draws an unstyled line.

Parameters
p1:b2Vec2
 
p2:b2Vec2
drawShapeOutline()method 
public function drawShapeOutline(shape:b2Shape):void

Draws the given shape in world co-ordinates, without setting any style properties. Use this instead of drawShape if you want a more customized looking shape.

Parameters
shape:b2Shape
drawShapeOutlineLocal()method 
public function drawShapeOutlineLocal(shape:b2Shape):void

Draws the given shape in local co-ordinates, without setting any style properties. Use this instead of drawShapeLocal if you want a more customized looking shape.

Parameters
shape:b2Shape
drawWorld()method 
public function drawWorld(world:b2World):void

Draws a world, including styling. Note that it is more efficient to draw bodies into separate DisplayObjects once, and then move them around, than to call drawWorld once per frame.

Parameters
world:b2World