The Stroop Test Game
Ian Parberry's "Introduction to Game Physics"
Public Member Functions | Private Attributes | List of all members
CStroop Class Reference

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

#include <Stroop.h>

Inheritance diagram for CStroop:
CCommon

Public Member Functions

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

Private Attributes

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 CRendererm_pRenderer = nullptr
 Pointer to the Renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to the Object Manager.
 
static LParticleEngine2D * 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 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.
 

Detailed Description

A caricature of John Ridley Stroop with swivelling eyeballs.

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.

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

◆ SetDesiredEyePos()

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

Set desired eye position.

Set the eye offset in a particular direction.

Parameters
vLook-at point.
mMagnitude of eyeball offset in the gaze direction

◆ Step()

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

Animation step.

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.