Module
Public Member Functions | List of all members
Module::ModuleGame Class Reference

#include <ModuleGame.hpp>

Public Member Functions

 ModuleGame ()
 
void attachGraphicsInterface (GraphicsInterface *newGraphics)
 
void attachAudioInterface (AudioInterface *newAudio)
 
void attachThreadingInterface (ThreadingInterface *newThreading)
 
void startThread (ThreadObject *obj)
 
void start ()
 
bool isRunning ()
 
GameObjectcreateGameObject ()
 
Book< GameObject >::size_type numObjects () const
 
GameObjectgetGameObject (Book< GameObject >::size_type index)
 
const GameObjectgetGameObject (Book< GameObject >::size_type index) const
 
MutexcreateMutex ()
 
void setMesh (GameObject *obj, Mesh *mesh)
 
unsigned long getMilliseconds ()
 

Detailed Description

The main class of Module. The ModuleGame class represents the core of Module. Its functionality ties together that of the different interfaces. End users of Module (game developers) control Module through this class and not by accessing interfaces, as those are meant to be abstracted away from users. Setting up a ModuleGame instance should be the first thing done in a game that uses Module.

Constructor & Destructor Documentation

Module::ModuleGame::ModuleGame ( )

The default constructor of ModuleGame.

Member Function Documentation

void Module::ModuleGame::attachAudioInterface ( AudioInterface newAudio)

Attaches an AudioInterface to this game.

Parameters
newAudioA pointer to the AudioInterface to attach to this game
void Module::ModuleGame::attachGraphicsInterface ( GraphicsInterface newGraphics)

Attaches a GraphicsInterface to this game.

Parameters
newGraphicsA pointer to the GraphicsInterface to attach to this game
void Module::ModuleGame::attachThreadingInterface ( ThreadingInterface newThreading)

Attaches a ThreadingInterface to this game.

Parameters
newThreadingA pointer to the ThreadingInterface to attach to this game
Module::GameObject * Module::ModuleGame::createGameObject ( )

Creates a new GameObject.

Returns
A pointer to the created GameObject
Mutex * Module::ModuleGame::createMutex ( )
inline

Creates a Mutex.

Returns
A pointer to the newly created Mutex
GameObject * Module::ModuleGame::getGameObject ( Book< GameObject >::size_type  index)
inline
Returns
A reference to the index'th GameObject in this game.
const GameObject * Module::ModuleGame::getGameObject ( Book< GameObject >::size_type  index) const
inline
Returns
A const reference to the index'th GameObject in this game.
unsigned long Module::ModuleGame::getMilliseconds ( )
inline
Returns
The number of milliseconds that have elapsed since the start of the current game.
bool Module::ModuleGame::isRunning ( )

Checks if the game is running or not.

Returns
Whether or not the game is currently running
Book< GameObject >::size_type Module::ModuleGame::numObjects ( ) const
inline
Returns
The current number of GameObject instances in this game.
void Module::ModuleGame::setMesh ( GameObject obj,
Mesh mesh 
)
inline

Sets the Mesh component of a GameObject

Parameters
objThe GameObject to set the Mesh component of
meshThe corresponding Mesh
void Module::ModuleGame::start ( )

Starts the game.

void Module::ModuleGame::startThread ( ThreadObject obj)

Calls the run function of a ThreadObject in a newly spawned thread.

Parameters
objThe ThreadObject to call the run method of