The Box2D Blank Game
A Blank 2D Game with Box2D and a Contact Listener for Sounds
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. More...
 
 ~CObjectManager ()
 Destructor. More...
 
void CreateObject (eSprite, b2Body *)
 Create object. More...
 
void clear ()
 Reset to initial conditions. More...
 
void Draw ()
 Draw objects. More...
 
void CreateWorldEdges ()
 Create the edges of the world. More...
 

Private Attributes

LSpriteDesc2D m_cBgDesc
 Descriptor for background image.
 
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.
 
static LParticleEngine2D * m_pParticleEngine = nullptr
 Pointer to particle engine.
 

Detailed Description

The abstract representation of the objects in the game.

Constructor & Destructor Documentation

◆ CObjectManager()

CObjectManager::CObjectManager ( )

Fills in the details for the background image descriptor.

◆ ~CObjectManager()

CObjectManager::~CObjectManager ( )

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

Member Function Documentation

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

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

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

◆ Draw()

void CObjectManager::Draw ( )

Draw all objects.