![]() |
Box2D Binary Counter
Ian Parberry's "Introduction to Game Physics"
|
The Object Manager. More...
#include <ObjectManager.h>
Public Member Functions | |
CObjectManager () | |
Constructor. | |
~CObjectManager () | |
Destructor. More... | |
void | CreateObject (eSprite t, b2Body *p) |
Create object. | |
void | CreateCounter (int n) |
Create counter. More... | |
bool | CreateBall () |
Create a new ball. More... | |
void | clear () |
Reset to initial conditions. More... | |
void | draw () |
Draw all objects. More... | |
void | CreateWorldEdges () |
Create the edges of the world. More... | |
bool | AllStopped () |
Have the balls stopped moving? More... | |
int | HighLightBit (int n) |
Highlight the nth bit. | |
bool | Overflow () |
Test overflow. | |
Private Attributes | |
std::vector< CObject * > | m_stdList |
Object list. | |
LParticleDesc2D | m_cRingDesc |
Particle descriptor for ring of arrows. | |
UINT | m_nMaxNumber = 0 |
Maximum number. | |
Additional Inherited Members | |
![]() | |
static b2World * | m_pPhysicsWorld = nullptr |
Pointer to Box2D Physics World. | |
static CRenderer * | m_pRenderer = nullptr |
Pointer to the Renderer. | |
static CObjectManager * | m_pObjectManager = nullptr |
Pointer to the Object Manager. | |
static LParticleEngine2D * | m_pParticleEngine = nullptr |
Pointer to particle engine. | |
static eGameState | m_eGameState = eGameState::Start |
Current game state. | |
static CCounter * | m_pCounter = nullptr |
Pointer to a counter. | |
static UINT | m_nCurNum = 0 |
Current number. | |
The Object Manager.
An abstract representation of all of the objects in the game.
CObjectManager::~CObjectManager | ( | ) |
Destructor.
The destructor clears the object list, which destructs all of the objects in it.
bool CObjectManager::AllStopped | ( | ) |
Have the balls stopped moving?
Checks whether all of the balls that are still in play (balls that have fallen to the bottom are not in play) have stopped.
void CObjectManager::clear | ( | ) |
Reset to initial conditions.
Delete all of the entities managed by the Object Manager. This involves deleting all of the CObject instances pointed to by the object list, then clearing the object list itself.
bool CObjectManager::CreateBall | ( | ) |
Create a new ball.
Place a ball in Physics World and the Object Manager. The initial position and velocity is hard-coded.
void CObjectManager::CreateCounter | ( | int | n | ) |
Create counter.
Create the counter.
n | Number of bits of precision. |
void CObjectManager::CreateWorldEdges | ( | ) |
Create the edges of the world.
Create world edges in Physics World. Place Box2D edge shapes in the Physics World in places that correspond to the bottom, right, and left edges of the screen in Render World. The left and right edges continue upwards for a distance. There is no top to the world.
void CObjectManager::draw | ( | ) |
Draw all objects.
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.