The Stroop Test Game
Game Physics with a 2D Physics Engine
Loading...
Searching...
No Matches
CStroop Class Reference

A caricature of John Ridley Stroop with swivelling eyeballs. More...

#include <Stroop.h>

Inheritance diagram for CStroop:
Collaboration diagram for CStroop:

Public Member Functions

 CStroop ()
 Constructor.
 
void SetDesiredEyePos (const Vector2 &, float)
 Set desired eye position.
 
void Draw ()
 Draw.
 
void Step (eGameState, const Vector2 &)
 Animation step.
 

Private Attributes

b2Body * m_pBody = nullptr
 Physics World body.
 
Vector2 m_vPos
 Face position.
 
Vector2 m_vCurEyePos
 Current eye position.
 
Vector2 m_vDesiredEyePos
 Desired eye position.
 
Vector2 m_vNeutralEyePos
 Neutral eye position.
 
float m_fTwitchDelay = 0.0f
 Eye twitch delay.
 
float m_fEyeSpeed = 0.0f
 Eye swivelling speed.
 

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 CObjectManagerm_pObjectManager = nullptr
 Pointer to the object manager.
 
static Sage::CParticleEngine2D * m_pParticleEngine = nullptr
 Pointer to particle engine.

 
static CVectorFieldm_pVectorField = nullptr
 Pointer to a vector field.
 
static CBubbleEnginem_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 CStroopm_pStroop = nullptr
 Pointer to Stroop caricature.
 
static eDrawMode m_eDrawMode = eDrawMode::Sprites
 Draw mode.
 

Detailed Description

John Ridley Stroop swivels his eyes in a given direction using relaxation to make the swivelling smooth.

Member Function Documentation

◆ Draw()

void CStroop::Draw ( )

Draw JRS with his eyeballs drawn before his irises drawn before his face so that everything looks right.

Here is the caller graph for this function:

◆ SetDesiredEyePos()

void CStroop::SetDesiredEyePos ( const Vector2 & v,
float m )

Set the eye offset in a particular direction.

Parameters
vLook-at point.
mMagnitude of eyeball offset in the gaze direction
Here is the caller graph for this function:

◆ Step()

void CStroop::Step ( eGameState state,
const Vector2 & v )

Perform an animation step. Stroop's gaze will shift to a new direction depending on game state. During the countdown it will swivel to the center of the windoe, diregarding the gaze parameter v. When playing it will swivel towards v unless v is the zero vector, in which case it will swivel towards the neutral gaze, which is straight forwards. In the beginning game state his eyes will twitch pseudorandomly. In the scoring state his eyes will swivel downwards towards where the total score is displayed in the score bar.

Parameters
stateCurrent game state.
vGaze direction.
Here is the call graph for this function:
Here is the caller graph for this function: