Implementation of nape debug draw using flash/openflnme graphics API.



This debug draw is slower than BitmapDebug which is available in flash10+ however the BitmapDebug draw makes use of Alchemy opcodes so you may wish not to use it if you are also using Stage3D and do not wish to be subject to Adobe licensing.

Constructor

@:value({ bgColour : 0x333333 })new(width:Int, height:Int, bgColour:Int = 0x333333)

Construct new ShapeDebug with given viewport size and backgruond.

Background colour does not have much weight for a ShapeDebug which always has a transparent background, but serves to bias the colours chosen for drawing objects.

Parameters:

width

The width of Debug draw viewport.

height

The height of Debug draw viewport.

bgColour

the background colour for debug draw. (default 0x333333)

Returns:

The constructed ShapeDebug.

Throws:

#

If width or height are not strictly positive.

Variables

@:value(0.0)thickness:Float = 0.0

Thickness to draw lines with.

@:value(null)zpp_inner_zn:ZPP_ShapeDebug = null

@private

Methods

clear():Void

@inheritDoc

@:has_untypeddraw(object:Dynamic):Void

@inheritDoc

drawAABB(aabb:AABB, colour:Int):Void

@inheritDoc

drawCircle(position:Vec2, radius:Float, colour:Int):Void

@inheritDoc

drawCurve(start:Vec2, control:Vec2, end:Vec2, colour:Int):Void

@inheritDoc

drawFilledCircle(position:Vec2, radius:Float, colour:Int):Void

@inheritDoc

@:has_untypeddrawFilledPolygon(polygon:Dynamic, colour:Int):Void

@inheritDoc

drawFilledTriangle(p0:Vec2, p1:Vec2, p2:Vec2, colour:Int):Void

@inheritDoc

drawLine(start:Vec2, end:Vec2, colour:Int):Void

@inheritDoc

@:has_untypeddrawPolygon(polygon:Dynamic, colour:Int):Void

@inheritDoc

@:value({ radius : 3.0, coils : 3 })drawSpring(start:Vec2, end:Vec2, colour:Int, coils:Int = 3, radius:Float = 3.0):Void

@inheritDoc

Inherited Variables

Defined by Debug

bgColour:Int

Background colour for debug draw display.

This value does not have much use for ShapeDebug, or for a transparent BitmapDebug but will still be used in tinting object colours to better fit an idealised background colour.

@:value(null)colour:Null<Int ‑> Int> = null

User defined colour picking.

When not null, this method will be called to decide which colour to use for an object with argument being the id of that object.

The return value should be an RGB value.

@:value(false)cullingEnabled:Bool = false

When true, objects outside the debug draw screen will not be drawn.

The debug draw screen is defined as the rectangle (0,0) -> (width,height). To 'move' the debug draw screen in your world, you should modify the transform property.

This culling has a cost, so is not worth enabling if everything is always on screen anyways.

read onlydisplay:DisplayObject

The flash/openflnme native display object representing debug draw.



When using debug drawer, you should add this to your display list.

@:value(false)drawBodies:Bool = false

If true, then all bodies in the space (whether active or not) will be drawn.

@:value(false)drawBodyDetail:Bool = false

If true, then things like the body centre of mass, and bouncing box will be drawn.

This will only have an effect if drawBodies is true.

@:value(false)drawCollisionArbiters:Bool = false

If true, a representation of contact patches will be drawn.

Only active arbiters are drawn.

@:value(false)drawConstraints:Bool = false

If true, then representations of the active constraints will be drawn.

@:value(false)drawFluidArbiters:Bool = false

If true, a representation of centres of buoyancy and overlap will be drawn.

Only active arbiters are drawn.

@:value(false)drawSensorArbiters:Bool = false

If true, a representation of sensor interactions will be drawn.

Only active arbiters are drawn.

@:value(false)drawShapeAngleIndicators:Bool = false

If true, then indicators of the shapes rotation will be drawn.

This will only have an effect if drawBodies is true.

@:value(false)drawShapeDetail:Bool = false

If true, then things like shape centre of mass and bounding box will be drawn.

This will only have an effect if drawBodies is true.

transform:Mat23

Transformation to apply to all debug draw operations.

This transform can be used to 'move' the debug draw screen through your world as well as rotating and zooming in etc.

This transform effects 'all' debug draw operations and optimisation is in place to not perform any transformation if matrix is the identity matrix.

@:value(null)zpp_inner:ZPP_Debug = null

@private

Inherited Methods

Defined by Debug

flush():Void

Flush any pending draw operations to debug view.

This operation is not needed for ShapeDebug at present.