Box2D Cannon Game with Stars
Chapter 8 of Ian Parberry's "Introduction to Game Physics with Box2D"
 All Classes Files Functions Variables Enumerations Friends Pages
Public Member Functions | Protected Attributes | Friends | List of all members
CGameObject Class Reference

The game object. More...

#include <Object.h>

Inheritance diagram for CGameObject:
CParticle

Public Member Functions

 CGameObject (GameObjectType objecttype)
 Constructor.
 
 ~CGameObject ()
 Destructor.
 
void SetPhysicsBody (b2Body *b)
 Set pointer to physics world body.
 

Protected Attributes

GameObjectType m_nObjectType
 Object type.
 
b2Body * m_pBody
 Physics World body.
 

Friends

class CObjectManager
 
class CHeadsUpDisplay
 
class CObjectWorld
 
class CRenderWorld
 
class CMyContactListener
 

Detailed Description

The game object.

Game objects are responsible for remembering information about themselves, in particular, their representations in Render World and Physics World.

Constructor & Destructor Documentation

CGameObject::CGameObject ( GameObjectType  objecttype)

Constructor.

Constructor for a game object.

Parameters
objecttypeObject type.
CGameObject::~CGameObject ( )

Destructor.

Destructor for a game object. It takes care of destroying the object's body in Physics World.

Member Function Documentation

void CGameObject::SetPhysicsBody ( b2Body *  b)

Set pointer to physics world body.

Set the physics body pointer (from Physics World) of the game object.

Parameters
bPointer to the physics body.