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


Public Member Functions | |
| ~CGame () | |
| Destructor. | |
| void | Initialize () |
| Initialize the game. | |
| void | ProcessFrame () |
| Process an animation frame. | |
| void | Release () |
| Release the renderer. | |
Private Member Functions | |
| void | LoadSprites () |
| Start loading sprites. | |
| void | LoadSounds () |
| Load sounds. | |
| void | BeginGame () |
| Begin playing the game. | |
| void | ProcessKey (eWordColor, char) |
| Process a keyboard key. | |
| void | KeyboardHandler () |
| The keyboard handler. | |
| void | RenderFrame () |
| Render an animation frame. | |
| void | ProcessState () |
| Process game state. | |
Private Attributes | |
| CMyListener | m_cMCL |
| My contact listener. | |
| float | m_fTime = 0.0f |
| Time counter. | |
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 |
Clear any old objects out of the Object Manager and create the edges of the game world, which correspond to the edges of the window.


| void CGame::Initialize | ( | ) |
Initialize the renderer and the object manager, load images and sounds, start the timer, and begin the game.


|
private |
Respond to a user keystroke.


|
private |
Load the sounds for this game.

|
private |
Load the sprites for this game.

| void CGame::ProcessFrame | ( | ) |
Handle keyboard input, move the game objects and render them in their new positions and orientations. Notify the timer of the start and end of the frame so that it can calculate frame time.


|
private |
Process a color key hit. Play the appropriate sound and make the word explode if the player has hit the correct key, also add an increment to the relevant score category.
| clr | Word color. |
| c | Key that the player pressed. |


|
private |
Take action appropriate to the current game state.


| void CGame::Release | ( | ) |
Release all of the DirectX12 objects by deleting the renderer.

|
private |
Ask the Object Manager to draw the game objects. RenderWorld is notified of the start and end of the frame so that it can let Direct3D do its pipelining jiggery-pokery.

