The LARC Game Engine
A Simple Game Engine from the Laboratory for Recreational Computing
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LBaseObjectManager< obj > Class Template Reference

The base object manager. More...

#include <BaseObjectManager.h>

Inheritance diagram for LBaseObjectManager< obj >:
LComponent LSettings

Public Member Functions

 LBaseObjectManager ()
 Constructor. More...
 
 ~LBaseObjectManager ()
 Destructor. More...
 
virtual void clear ()
 Reset to empty and delete all objects. More...
 
virtual void move ()
 Move all objects. More...
 
virtual void draw ()
 Draw all objects. More...
 

Protected Member Functions

virtual void BroadPhase ()
 Broad phase. More...
 
virtual void NarrowPhase (obj *, obj *)
 Narrow phase. More...
 
virtual void CullDeadObjects ()
 Cull dead objects. More...
 

Protected Attributes

std::list< obj * > m_stdObjectList
 The object list.
 

Additional Inherited Members

- Static Protected Attributes inherited from LComponent
static LTimerm_pTimer = &cTimer
 Pointer to a timer. More...
 
static LRandomm_pRandom = &cRandom
 Pointer to a PRNG. More...
 
static LKeyboardm_pKeyboard = &cKeyboard
 Pointer to a keyboard handler. More...
 
static LXBoxControllerm_pController = &cController
 Pointer to a XBox controller. More...
 
static LSoundm_pAudio = &cAudio
 Pointer to an audio player. More...
 
- Static Protected Attributes inherited from LSettings
static char m_szName [MAX_PATH]
 Name of this game.
 
static int m_nWinWidth = 0
 Window width in pixels.
 
static int m_nWinHeight = 0
 Window height in pixels.
 
static Vector2 m_vWinCenter = Vector2::Zero
 Window center.
 

Detailed Description

template<class obj>
class LBaseObjectManager< obj >

A list of game objects with some basic management functions and broad phase collision detection and response. This class is templated so that it can be used to manage game objects declared in individual games. Your game should instantiate it with your game object class, which must be derived from LBaseGameObject.

Template Parameters
objObject class.

Constructor & Destructor Documentation

◆ LBaseObjectManager()

template<class obj >
LBaseObjectManager< obj >::LBaseObjectManager

Default constructor, which does nothing.

Template Parameters
objObject class.

◆ ~LBaseObjectManager()

template<class obj >
LBaseObjectManager< obj >::~LBaseObjectManager

Destructor deletes all of the objects in the object list.

Template Parameters
objObject class.

Member Function Documentation

◆ BroadPhase()

template<class obj >
void LBaseObjectManager< obj >::BroadPhase
protectedvirtual

Perform collision detection and response for all objects with another object, making sure that each pair of objects is processed only once.

Template Parameters
objObject class.

◆ clear()

template<class obj >
void LBaseObjectManager< obj >::clear
virtual

Delete all of the object instances pointed to by the object list, then clear the object list of all pointers so that the object list is empty.

Template Parameters
objObject class.

◆ CullDeadObjects()

template<class obj >
void LBaseObjectManager< obj >::CullDeadObjects
protectedvirtual

Iterate through the objects and check whether each one is ready to delete. If so, then delete it and remove its pointer from the object list.

Template Parameters
objObject class.

◆ draw()

template<class obj >
void LBaseObjectManager< obj >::draw
virtual

Move all objects by iterating through all objects in the object list and calling their draw functions.

Template Parameters
objObject class.

◆ move()

template<class obj >
void LBaseObjectManager< obj >::move
virtual

Move all objects by iterating through all objects in the object list and calling their move functions. Perform broad phase collision detection and response, then delete any dead objects from the object list.

Template Parameters
objObject class.

◆ NarrowPhase()

template<class obj >
void LBaseObjectManager< obj >::NarrowPhase ( obj *  p0,
obj *  p1 
)
protectedvirtual

Perform collision detection and response for a pair of objects. This function is a stub.

Parameters
p0Pointer to the first object.
p1Pointer to the second object.
Template Parameters
objObject class.