Skip to main content

b2DebugDraw

Struct b2DebugDraw 

Source
#[repr(C)]
pub struct b2DebugDraw {
Show 29 fields pub DrawPolygonFcn: Option<unsafe extern "C" fn(transform: b2WorldTransform, vertices: *const b2Vec2, vertexCount: c_int, color: b2HexColor, context: *mut c_void)>, pub DrawSolidPolygonFcn: Option<unsafe extern "C" fn(transform: b2WorldTransform, vertices: *const b2Vec2, vertexCount: c_int, radius: f32, color: b2HexColor, context: *mut c_void)>, pub DrawCircleFcn: Option<unsafe extern "C" fn(center: b2Pos, radius: f32, color: b2HexColor, context: *mut c_void)>, pub DrawSolidCircleFcn: Option<unsafe extern "C" fn(transform: b2WorldTransform, center: b2Vec2, radius: f32, color: b2HexColor, context: *mut c_void)>, pub DrawSolidCapsuleFcn: Option<unsafe extern "C" fn(p1: b2Pos, p2: b2Pos, radius: f32, color: b2HexColor, context: *mut c_void)>, pub DrawLineFcn: Option<unsafe extern "C" fn(p1: b2Pos, p2: b2Pos, color: b2HexColor, context: *mut c_void)>, pub DrawTransformFcn: Option<unsafe extern "C" fn(transform: b2WorldTransform, context: *mut c_void)>, pub DrawPointFcn: Option<unsafe extern "C" fn(p: b2Pos, size: f32, color: b2HexColor, context: *mut c_void)>, pub DrawStringFcn: Option<unsafe extern "C" fn(p: b2Pos, s: *const c_char, color: b2HexColor, context: *mut c_void)>, pub DrawBoundsFcn: Option<unsafe extern "C" fn(aabb: b2AABB, color: b2HexColor, context: *mut c_void)>, pub drawingBounds: b2AABB, pub forceScale: f32, pub jointScale: f32, pub drawContacts: bool, pub drawAnchorA: bool, pub drawShapes: bool, pub drawChainNormals: bool, pub drawJoints: bool, pub drawJointExtras: bool, pub drawBounds: bool, pub drawMass: bool, pub drawBodyNames: bool, pub drawGraphColors: bool, pub drawContactFeatures: bool, pub drawContactNormals: bool, pub drawContactForces: bool, pub drawFrictionForces: bool, pub drawIslands: bool, pub context: *mut c_void,
}
Expand description

This struct holds callbacks you can implement to draw a Box2D world. Callbacks receive world coordinates. In large world mode the translation is double precision so it stays accurate far from the origin. Shift into your own camera frame inside the callbacks. Initialize with b2DefaultDebugDraw. @ingroup world

Fields§

§DrawPolygonFcn: Option<unsafe extern "C" fn(transform: b2WorldTransform, vertices: *const b2Vec2, vertexCount: c_int, color: b2HexColor, context: *mut c_void)>

Draw a closed polygon provided in CCW order.

§DrawSolidPolygonFcn: Option<unsafe extern "C" fn(transform: b2WorldTransform, vertices: *const b2Vec2, vertexCount: c_int, radius: f32, color: b2HexColor, context: *mut c_void)>

Draw a solid closed polygon provided in CCW order.

§DrawCircleFcn: Option<unsafe extern "C" fn(center: b2Pos, radius: f32, color: b2HexColor, context: *mut c_void)>

Draw a circle.

§DrawSolidCircleFcn: Option<unsafe extern "C" fn(transform: b2WorldTransform, center: b2Vec2, radius: f32, color: b2HexColor, context: *mut c_void)>

Draw a solid circle.

§DrawSolidCapsuleFcn: Option<unsafe extern "C" fn(p1: b2Pos, p2: b2Pos, radius: f32, color: b2HexColor, context: *mut c_void)>

Draw a solid capsule.

§DrawLineFcn: Option<unsafe extern "C" fn(p1: b2Pos, p2: b2Pos, color: b2HexColor, context: *mut c_void)>

Draw a line segment.

§DrawTransformFcn: Option<unsafe extern "C" fn(transform: b2WorldTransform, context: *mut c_void)>

Draw a transform. Choose your own length scale.

§DrawPointFcn: Option<unsafe extern "C" fn(p: b2Pos, size: f32, color: b2HexColor, context: *mut c_void)>

Draw a point.

§DrawStringFcn: Option<unsafe extern "C" fn(p: b2Pos, s: *const c_char, color: b2HexColor, context: *mut c_void)>

Draw a string in world space

§DrawBoundsFcn: Option<unsafe extern "C" fn(aabb: b2AABB, color: b2HexColor, context: *mut c_void)>

Draw a bounding box. With double precision enabled, the single precision bounding box gets increasing padding when moving far from the origin.

§drawingBounds: b2AABB

World bounds to use for debug draw

§forceScale: f32

Scale to use when drawing forces

§jointScale: f32

Global scaling for joint drawing

§drawContacts: bool

Option to draw contact points

§drawAnchorA: bool

Draw anchor A for contact points (instead of anchorB)

§drawShapes: bool

Option to draw shapes

§drawChainNormals: bool

Option to draw chain shape normals

§drawJoints: bool

Option to draw joints

§drawJointExtras: bool

Option to draw additional information for joints

§drawBounds: bool

Option to draw the bounding boxes for shapes

§drawMass: bool

Option to draw the mass and center of mass of dynamic bodies

§drawBodyNames: bool

Option to draw body names

§drawGraphColors: bool

Option to visualize the graph coloring used for contacts and joints

§drawContactFeatures: bool

Option to draw contact feature ids

§drawContactNormals: bool

Option to draw contact normals

§drawContactForces: bool

Option to draw contact normal forces

§drawFrictionForces: bool

Option to draw contact friction forces

§drawIslands: bool

Option to draw islands as bounding boxes

§context: *mut c_void

User context that is passed as an argument to drawing callback functions

Trait Implementations§

Source§

impl Clone for b2DebugDraw

Source§

fn clone(&self) -> b2DebugDraw

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for b2DebugDraw

Source§

impl Debug for b2DebugDraw

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.