Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

DiscManager Class Reference

Disc Manager singleton class. More...

#include <DiscManager.h>

List of all members.

Public Member Functions

void CreateDisc ()
void UpdateDiscsSingleplayer (double deltaTime, Grid *grid)
CIwFVec2 UpdateDiscsMultiplayer (double deltaTime, Grid *grid, bool myTurn, CIwFVec2 pos)
void CheckGridExteriorCollisions (Disc *disc, Grid *grid, double deltaTime, bool &colliderCollision)
void CheckGridInteriorCollisions (Disc *disc, Grid *grid, double deltaTime, bool &discCollision)
void DrawDiscs (double deltaTime)
bool CanCreateDisc ()
void DeleteDiscs ()
int GetCurrentDiscColour ()
bool GetCurrentDiscLaunched ()
bool GetCurrentDiscHasLanded ()
bool GetCurrentDiscHasTarget ()
void LaunchCurrentDisc (CIwFVec2 velocity)

Static Public Member Functions

static DiscManagerInstance ()
static void DestroyInstance ()

Protected Member Functions

 DiscManager ()
 ~DiscManager ()

Protected Attributes

std::vector< Disc * > m_discs
 Vector of discs being used in the current match.
float m_discSpawnX
 X spawn position of the disc.
float m_discSpawnY
 XY spawn position of the disc.

Static Protected Attributes

static DiscManagerm_instance = 0
 Static DiscManager instance which will be returned when the singleton's Instance() method is called.

Detailed Description

Disc Manager singleton class.

Returns an instance of a disc manager, which can be used to update, create, and draw discs.


Constructor & Destructor Documentation

DiscManager::DiscManager (  )  [protected]

Constructor.

Creates a DiscManager object. Protected as this is a singleton, which is created when Instance() is first called.

DiscManager::~DiscManager (  )  [protected]

Destructor.

Destroys the DiscManager object. Protected as this is a singleton, which should instead be deleted using DestroyInstance().


Member Function Documentation

bool DiscManager::CanCreateDisc (  ) 

Can a new disc be created?

Checks if the previous disc has landed. If it has, a new one can be created.

Returns:
bool Has previous disc landed?
void DiscManager::CheckGridExteriorCollisions ( Disc disc,
Grid grid,
double  deltaTime,
bool &  colliderCollision 
)

Check outer grid collisions.

Has a disc collided with the outside of the grid?

Parameters:
[in] disc The disc to be checked.
[in] grid The grid.
[in] deltaTime Time since the last update.
[out] colliderCollision Has the disc hit a top collider? Used to check for stuck discs.
void DiscManager::CheckGridInteriorCollisions ( Disc disc,
Grid grid,
double  deltaTime,
bool &  discCollision 
)

Check inner grid collisions.

Has a disc collided with the inside of the grid?

Parameters:
[in] disc The disc to be checked.
[in] grid The grid.
[in] deltaTime Time since the last update.
[out] discCollision Has the disc hit the top of a column? Used to check for stuck discs.
void DiscManager::CreateDisc (  ) 

Create a disc.

Create a new disc. Alternates colours between red and yellow.

void DiscManager::DeleteDiscs (  ) 

Delete all discs.

Deletes all discs currently in the disc vector and releases all memory .

void DiscManager::DestroyInstance (  )  [static]

Delete this singleton.

Safely deletes the singleton instance and releases any memory it was using.

void DiscManager::DrawDiscs ( double  deltaTime  ) 

Draw discs.

Draw all active discs.

Parameters:
[in] deltaTime Time since the last update.
int DiscManager::GetCurrentDiscColour (  ) 

Get current colour.

Get the colour of the current disc.

Returns:
int representing the disc colour.
bool DiscManager::GetCurrentDiscHasLanded (  ) 

Get current has landed.

Get whether the current disc has landed in the grid.

Returns:
bool has the disc landed?
bool DiscManager::GetCurrentDiscHasTarget (  ) 

Get current target.

Get whether the current disc has been assigned a target yet. Used for multiplayer updates.

Returns:
bool has got target?
bool DiscManager::GetCurrentDiscLaunched (  ) 

Get current has launched.

Has the current disc been launched yet?

Returns:
bool has been launched.
DiscManager * DiscManager::Instance (  )  [static]

Return the static DiscManager instance.

Returns a static instance of DiscManager. If no DiscManager instance exists, one is created.

Returns:
Static DiscManager instance.
void DiscManager::LaunchCurrentDisc ( CIwFVec2  velocity  ) 

Launch disc.

Launches the current disc.

Parameters:
[in] velocity Initial launch velocity.
CIwFVec2 DiscManager::UpdateDiscsMultiplayer ( double  deltaTime,
Grid grid,
bool  myTurn,
CIwFVec2  pos 
)

Multiplayer update.

Update the discs for a multiplayer game.

Parameters:
[in] deltaTime Time since the last update.
[in] grid Game grid.
[in] myTurn Is it my turn?
[in] pos Position of the other player's disc (if it is their turn).
Returns:
Vector2 position to be sent to opponent.
void DiscManager::UpdateDiscsSingleplayer ( double  deltaTime,
Grid grid 
)

Singleplayer update.

Update the discs for a singleplayer game.

Parameters:
[in] deltaTime Time since the last update.
[in] grid Game grid.

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations