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

The game object. More...

#include <Object.h>

Inheritance diagram for CObject:
CCommon

Public Member Functions

 CObject (eSprite, b2Body *)
 Constructor. More...
 
 ~CObject ()
 Destructor. More...
 
void draw ()
 Draw object. More...
 

Private Attributes

eSprite m_eSpriteType = eSprite::Size
 Sprite type.
 
b2Body * m_pBody = nullptr
 Physics World 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.
 

Detailed Description

The game object.

Game objects are responsible for remembering information about themselves.

Constructor & Destructor Documentation

◆ CObject()

CObject::CObject ( eSprite  t,
b2Body *  b 
)

Constructor.

This constructor assumes that a Physics World body has already been created for this object. It then has responsibility for deleting it in its destructor.

Parameters
tSprite type.
bPointer to Physics World body.

◆ ~CObject()

CObject::~CObject ( )

Destructor.

This destructor assumes that Box2D hasn't been shut down yet.

Member Function Documentation

◆ draw()

void CObject::draw ( )

Draw object.

Draw the object using its position and orientation in Physics World.