Ned's Turkey Farm
A Simple 2.5D Side Scroller
Loading...
Searching...
No Matches
CObjectManager Class Reference

The object manager. More...

#include <ObjectManager.h>

Inheritance diagram for CObjectManager:
Collaboration diagram for CObjectManager:

Public Member Functions

 CObjectManager ()
 Constructor.
 
 ~CObjectManager ()
 Destructor.
 
CObjectCreate (eSprite, const Vector3 &)
 Create new object.
 
CObjectCreate (eSprite, CObject *)
 Create new object.
 
CObjectCreateStatic (eSprite, const Vector3 &)
 Create new object.
 
void Move ()
 Move all objects.
 
void Clear ()
 Clear.
 
void DrawBackground ()
 Draw background.
 
void GetRenderList (std::vector< Sage::CSpriteDesc3D > &)
 Get render list.
 
const UINT GetNumCrows () const
 
- Public Member Functions inherited from CCommon
float Wrap (float)
 Wrap horizontal distance.
 

Private Member Functions

void DrawBackground (Sage::CSpriteDesc3D &)
 Draw background.
 
void NarrowPhase (CObject *, CObject *)
 Narrow phase collision detection and response.
 
void CrowDeathFx (CObject *)
 Crow death effects.
 

Private Attributes

UINT m_nCrowCount = 0
 Number of live or dead crows.
 
Sage::CSpriteDesc3D m_cSkyDesc
 Sky descriptor.
 
Sage::CSpriteDesc3D m_cLinedSkyDesc
 Lined sky descriptor.
 
Sage::CSpriteDesc3D m_cGrndDesc
 Ground descriptor.
 
Sage::CParticleEngine3D * m_pParticleEngine = nullptr
 Pointer to a particle engine.
 

Additional Inherited Members

- Static Protected Attributes inherited from CCommon
static CRendererm_pRenderer = nullptr
 Pointer to the renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to the object manager.
 
static CPlaneObjectm_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.
 

Detailed Description

The object manager manages game objects.

Constructor & Destructor Documentation

◆ ~CObjectManager()

CObjectManager::~CObjectManager ( )

The destructor clears the object list, which destructs all of the objects in it.

Member Function Documentation

◆ Clear()

void CObjectManager::Clear ( )

Clear the object list and initialize the sky and ground descriptors.

Here is the caller graph for this function:

◆ Create() [1/2]

CObject * CObjectManager::Create ( eSprite t,
CObject * pObj )

Create an object at the same position and moving at the same velocity as another object, and append it to the object list.

Parameters
tSprite type.
pObjPointer to an existing object.
Returns
Pointer to the object created.
Here is the call graph for this function:

◆ Create() [2/2]

CObject * CObjectManager::Create ( eSprite t,
const Vector3 & pos )

Create an object and append it to the object list.

Parameters
tSprite type.
posInitial position.
Returns
Pointer to the object created.
Here is the caller graph for this function:

◆ CreateStatic()

CObject * CObjectManager::CreateStatic ( eSprite t,
const Vector3 & v )

Create a static object, that is, one whose position is fixed.

Parameters
tSprite type.
vInitial position.
Returns
Pointer to the object created.
Here is the caller graph for this function:

◆ CrowDeathFx()

void CObjectManager::CrowDeathFx ( CObject * p)
private

Particle effects for the crow death. An explosion. Feathers and body parts flying everywhere. Also sounds.

Parameters
pPointer to the crow. We need its position and velocity.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawBackground() [1/2]

void CObjectManager::DrawBackground ( )

Draw the sky and the ground.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawBackground() [2/2]

void CObjectManager::DrawBackground ( Sage::CSpriteDesc3D & sd)
private

Draw part of the background.

Parameters
sdSprite descriptor.
Here is the caller graph for this function:

◆ GetNumCrows()

const UINT CObjectManager::GetNumCrows ( ) const

Reader function for the number of crows.

Returns
Number of crows.
Here is the caller graph for this function:

◆ GetRenderList()

void CObjectManager::GetRenderList ( std::vector< Sage::CSpriteDesc3D > & renderlist)

Get the render list, which is an unordered vector of sprite descriptors. This function also handles world wrapping, which ensures that whan the camera switches from its leftmost extent to the rightmost extent, then a copy of the objects in its view frustum will also be drawn in the rightmost view frustum. This temporarily draws two copies of the objects in question, but this will be invisible during game play because one of the copies will always be out of the view frustum. You will, however, see them when the camera is pulled back and I apologize in advance for any confusion that this causes. Object positions are also changed at the point of world wrap, which may also cause confusion because this function primarily creates a render list.

Parameters
renderlist[IN, OUT] Render list.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Move()

void CObjectManager::Move ( )

Move all of the objects in the object list and perform broad phase collision detection and response.

Here is the caller graph for this function:

◆ NarrowPhase()

void CObjectManager::NarrowPhase ( CObject * p0,
CObject * p1 )
private

Perform collision detection and response for a pair of objects.

Parameters
p0Pointer to the first object.
p1Pointer to the second object.
Here is the call graph for this function: