Box2D Bouncy Things Toy
Ian Parberry's "Introduction to Game Physics"
Public Member Functions | Private Attributes | List of all members
CObjectManager Class Reference

The object manager. More...

#include <ObjectManager.h>

Inheritance diagram for CObjectManager:
CCommon

Public Member Functions

 CObjectManager ()
 Constructor.
 
 ~CObjectManager ()
 Destructor. More...
 
void clear ()
 Reset to initial conditions. More...
 
void draw ()
 Draw all objects. More...
 
void CreateWorldEdges ()
 Create the edges of the world. More...
 
void CreateCrate (float, float)
 Create a crate. More...
 
void CreateBall (float, float)
 Create a ball. More...
 
const size_t GetSize () const
 Get number of objects. More...
 

Private Attributes

std::vector< CObject * > m_stdList
 Object list.
 

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.
 

Detailed Description

The object manager.

The object manager manages objects.

Constructor & Destructor Documentation

◆ ~CObjectManager()

CObjectManager::~CObjectManager ( )

Destructor.

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

Member Function Documentation

◆ clear()

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.

◆ CreateBall()

void CObjectManager::CreateBall ( float  x,
float  y 
)

Create a ball.

Place a ball.

Parameters
xHorizontal coordinate in Physics World units.
yVertical coordinate in Physics World units.

◆ CreateCrate()

void CObjectManager::CreateCrate ( float  x,
float  y 
)

Create a crate.

Create a crate.

Parameters
xHorizontal coordinate in Physics World units.
yVertical coordinate in Physics World units.

◆ CreateWorldEdges()

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. The left and right edges continue upwards for a distance. There is no top to the world.

◆ draw()

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.

◆ GetSize()

const size_t CObjectManager::GetSize ( ) const

Get number of objects.

Reader function for number of objects in the object list.

Returns
Number of objects in object list.