![]() |
Box2D Joint Toy
Game Physics with a 2D Physics Engine
|
The game object. More...
#include <Object.h>


Public Member Functions | |
| CObject (eSprite, b2Body *) | |
| Constructor. | |
| ~CObject () | |
| Destructor. | |
| void | Draw () const |
| Draw object in Render World. | |
| const Vector2 | GetPos () const |
| Get position in Render World. | |
| const eSprite | GetSpriteType () const |
| Get sprite type. | |
| b2Body * | GetBody () |
| Get body pointer. | |
Private Attributes | |
| eSprite | m_eSpriteType = eSprite::None |
| 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 CBox2DRenderer * | m_pRenderer = nullptr |
| Pointer to the renderer. | |
| static CLevel * | m_pLevel = nullptr |
| Pointer to current level. | |
| static eLevel | m_eCurLevel = eLevel::Windmill |
| Current level. | |
| static eDrawMode | m_eDrawMode = eDrawMode::Sprites |
| Draw mode. | |
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 ) |
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.
| void CObject::Draw | ( | ) | const |
Draw in Render World. Position and orientation must be gotten from Physics World.

| b2Body * CObject::GetBody | ( | ) |
Reader function for the body pointer.

| const Vector2 CObject::GetPos | ( | ) | const |
Reader function for position.

| const eSprite CObject::GetSpriteType | ( | ) | const |
Reader function for the sprite type.
