My contact listener.
#include <ContactListener.h>
|
| void | PreSolve (b2Contact *, const b2Manifold *) |
| | Presolve function.
|
| |
|
| float | GetSpeed (const b2Vec2 &) |
| | Get the collision speed.
|
| |
| eSprite | GetBellType () |
| | Get a pointer to the bell object in a bell collision.
|
| |
| b2Body * | GetBall () |
| | Get a pointer to a ball's body in Physics World.
|
| |
|
|
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 the Object Manager.
|
| |
|
static Sage::CParticleEngine2D * | m_pFrontParticleEngine = nullptr |
| | Pointer to front particle engine.
|
| |
|
static Sage::CParticleEngine2D * | m_pBackParticleEngine = nullptr |
| | Pointer to front particle engine.
|
| |
|
static CCannon * | m_pCannon = nullptr |
| | Pointer to a cannon.
|
| |
|
static Vector2 | m_vBellPos [NUMBELLS] = {Vector2(0.0f)} |
| | Positions of bells.
|
| |
|
static float | m_fGravity = 20.0f |
| | Magnitude of gravity in Render World units.
|
| |
|
static eDrawMode | m_eDrawMode = eDrawMode::Sprites |
| | Draw mode.
|
| |
◆ GetBall()
| b2Body * CMyListener::GetBall |
( |
| ) |
|
|
private |
Get a pointer to the ball object if a ball is colliding with a bell.
- Returns
- Pointer to a ball if one is colliding with bell, else
nullptr.
◆ GetBellType()
| eSprite CMyListener::GetBellType |
( |
| ) |
|
|
private |
Get the bell type if a bell has been hit.
- Returns
- Bell type hit,
eSprite::None if there is none.
◆ 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 * | c, |
|
|
const b2Manifold * | m ) |
Presolve function. Renders a colored star at each contact point and plays the appropriate sound, depending on what type of objects are contacting.
- Parameters
-
| c | Pointer to the contact. |
| m | Pointer to the old contact manifold as it was before this contact. |