Box2D Binary Counter
Game Physics with a 2D Physics Engine
Loading...
Searching...
No Matches
CObjectManager Class Reference

The Object Manager. More...

#include <ObjectManager.h>

Inheritance diagram for CObjectManager:
Collaboration diagram for CObjectManager:

Public Member Functions

 CObjectManager ()
 Constructor.
 
 ~CObjectManager ()
 Destructor.
 
void CreateObject (eSprite t, b2Body *p)
 Create object.
 
void CreateCounter (UINT n)
 Create counter.
 
bool CreateBall ()
 Create a new ball.
 
void clear ()
 Reset to initial conditions.
 
void draw ()
 Draw all objects.
 
void CreateWorldEdges ()
 Create the edges of the world.
 
bool AllStopped ()
 Have the balls stopped moving?
 
int HighLightBit (UINT n)
 Highlight the nth bit.
 
const bool Overflow () const
 Test overflow.
 

Private Attributes

std::vector< CObject * > m_stdList
 Object list.
 
Sage::CParticleDesc2D m_cRingDesc
 Particle descriptor for ring of arrows.
 
UINT m_nMaxNumber = 0
 Maximum number.
 
b2Body * m_pBase = nullptr
 Pointer to invisible background body.
 

Additional Inherited Members

- Static Protected Attributes inherited from CCommon
static b2World * m_pPhysicsWorld = nullptr
 Pointer to Box2D Physics World.
 
static CRendererm_pRenderer = nullptr
 Pointer to the Renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to the Object Manager.
 
static Sage::CParticleEngine2D * m_pParticleEngine = nullptr
 Pointer to particle engine.
 
static eGameState m_eGameState = eGameState::Loading
 Current game state.
 
static CCounterm_pCounter = nullptr
 Pointer to a counter.
 
static UINT m_nCurNum = 0
 Current number.
 
static eDrawMode m_eDrawMode = eDrawMode::Sprites
 Draw mode.
 

Detailed Description

An abstract representation of all of the objects in the game.

Constructor & Destructor Documentation

◆ ~CObjectManager()

CObjectManager::~CObjectManager ( )

The destructor clears the object list, which destructs all of the objects in it.

Here is the call graph for this function:

Member Function Documentation

◆ AllStopped()

bool CObjectManager::AllStopped ( )

Checks whether all of the balls that are still in play (balls that have fallen to the bottom are not in play) have stopped.

Returns
true if all balls in play have stopped.
Here is the caller graph for this function:

◆ clear()

void CObjectManager::clear ( )

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.

Here is the caller graph for this function:

◆ CreateBall()

bool CObjectManager::CreateBall ( )

Place a ball in Physics World and the Object Manager. The initial position and velocity is hard-coded.

Returns
true if the ball was successfully created.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateCounter()

void CObjectManager::CreateCounter ( UINT n)

Create the counter.

Parameters
nNumber of bits of precision.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateObject()

void CObjectManager::CreateObject ( eSprite t,
b2Body * p )

Create an object in the Object Manager and link its Physics World body to it.

Parameters
tSprite type.
pPointer to Box2D body.
Here is the caller graph for this function:

◆ CreateWorldEdges()

void CObjectManager::CreateWorldEdges ( )

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Here is the caller graph for this function:

◆ HighLightBit()

int CObjectManager::HighLightBit ( UINT n)

Highlight a bit.

Parameters
nIndex of bit.
Returns
0 if the bit is zero, 1 if the bit is one.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Overflow()

const bool CObjectManager::Overflow ( ) const

Check for overflow.

Returns
true if there has been an overflow.
Here is the caller graph for this function: