The Box2D renderer.
More...
#include <Box2DRenderer.h>
|
| const float | PW2RW (const float) const |
| | Physics World to Render World.
|
| |
| const Vector2 | PW2RW (const b2Vec2 &) const |
| | Physics World to Render World.
|
| |
|
|
UINT | m_nLineSprite = 0 |
| | Line sprite.
|
| |
|
Vector2 | m_vPos |
| | Position in Render World.
|
| |
|
float | m_fRoll = 0.0f |
| | Roll angle.
|
| |
|
float | m_fPRS = 0.0f |
| | Physics World to Render World scale value.
|
| |
Adds to Sage::CSpriteRenderer the ability to draw Box2D shapes from a Box2D body.
◆ CBox2DRenderer()
| CBox2DRenderer::CBox2DRenderer |
( |
const UINT | n, |
|
|
const float | fPRS ) |
The constructor. Initialize the renderer into Sage::eSpriteMode::Batched2D and record the index of the line sprite and the Physics World to Render World scale value.
- Parameters
-
| n | index of the line sprite. |
| fPRS | Physics World to Render World scale value. |
◆ Drawb2Body()
| void CBox2DRenderer::Drawb2Body |
( |
b2Body * | pBody | ) |
|
Draw a Box2D body using lines. Iterate through the fixtures attached to the body, calling Drawb2Shape() to draw the shape of each fixture.
- Parameters
-
| pBody | Pointer to a Box2D body. |
◆ Drawb2Chain()
| void CBox2DRenderer::Drawb2Chain |
( |
b2ChainShape * | p | ) |
|
|
protected |
Draw a Box2D chain shape using lines. Assumes that eSprite::Line exists and has been loaded. This function is a stub that has not yet been implemented.
- Parameters
-
| p | Pointer to a Box2D chain shape. |
◆ Drawb2Circle()
| void CBox2DRenderer::Drawb2Circle |
( |
b2CircleShape * | p | ) |
|
|
protected |
Draw a Box2D circle shape.
- Parameters
-
| p | Pointer to a Box2D circle shape. |
◆ Drawb2Edge()
| void CBox2DRenderer::Drawb2Edge |
( |
b2EdgeShape * | p | ) |
|
|
protected |
Draw a Box2D edge shape as a line.
- Parameters
-
| p | Pointer to a Box2D edge shape. |
◆ Drawb2Polygon()
| void CBox2DRenderer::Drawb2Polygon |
( |
b2PolygonShape * | p | ) |
|
|
protected |
Draw a Box2D polygon shape using lines. Iterate through the polygon points, drawing a line from each one to the one before it. The line from the first point to the last one is a special case.
- Parameters
-
| p | Pointer to a Box2D polygon shape. |
◆ Drawb2Shape()
| void CBox2DRenderer::Drawb2Shape |
( |
b2Shape * | p | ) |
|
|
protected |
◆ PW2RW() [1/2]
| const Vector2 CBox2DRenderer::PW2RW |
( |
const b2Vec2 & | v | ) |
const |
|
private |
Convert a vector in Physics World to the corresponding vector in Render World by multiplying by m_fPRS, the Physics World to Render World scale value.
- Parameters
-
- Returns
- Render World vector.
◆ PW2RW() [2/2]
| const float CBox2DRenderer::PW2RW |
( |
const float | x | ) |
const |
|
private |
Convert a distance in Physics World to the corresponding distance in Render World by multiplying by m_fPRS, the Physics World to Render World scale value.
- Parameters
-
- Returns
- Render World distance.