![]() |
The Box2D Blank Game
A Blank 2D Game with Box2D and a Contact Listener for Sounds
|
The game object. More...
#include <Object.h>
Public Member Functions | |
CObject (eSprite, b2Body *) | |
Constructor. More... | |
~CObject () | |
Destructor. More... | |
void | Update () |
Update from Physics Engine. | |
const eSprite | GetSpriteType () const |
Get sprite type. More... | |
const Vector2 | GetPos () const |
Get position in renderer coordinates. More... | |
const float | GetSpeed () const |
Get speed in renderer units. More... | |
Private Attributes | |
b2Body * | m_pBody = nullptr |
Physics World body. | |
Additional Inherited Members | |
![]() | |
static b2World * | m_pPhysicsWorld = nullptr |
Pointer to Box2D Physics World. | |
static CRenderer * | m_pRenderer = nullptr |
Pointer to the Renderer. | |
static CObjectManager * | m_pObjectManager = nullptr |
Pointer to the Object Manager. | |
static LParticleEngine2D * | m_pParticleEngine = nullptr |
Pointer to particle engine. | |
Game objects are responsible for remembering information about themselves, in particular, their representations in the Renderer and Physics World.
CObject::CObject | ( | eSprite | t, |
b2Body * | b | ||
) |
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.
t | Sprite type. |
b | Pointer to Physics World body. |
CObject::~CObject | ( | ) |
This destructor assumes that Box2D hasn't been shut down yet.
const Vector2 CObject::GetPos | ( | ) | const |
Reader function for position in Render World.
const float CObject::GetSpeed | ( | ) | const |
Reader function for speed in Render World.
const eSprite CObject::GetSpriteType | ( | ) | const |
Reader function for sprite type.