![]() |
Box2D Joint Toy
Ian Parberry's "Introduction to Game Physics"
|
The game object. More...
#include <Object.h>
Public Member Functions | |
| CObject (eSprite, b2Body *) | |
| Constructor. More... | |
| ~CObject () | |
| Destructor. More... | |
| void | draw () |
| Draw object in Render World. More... | |
| const Vector2 | GetPos () const |
| Get position in Render World. More... | |
| const eSprite | GetSpriteType () const |
| Get sprite type. 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 CRenderer * | m_pRenderer = nullptr |
| Pointer to the renderer. | |
| static CObjectManager * | m_pObjectManager = nullptr |
| Pointer to the object manager. | |
| static CWindmill * | m_pWindmill = nullptr |
| Pointer to windmill. | |
| static CGear * | m_pGear = nullptr |
| Pointer to gear system. | |
| static CNautilusGear * | m_pNautilusGear = nullptr |
| Pointer to Nautilus gear system. | |
| static CRackAndPinion * | m_pRackAndPinion = nullptr |
| Pointer to rack-and-pinion. | |
| static CCar * | m_pCar = nullptr |
| Pointer to car. | |
| static CRamp * | m_pRamp = nullptr |
| Pointer to ramp. | |
| static CNewtonsCradle * | m_pNewtonsCradle = nullptr |
| Pointer to Newton's Cradle. | |
| static CPulley * | m_pPulley = nullptr |
| Pointer to pulley system. | |
| static eLevel | m_eCurLevel = eLevel::Windmill |
| Current level. | |
The game object.
Game objects are responsible for remembering information about themselves, in particular, their representations in Render World and Physics World.
| 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.
| t | Sprite type. |
| b | Pointer to Physics World body. |
| CObject::~CObject | ( | ) |
Destructor.
This destructor assumes that Box2D hasn't been shut down yet.
| void CObject::draw | ( | ) |
Draw object in Render World.
Draw in Render World. Position and orientation must be gotten from Physics World.
| const Vector2 CObject::GetPos | ( | ) | const |
Get position in Render World.
< Reader function for position.
| const eSprite CObject::GetSpriteType | ( | ) | const |
Get sprite type.
< Reader function for the sprite type.