My contact listener.
#include <ContactListener.h>
|
| void | PreSolve (b2Contact *, const b2Manifold *) |
| | Presolve function.
|
| |
|
| UINT | Count (eSprite) |
| | Count number of bodies that have sprite type t.
|
| |
| float | GetSpeed (const b2Vec2 &) |
| | Get the collision speed.
|
| |
|
|
b2Body * | m_pBodyA = nullptr |
| | Pointer to body A.
|
| |
|
b2Body * | m_pBodyB = nullptr |
| | Pointer to body B.
|
| |
|
|
static b2World * | m_pPhysicsWorld = nullptr |
| | Pointer to Box2D Physics World.
|
| |
|
static CBox2DRenderer * | m_pRenderer = nullptr |
| | Pointer to Render World.
|
| |
|
static CObjectManager * | m_pObjectManager = nullptr |
| | Pointer to object manager.
|
| |
|
static Sage::CParticleEngine2D * | m_pParticleEngine = nullptr |
| | Pointer to particle engine.
|
| |
|
static eDrawMode | m_eDrawMode = eDrawMode::Sprites |
| | Draw mode.
|
| |
|
static bool | m_bEasterEgg = false |
| | Easter egg!
|
| |
◆ Count()
| UINT CMyListener::Count |
( |
eSprite | t | ) |
|
|
private |
Count the number of bodies out of *m_pBodyA and *m_pBodyB that have objects have a given sprite type. Returns 0, 1, or 2, of course.
- Parameters
-
- Returns
- Number of *m_pBodyA and *m_pBodyB that have type t.
◆ GetSpeed()
| float CMyListener::GetSpeed |
( |
const b2Vec2 & | p | ) |
|
|
private |
Collision speed is proportional to the magnitude of the relative velocity.
- Parameters
-
- Returns
- Collision speed in Physics World units.
◆ PreSolve()
| void CMyListener::PreSolve |
( |
b2Contact * | pContact, |
|
|
const b2Manifold * | pManifold ) |
New Presolve function that renders a colored star at each contact point and plays the appropriate sound, depending on what type of objects are contacting. Box2D will run this before performing relaxation.
- Parameters
-
| pContact | Pointer to the contact. |
| pManifold | Pointer to the old contact manifold as it was before this contact. |