C++ Project 2016-2017: Arkanoid
Public Member Functions | List of all members
arkanoid::World Class Reference

The World of the Arkanoid game that contains all Entity objects. More...

#include <world.h>

Inheritance diagram for arkanoid::World:
arkanoid::Entity

Public Member Functions

 World ()
 
 ~World ()
 
void update ()
 
void draw () const
 
void addBlock (unique_ptr< arkanoid::Block > block)
 
void addWall (unique_ptr< arkanoid::Wall > wall)
 
void setBall (unique_ptr< arkanoid::Ball > newBall)
 
void setPlayer (unique_ptr< arkanoid::Player > newPlayer)
 
bool levelEnded () const
 
void reset ()
 
- Public Member Functions inherited from arkanoid::Entity
 Entity ()
 
 Entity (double x, double y, pair< double, double > newSize=make_pair(1.0, 1.0))
 
virtual ~Entity ()
 
Vector2D getPosition () const
 
void setPosition (double x, double y)
 
void setPosition (const Vector2D &vector)
 
void setSize (pair< double, double > newSize)
 
pair< double, double > getSize () const
 
bool collidesWith (const Entity &other) const
 

Additional Inherited Members

- Protected Attributes inherited from arkanoid::Entity
Vector2D position
 The current position of the Entity (in the 9x7 grid).
 
pair< double, double > size
 The size (width and height respectively) of the Entity.
 

Detailed Description

The World of the Arkanoid game that contains all Entity objects.

Definition at line 23 of file world.h.

Constructor & Destructor Documentation

◆ World()

arkanoid::World::World ( )

Default Constructor.

Definition at line 20 of file world.cpp.

◆ ~World()

arkanoid::World::~World ( )

Destructor.

Definition at line 22 of file world.cpp.

Member Function Documentation

◆ addBlock()

void arkanoid::World::addBlock ( unique_ptr< arkanoid::Block block)

Adds a Block to the World.

Parameters
blockThe Block that will be added to the World.

Definition at line 89 of file world.cpp.

◆ addWall()

void arkanoid::World::addWall ( unique_ptr< arkanoid::Wall wall)

Adds a Wall to the World.

Parameters
wallThe Wall that will be added to the World.

Definition at line 93 of file world.cpp.

◆ draw()

void arkanoid::World::draw ( ) const
virtual

Draws all Entity in the World.

Implements arkanoid::Entity.

Definition at line 77 of file world.cpp.

◆ levelEnded()

bool arkanoid::World::levelEnded ( ) const

Checks if the level ended, i.e. when there are no more Block in the World.

Returns
True if level ended, otherwise false.

Definition at line 105 of file world.cpp.

◆ reset()

void arkanoid::World::reset ( )

Resets the World: Player and Ball will be places in their initial location. Call when new level starts or when game is bugged out...

Definition at line 109 of file world.cpp.

◆ setBall()

void arkanoid::World::setBall ( unique_ptr< arkanoid::Ball newBall)

Sets the Ball of the World.

Parameters
newBallThe new Ball of the World.

Definition at line 97 of file world.cpp.

◆ setPlayer()

void arkanoid::World::setPlayer ( unique_ptr< arkanoid::Player newPlayer)

Sets the Player of the World.

Parameters
newPlayerThe new Player of the World.

Definition at line 101 of file world.cpp.

◆ update()

void arkanoid::World::update ( )
virtual

Updates all Entity in the World.

Implements arkanoid::Entity.

Definition at line 55 of file world.cpp.


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