![]() |
The Stroop Test Game
Ian Parberry's "Introduction to Game Physics"
|
The game class. More...
#include <Game.h>
Public Member Functions | |
~CGame () | |
Destructor. | |
void | Initialize () |
Initialize the game. More... | |
void | ProcessFrame () |
Process an animation frame. More... | |
void | Release () |
Release the renderer. More... | |
Private Member Functions | |
void | LoadSounds () |
Load sounds. More... | |
void | BeginGame () |
Begin playing the game. More... | |
void | ProcessKey (eWordColor, char) |
Process a keyboard key. More... | |
void | KeyboardHandler () |
The keyboard handler. More... | |
void | RenderFrame () |
Render an animation frame. More... | |
Private Attributes | |
CMyListener | m_cMCL |
My contact listener. | |
float | m_fTime = 0.0f |
Time counter. | |
Additional Inherited Members | |
![]() | |
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. | |
The game class.
|
private |
Begin playing the game.
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 game.
Initialize the renderer and the object manager, load images and sounds, start the timer, and begin the game.
|
private |
The keyboard handler.
Respond to a user keystroke and report back if the user hit the Esc key, indicating that we should shut down.
|
private |
Load sounds.
Initialize the audio player and load game sounds.
void CGame::ProcessFrame | ( | ) |
Process an animation frame.
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 keyboard key.
Process a color key hit. Play appropriate sound, make the word explode if it's the correct key, add increment to the relevant score.
void CGame::Release | ( | ) |
Release the renderer.
Release all of the DirectX12 objects by deleting the renderer.
|
private |
Render an animation frame.
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.