Terminus
Public Member Functions | Protected Attributes | List of all members
terminus::World Class Reference

The World class represents a running game instance and contains all graphical (3D) elements of the scene. More...

#include <world.h>

Inheritance diagram for terminus::World:

Public Member Functions

 World (Game &game, bool isNetworkGame, bool isPlayerOne, unsigned int terrainSeed)
 Construct a world for a local or multiplayer game. More...
 
 World (const World &other)=delete
 Delete copy constructor. More...
 
World & operator= (const World &other)=delete
 Delete assignment operator. More...
 
 ~World ()
 
void update ()
 
void render (QOpenGLFunctions &gl) const
 
LocalPlayer & localPlayer ()
 
AbstractPlayer & enemyPlayer ()
 
Train & localPlayerTrain ()
 
Train & enemyPlayerTrain ()
 
Level & level ()
 
Timer & timer ()
 
NetworkManager & networkManager ()
 
LightManager & lightManager ()
 
void scheduleAction (ActionScheduler::Action event)
 
void addObject (AbstractGraphicsObject *node)
 
void deleteObject (AbstractGraphicsObject *object)
 
std::shared_ptr< BulletWorld > bulletWorld ()
 Returns a shared pointer to the corresponding BulletWorld. More...
 

Protected Attributes

Game & m_game
 
Level m_level
 
LightManager m_lightManager
 
std::shared_ptr< BulletWorld > m_bulletWorld
 
std::unique_ptr< SkyBox > m_skybox
 
std::unique_ptr< Terrain > m_terrain
 
std::shared_ptr< Train > m_rightTrain
 
std::shared_ptr< Train > m_leftTrain
 
std::unique_ptr< LocalPlayer > m_localPlayer
 
std::unique_ptr< AbstractPlayer > m_enemyPlayer
 
std::list< std::unique_ptr< AbstractGraphicsObject > > m_dynamicObjects
 

Detailed Description

The World class represents a running game instance and contains all graphical (3D) elements of the scene.

A running game consists of a Terrain, two Train instances, other graphical elements (Projectile, Skybox, ...) and two AbstractPlayer s controlling the two trains. It also holds the BulletWorld, an encapsulation of all bullet-related classes and methods.

Constructor & Destructor Documentation

terminus::World::World ( Game &  game,
bool  isNetworkGame,
bool  isPlayerOne,
unsigned int  terrainSeed 
)

Construct a world for a local or multiplayer game.

Parameters
gameReference to a game instance
isNetworkGameWhether this game is a network game or a local singleplayer game (with enemy AI)
isPlayerOneWhether the local player is "player one" or "player two"
terrainSeedSeed value for the noise generator to synchronize the terrain with the other network player
terminus::World::World ( const World &  other)
delete

Delete copy constructor.

terminus::World::~World ( )

Member Function Documentation

void terminus::World::addObject ( AbstractGraphicsObject *  node)
std::shared_ptr< BulletWorld > terminus::World::bulletWorld ( )

Returns a shared pointer to the corresponding BulletWorld.

This getter is mainly used in the constructor of AbstractPhysicsObject. AbstractPhysicsObjects that need to operate on the BulletWorld should not call it via this getter, but use their own stored copy.

void terminus::World::deleteObject ( AbstractGraphicsObject *  object)
AbstractPlayer & terminus::World::enemyPlayer ( )
Train & terminus::World::enemyPlayerTrain ( )
Level & terminus::World::level ( )
LightManager & terminus::World::lightManager ( )
LocalPlayer & terminus::World::localPlayer ( )
Train & terminus::World::localPlayerTrain ( )
NetworkManager & terminus::World::networkManager ( )
World& terminus::World::operator= ( const World &  other)
delete

Delete assignment operator.

void terminus::World::render ( QOpenGLFunctions &  gl) const
void terminus::World::scheduleAction ( ActionScheduler::Action  event)
Timer & terminus::World::timer ( )
void terminus::World::update ( )

Member Data Documentation

std::shared_ptr<BulletWorld> terminus::World::m_bulletWorld
protected
std::list<std::unique_ptr<AbstractGraphicsObject> > terminus::World::m_dynamicObjects
protected
std::unique_ptr<AbstractPlayer> terminus::World::m_enemyPlayer
protected
Game& terminus::World::m_game
protected
std::shared_ptr<Train> terminus::World::m_leftTrain
protected
Level terminus::World::m_level
protected
LightManager terminus::World::m_lightManager
protected
std::unique_ptr<LocalPlayer> terminus::World::m_localPlayer
protected
std::shared_ptr<Train> terminus::World::m_rightTrain
protected
std::unique_ptr<SkyBox> terminus::World::m_skybox
protected
std::unique_ptr<Terrain> terminus::World::m_terrain
protected

The documentation for this class was generated from the following files: