![]() |
The Stroop Test Game
Ian Parberry's "Introduction to Game Physics"
|
The game object. More...
#include <Object.h>
Public Member Functions | |
| CObject (const CObjDesc &) | |
| Constructor. More... | |
| ~CObject () | |
| Destructor. | |
| void | SetPhysicsJoint (b2Joint *) |
| Set pointer to physics world joint. More... | |
| const bool | isCurrent () const |
| Is in the current word. More... | |
| void | DeliverImpulse (const Vector2 &) |
| Deliver random impulse. More... | |
| const Vector2 | GetPos () const |
| const Vector2 | GetVel () const |
| < Get position. More... | |
| const eSprite | GetSpriteType () const |
| < Get velocity. More... | |
| const void | GetSpriteDesc (LSpriteDesc2D &) const |
| Get sprite descriptor. More... | |
| float | GetBirthTime () |
| Get birth time. More... | |
| void | SetBirthTime (float) |
| sGet birth time. More... | |
| const eWordColor | GetColor () const |
| Get color. More... | |
| void | SetColor (eWordColor) |
| Set color. More... | |
| bool | GetJointInfo (Vector2 &, Vector2 &) |
| Get joint position and velocity. More... | |
| void | DestroyJoint () |
| Destroy joint. More... | |
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 LParticleEngine2D * | m_pParticleEngine = nullptr |
| Pointer to particle engine. | |
| static CVectorField * | m_pVectorField = nullptr |
| Pointer to a vector field. | |
| static CBubbleEngine * | m_pBubbleEngine = nullptr |
| Pointer to a bubble engine. | |
| static bool | m_bDrawVectors = false |
| Do we draw the vector field? | |
| static bool | m_bDrawPressure = false |
| Do we draw the pressures from the vector field? | |
| static bool | m_bDrawPoints = false |
| Do we draw the points from the vector field? | |
| static bool | m_bDrawParticles = true |
| Do we draw particles? | |
| static eWordColor | m_eCurColor = eWordColor::Black |
| Color of the current word. | |
| static bool | m_bTried = false |
| Whether the player has tried on the current word. | |
| static UINT | m_nWordCnt = INITIAL_WORDCOUNT |
| Number of words. | |
| static UINT | m_nScore = 0 |
| Current score, can be negatice. | |
| static UINT | m_nDelivered = 0 |
| Number of words delivered. | |
| static UINT | m_nExcellent = 0 |
| Number of words scored as excellent. | |
| static UINT | m_nGood = 0 |
| Number of words scored as excellent. | |
| static UINT | m_nFair = 0 |
| Number of words scored as excellent. | |
| static UINT | m_nFailed = 0 |
| Number of words the player got wrong. | |
| static UINT | m_nMissed = 0 |
| Number of words the player did not attempt. | |
| static eGameState | m_eGameState = eGameState::Instructions |
| Current game state. | |
| static UINT | m_nCntdownNum = 0 |
| The number we are displaying in the countdown. | |
Private Attributes inherited from CObjDesc | |
| eSprite | m_eSpriteType = eSprite::Size |
| Sprite type. | |
| b2Body * | m_pBody = nullptr |
| Physics World body. | |
| b2Joint * | m_pJoint = nullptr |
| Joint in Physics World. | |
| eWordColor | m_eColor = eWordColor::Gray |
| Sprite color;. | |
| float | m_fScale = 1.0f |
| Image scale. | |
| float | m_fBirthTime = 0 |
| Time of creation. | |
The game object.
Game objects are responsible for remembering information about themselves, in particular, their representations in Render World and Physics World.
| CObject::CObject | ( | const CObjDesc & | d | ) |
Constructor.
Constructor for a game object.
| d | Object descriptor. |
| void CObject::DeliverImpulse | ( | const Vector2 & | v | ) |
Deliver random impulse.
Deliver an impulse, assuming this object has a body in Physics World.
| v | Impulse vector in Render World units. |
| void CObject::DestroyJoint | ( | ) |
Destroy joint.
Destroy joint, if this object has one.
| float CObject::GetBirthTime | ( | ) |
Get birth time.
Reader function for the birth time.
| const eWordColor CObject::GetColor | ( | ) | const |
Get color.
Reader function for the color.
| bool CObject::GetJointInfo | ( | Vector2 & | p, |
| Vector2 & | v | ||
| ) |
Get joint position and velocity.
Get the joint's position and velocity in Render World. The values of the call-by-reference parameters are not changed if this object is bodiless.
| p | [OUT] Joint position in Render World coordinates. |
| v | [OUT] Joint velocity in Render World units. |
| const Vector2 CObject::GetPos | ( | ) | const |
Reader function for position.
| const void CObject::GetSpriteDesc | ( | LSpriteDesc2D & | d | ) | const |
Get sprite descriptor.
Construct a sprite descriptor.
| d | [IN, OUT] Sprite descriptor. |
| const eSprite CObject::GetSpriteType | ( | ) | const |
< Get velocity.
Get sprite type.
Reader function for sprite type.
| const Vector2 CObject::GetVel | ( | ) | const |
< Get position.
Reader function for velocity.
| const bool CObject::isCurrent | ( | ) | const |
Is in the current word.
A letter is part of the current word when its color is either red, green, or blue.
| void CObject::SetBirthTime | ( | float | t | ) |
sGet birth time.
| t | Birth time in seconds. |
| void CObject::SetColor | ( | eWordColor | clr | ) |
Set color.
| clr | Color |
| void CObject::SetPhysicsJoint | ( | b2Joint * | j | ) |
Set pointer to physics world joint.
Set the physics joint pointer (from Physics World) of the game object.
| j | Pointer to the physics joint. |