![]() |
Ned's Turkey Farm
A Simple 2.5D Side Scroller
|
The common variables class. More...
#include <Common.h>


Public Member Functions | |
| float | Wrap (float) |
| Wrap horizontal distance. | |
Static Protected Attributes | |
| static CRenderer * | m_pRenderer = nullptr |
| Pointer to the renderer. | |
| static CObjectManager * | m_pObjectManager = nullptr |
| Pointer to the object manager. | |
| static CPlaneObject * | m_pPlayer = nullptr |
| Pointer to player character. | |
| static float | m_fWorldScale = 2.0f |
| World scale. | |
| static Vector3 | m_vCellSize = Vector3::Zero |
| Cell size. | |
| static UINT | m_nNumCells = 3 |
| Number of cells. | |
| static float | m_fWorldWidth = 0.0f |
| World width. | |
| static eDrawMode | m_eDrawMode = eDrawMode::Playing |
| Draw mode. | |
| static eGameState | m_eGameState = eGameState::Loading |
| Game state. | |
CCommon is a singleton class that encapsulates things that are common to different game components, including game state variables. Making it a singleton class means that we can avoid passing its member variables around as parameters, which makes the code minisculely faster, and more importantly, makes the code more readable by reducing function clutter.
| float CCommon::Wrap | ( | float | x | ) |
Wrap a horizontal distance to plus or minus half the world width. This will be used to normalize the distances from various objects to the plane.
| x | Horizontal distance. |
