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


Public Member Functions | |
| CObject (const CObjDesc &) | |
| Constructor. | |
| ~CObject () | |
| Destructor. | |
| void | Draw () |
| Draw object. | |
| void | SetPhysicsJoint (b2Joint *) |
| Set pointer to physics world joint. | |
| const bool | isCurrent () const |
| Is in the current word. | |
| void | DeliverImpulse (const Vector2 &) |
| Deliver random impulse. | |
| const Vector2 | GetPos () const |
| const Vector2 | GetVel () const |
| < Get position. | |
| const eSprite | GetSpriteType () const |
| < Get velocity. | |
| float | GetBirthTime () |
| Get birth time. | |
| void | SetBirthTime (float) |
| sGet birth time. | |
| const eWordColor | GetColor () const |
| Get color. | |
| void | SetColor (eWordColor) |
| Set color. | |
| bool | GetJointInfo (Vector2 &, Vector2 &) |
| Get joint position and velocity. | |
| void | DestroyJoint () |
| Destroy joint. | |
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 renderer. | |
| static CObjectManager * | m_pObjectManager = nullptr |
| Pointer to the object manager. | |
| static Sage::CParticleEngine2D * | 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 int | m_nScore = 0 |
| Current score, can be negative. | |
| static int | m_nDelivered = 0 |
| Number of words delivered. | |
| static int | m_nExcellent = 0 |
| Number of words scored as excellent. | |
| static int | m_nGood = 0 |
| Number of words scored as excellent. | |
| static int | m_nFair = 0 |
| Number of words scored as excellent. | |
| static int | m_nFailed = 0 |
| Number of words the player got wrong. | |
| static int | m_nMissed = 0 |
| Number of words the player did not attempt. | |
| static eGameState | m_eGameState = eGameState::Loading |
| Current game state. | |
| static UINT | m_nCntdownNum = 0 |
| The number we are displaying in the countdown. | |
| static CStroop * | m_pStroop = nullptr |
| Pointer to Stroop caricature. | |
| static eDrawMode | m_eDrawMode = eDrawMode::Sprites |
| Draw mode. | |
Private Attributes inherited from CObjDesc | |
| eSprite | m_eSpriteType = eSprite::Point |
| 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. | |
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 for a game object.
| d | Object descriptor. |
| void CObject::DeliverImpulse | ( | const Vector2 & | v | ) |
Deliver an impulse, assuming this object has a body in Physics World.
| v | Impulse vector in Render World units. |

| void CObject::DestroyJoint | ( | ) |
Destroy joint, if this object has one.
| void CObject::Draw | ( | ) |
Draw the object using its position and orientation in Physics World.

| float CObject::GetBirthTime | ( | ) |
Reader function for the birth time.

| const eWordColor CObject::GetColor | ( | ) | const |
Reader function for the color.

| bool CObject::GetJointInfo | ( | Vector2 & | p, |
| Vector2 & | v ) |
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 eSprite CObject::GetSpriteType | ( | ) | const |
Get sprite type.
Reader function for sprite type.

| const Vector2 CObject::GetVel | ( | ) | const |
Reader function for velocity.


| const bool CObject::isCurrent | ( | ) | const |
A letter is part of the current word when its color is either red, green, or blue.

| void CObject::SetBirthTime | ( | float | t | ) |
| t | Birth time in seconds. |
| void CObject::SetColor | ( | eWordColor | clr | ) |
| clr | Color |
| void CObject::SetPhysicsJoint | ( | b2Joint * | j | ) |
Set the physics joint pointer (from Physics World) of the game object.
| j | Pointer to the physics joint. |