The object manager.
More...
#include <ObjectManager.h>
|
| Shapes::CShape * | MakeShape (Shapes::CShapeDesc *, const CObjDesc &) |
| | Make a shape.
|
| |
| void | BroadPhase () |
| | Broad phase collision detection and response.
|
| |
| bool | NarrowPhase (Shapes::CShape *, Shapes::CDynamicCircle *) |
| | Narrow phase collision detection and response.
|
| |
| void | MakeBumper (const Vector2 &, float, eSprite, eSprite, eSound) |
| | Make a bumper.
|
| |
| void | MakeBollard (const Vector2 &) |
| | Make a bollard.
|
| |
| Shapes::CCompoundShape * | MakeFlipper (const Vector2 &, const Vector2 &, float) |
| | Make a flipper.
|
| |
| void | MakeThingL () |
| | Make a thing (left).
|
| |
| void | MakeThingR () |
| | Make a thing (right).
|
| |
|
|
std::vector< Shapes::CShape * > | m_stdShapes [(UINT) Shapes::eMotion::Size] |
| | Array of lists of shapes.
|
| |
|
std::vector< CObject * > | m_stdObjects |
| | Object list.
|
| |
|
CGate * | m_pLeftGate = nullptr |
| | Pointer to left gate.
|
| |
|
CGate * | m_pRightGate = nullptr |
| | Pointer to right gate.
|
| |
|
Shapes::CAabb2D | m_cAABB |
| | AABB for the whole window.
|
| |
|
CFlipper * | m_pLeftFlipper = nullptr |
| | Pointer to left flipper.
|
| |
|
CFlipper * | m_pRightFlipper = nullptr |
| | Pointer to righ t flipper.
|
| |
|
|
static Sage::CSpriteRenderer * | m_pRenderer = nullptr |
| | Pointer to the renderer.
|
| |
|
static CObjectManager * | m_pObjectManager = nullptr |
| | Pointer to the object manager.
|
| |
|
static UINT | m_nMIterations = 4 |
| | Number of motion iterations.
|
| |
|
static UINT | m_nCIterations = 1 |
| | Number of collision iterations.
|
| |
|
static float | m_fFrequency = 60.0f*m_nMIterations |
| | Frequency, number of physics iterations per second.
|
| |
|
static eDrawMode | m_eDrawMode = eDrawMode::Background |
| | Draw mode.
|
| |
|
static bool | m_bBallInPlay = false |
| | Is there a ball currently in play?
|
| |
|
static UINT | m_nScore = 0 |
| | Current score.
|
| |
A managed collection of all of the game objects.
◆ ~CObjectManager()
| CObjectManager::~CObjectManager |
( |
| ) |
|
The destructor clears the shape lists, which destructs all of the shapes in them.
◆ AddShape()
| Shapes::CShape * CObjectManager::AddShape |
( |
Shapes::CShapeDesc * | sd, |
|
|
const CObjDesc & | od ) |
Creates a new shape and pushes a contact descriptor for that shape into the shape list.
- Parameters
-
| sd | Pointer to a shape descriptor. |
| od | Object descriptor. |
- Returns
- Pointer to created shape.
◆ BroadPhase()
| void CObjectManager::BroadPhase |
( |
| ) |
|
|
private |
Do collision detection for all dynamic shapes against all static and kinematic shapes, and against all dynamic shapes that appear after it in the dynamic shape list.
◆ Draw()
| void CObjectManager::Draw |
( |
| ) |
|
Draw the game objects using Painter's Algorithm. The background is drawn first, then the game objects are asked to draw themselves in the order that they are in the object list. That is, they are drawn from back to front.
◆ DrawOutlines()
| void CObjectManager::DrawOutlines |
( |
| ) |
|
Draw the outlines of the shapes in all objects.
◆ LeftFlip()
| void CObjectManager::LeftFlip |
( |
bool | bUp | ) |
|
If left flipper isn't moving up, set its rotational velocity to ROTSPEED (with the correct sign indicating direction), and play a sound.
- Parameters
-
| bUp | true for up flip, false for down flip. |
◆ MakeBollard()
| void CObjectManager::MakeBollard |
( |
const Vector2 & | p | ) |
|
|
private |
A bollard is one of the long skinny things at the top.
- Parameters
-
◆ MakeBumper()
| void CObjectManager::MakeBumper |
( |
const Vector2 & | p, |
|
|
float | e, |
|
|
eSprite | unlit, |
|
|
eSprite | lit, |
|
|
eSound | snd ) |
|
private |
A bumper is a round thing that propels the balls at great speed.
- Parameters
-
| p | Position. |
| e | Elasticity. |
| unlit | Unlit sprite index. |
| lit | Lit sprite index. |
| snd | Collision sound index. |
◆ MakeFlipper()
| Shapes::CCompoundShape * CObjectManager::MakeFlipper |
( |
const Vector2 & | p, |
|
|
const Vector2 & | d, |
|
|
float | a ) |
|
private |
Make a compound shape for a flipper, which is made up of two circles and two line segments tangent to the circles.
- Parameters
-
| p | Position of center of rotation. |
| d | Offset from position to center of sprite. |
| a | Initial orientation. |
- Returns
- Pointer to the created compound shape.
◆ MakeShape()
| Shapes::CShape * CObjectManager::MakeShape |
( |
Shapes::CShapeDesc * | sd, |
|
|
const CObjDesc & | od ) |
|
private |
Create a new shape and a contact descriptor for that shape.
- Parameters
-
| sd | Pointer to a shape descriptor. |
| od | An object descriptor. |
- Returns
- Pointer to a new contact descriptor.
◆ MakeShapes()
| void CObjectManager::MakeShapes |
( |
| ) |
|
Make the static shapes for the things in the world. As with most physics code, this function is long and tedious, but it's important to get the details right.
◆ MakeThingL()
| void CObjectManager::MakeThingL |
( |
| ) |
|
|
private |
I don't know what to call it. One of the things on the left and right of the bollards at the top of the play area. This is the left one.
◆ MakeThingR()
| void CObjectManager::MakeThingR |
( |
| ) |
|
|
private |
I don't know what to call it. One of the things on the left and right of the bollards at the top of the play area. This is the right one.
◆ MakeWorldEdges()
| void CObjectManager::MakeWorldEdges |
( |
| ) |
|
Make the static shapes for the world boundaries. As with most physics code, this function is long and tedious, but it's important to get the details right.
◆ Move()
| void CObjectManager::Move |
( |
| ) |
|
Move all dynamic and kinematic shapes and perform broad phase collision detection and response.
◆ NarrowPhase()
| bool CObjectManager::NarrowPhase |
( |
Shapes::CShape * | pShape, |
|
|
Shapes::CDynamicCircle * | pCirc ) |
|
private |
Check whether a shape collides with a dynamic circle and make response.
- Parameters
-
| pShape | Pointer to a static or kinematic shape. |
| pCirc | Pointer to moving circle. |
- Returns
- true if there was a collision.
◆ RightFlip()
| void CObjectManager::RightFlip |
( |
bool | bUp | ) |
|
If right flipper isn't moving up, set its rotational velocity to ROTSPEED (with the correct sign indicating direction), and play a sound.
- Parameters
-
| bUp | true for up flip, false for down flip. |