The Object Manager.
More...
#include <ObjectManager.h>
|
|
std::string | m_strSnarky |
| | A snarky comment.
|
| |
|
std::vector< CObject * > | m_stdList |
| | Object list.
|
| |
|
Vector2 | m_vSize |
| | Width and height of Render World.
|
| |
|
b2Body * | m_pBody = nullptr |
| | World body.
|
| |
|
bool | m_bShuttingDown = false |
| | Are we shutting down?
|
| |
|
UINT | m_nNumCurrent = 0 |
| | Number of characters in the current word.
|
| |
|
|
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.
|
| |
An abstract representation of the objects in the game.
◆ AnimateJointExplosion()
| bool CObjectManager::AnimateJointExplosion |
( |
CObject * | p | ) |
|
|
private |
Animate the explosion of a joint using the particle engine and vector field.
- Parameters
-
- Returns
- true if the object has a joint, false otherwise.
◆ Clear()
| void CObjectManager::Clear |
( |
| ) |
|
Reset back to initial conditions. This involves deleting all of the CObject instances pointed to by the object list, then clearing the object list.
◆ CreateObject()
Create new object.
Create an object of a specified type, enter it into the object list, and return a pointer to it.
- Parameters
-
- Returns
- Pointer to the object created.
◆ CreateRandomWord()
| void CObjectManager::CreateRandomWord |
( |
| ) |
|
Create a word that reads "red", "green", or "blue" pseudorandomly, to be rendered in red, green, or blue chosen pseudorandomly. The initial position of the word is pseudorandmly offset a small amount from the window center line, just above the window so that it is initially out of sight.
◆ CreateWord()
| void CObjectManager::CreateWord |
( |
const b2Vec2 & | pos, |
|
|
char * | txt, |
|
|
float | s, |
|
|
eWordColor | clr ) |
|
private |
- Parameters
-
| pos | Position in Physics World. |
| txt | Word in text format, zero terminated. |
| s | Scale. |
| clr | Color that text is to be rendered in. |
◆ CreateWorldEdges()
| void CObjectManager::CreateWorldEdges |
( |
| ) |
|
Create world edges in Physics World. Place Box2D edge shapes in the Physics World in places that correspond to the top, bottom, right, and left edges of the screen in Render World. The left and right edges continue upwards for a distance. There is no top to the world.
◆ DeactivateCurrent()
| void CObjectManager::DeactivateCurrent |
( |
| ) |
|
Make the current word's color eWordColor::Black.
◆ Draw()
| void CObjectManager::Draw |
( |
| ) |
|
Draw the game objects using Painter's Algorithm:eSprite::Background, then the objects in the object list, then the particles in the particle engine.
◆ DrawGameText()
| void CObjectManager::DrawGameText |
( |
| ) |
|
Draw game text appropriate to the game state, including the countdown timer.
◆ DrawScore()
| void CObjectManager::DrawScore |
( |
Sage::CSpriteDesc2D & | d, |
|
|
int | n ) |
|
private |
Draw a single score. It is assumed that the score is greater than -100 and less than or equal to 100. Bad things happen otherwise.
- Parameters
-
| d | [in, out] Sprite descriptor. |
| n | Score. |
◆ DrawScores()
| void CObjectManager::DrawScores |
( |
| ) |
|
Draw scores to the window, hopefully over the top of the dashboard, which we assume has been drawn already.
◆ EmitParticle()
| void CObjectManager::EmitParticle |
( |
const Sage::CParticleDesc2D & | d | ) |
|
Create a particle using the front particle engine. This is a public member function because the contact listener needs to call it.
- Parameters
-
◆ EmitSmoke()
| void CObjectManager::EmitSmoke |
( |
const Vector2 & | pos, |
|
|
const Vector2 & | vel ) |
|
private |
Create a smoke particle using the front particle engine.
- Parameters
-
| pos | Position in Render World coordinates. |
| vel | Velocity in Render World units. |
◆ EmitSpark()
| void CObjectManager::EmitSpark |
( |
const Vector2 & | pos, |
|
|
const Vector2 & | vel ) |
|
private |
Create a spark particle using the front particle engine.
- Parameters
-
| pos | Position in Render World coordinates. |
| vel | Velocity in Render World units. |
◆ ExplodeOldLetters()
| void CObjectManager::ExplodeOldLetters |
( |
| ) |
|
|
private |
Explode any individuals letters left over from old words.
◆ ExplodeOldWords()
| void CObjectManager::ExplodeOldWords |
( |
| ) |
|
|
private |
Find all objects in the object list that are not eWordColor::Gray and are older than WORD_EXPLODE_DELAY and trigger a joint explosion if they are in a joint.
◆ GetCurrentHt()
| float CObjectManager::GetCurrentHt |
( |
| ) |
|
Get the height of the current word, which is defined to be the average height of the characters in it.
- Returns
- Average height of current word in Render World units.
◆ GetCurrentPos()
| Vector2 CObjectManager::GetCurrentPos |
( |
| ) |
|
Get the position of the current word in Render World units. This is obtained by averaging the positions of the letters in it.
- Returns
- Position of the current word in Render WOrld coordinates.
◆ GetSize()
| const size_t CObjectManager::GetSize |
( |
| ) |
const |
Reader function for number of objects in the object list.
- Returns
- Number of objects in object list.
◆ LoadSnideComment()
| void CObjectManager::LoadSnideComment |
( |
| ) |
|
|
private |
Load a snide comment based on score achieved into the character buffers.
◆ MakeAllExplode()
| void CObjectManager::MakeAllExplode |
( |
| ) |
|
Make all words explode by resetting their birth times to be close to the current time.
◆ MakeCurrentExplode()
| void CObjectManager::MakeCurrentExplode |
( |
| ) |
|
Make the current word explode by resetting its birth time to be close to the current time.
◆ ProcessShutdown()
| void CObjectManager::ProcessShutdown |
( |
| ) |
|
Shutdown process to be called when all of the words have been presented to the player.
◆ StroopWatchesCount()
| void CObjectManager::StroopWatchesCount |
( |
| ) |
|
Make the Stroop caricature's eyes swivel towards the word count.
◆ Update()
| void CObjectManager::Update |
( |
| ) |
|
Update all of the objects in the object list, explode the old words, move the particles in the particle engine, and update the vector field and the Stroop animation.