![]() |
The Pinball Game
Ian Parberry's "Introduction to Game Physics"
|
The game object. More...
#include <Object.h>
Public Member Functions | |
CObject (CShape *, const CObjDesc &) | |
Constructor. | |
void | Update () |
Update object. | |
void | DrawOutline () |
Draw outline. More... | |
const CAabb2D & | GetAABB () const |
Get AABB. More... | |
CShape * | GetShape () const |
Get pointer to shape. More... | |
const eMotion | GetMotionType () const |
Get motion type. More... | |
Private Attributes | |
eSprite | m_eUnlitSprite = eSprite::Size |
Unlit sprite. | |
eSprite | m_eLitSprite = eSprite::Size |
Unlit sprite. | |
Vector2 | m_vSpriteOffset |
Sprite offset in local coordinates. | |
CShape * | m_pShape = nullptr |
Pointer to shape. | |
bool | m_bRecentHit = false |
Was hit recently. | |
float | m_fLastHitTime = 0 |
Time of last hit. | |
UINT | m_nScore = 0 |
Score for collision. | |
eSound | m_eSound = eSound::Size |
Collision sound. | |
Friends | |
class | CObjectManager |
Additional Inherited Members | |
![]() | |
static CRenderer * | m_pRenderer = nullptr |
Pointer to the renderer. | |
static CObjectManager * | m_pObjectManager = nullptr |
Pointer to the object manager. | |
static UINT | m_nMIterations = 4 |
Number of motion iterations. | |
static UINT | m_nCIterations = 1 |
Number of collision iterations. | |
static float | m_fFrequency = 60.0f*m_nMIterations |
Frequency, number of physics iterations per second. | |
static eDrawMode | m_eDrawMode = eDrawMode::Background |
Draw mode. | |
static bool | m_bBallInPlay = false |
Is there a ball currently in play? | |
static UINT | m_nScore = 0 |
Current score. | |
CObject is the abstract representation of an object.
void CObject::DrawOutline | ( | ) |
Draw only the outline of the object's shape. This is reasonably cheap for line segments but hideously expensive for circles and arcs because it laboriously constructs the curve by drawing very short lines. Ideally I should put it into the pixel shader but I can't be bothered. This is good enough for now.
const CAabb2D & CObject::GetAABB | ( | ) | const |
Reader function for the object's AABB. It gets this by querying the oblect's shape's AABB.
const eMotion CObject::GetMotionType | ( | ) | const |
Reader function for the object's motion type. It gets this by querying the object's shape's motion type.
CShape * CObject::GetShape | ( | ) | const |
Reader function for the object's shape.