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

The SFML element that represents the arkanoid::Player in the game. More...

#include <player_sfml.h>

Inheritance diagram for arkanoidSFML::PlayerSFML:
arkanoid::Player arkanoid::Entity

Public Member Functions

 PlayerSFML (double x, double y, sf::RenderWindow &window, double speed=10.0, const string &textureFile="data/sprites/player/player.png")
 
 ~PlayerSFML ()
 
void update ()
 
void draw () const
 
void reset ()
 
- Public Member Functions inherited from arkanoid::Player
 Player ()
 
 Player (double x, double y, double newSpeed=15.0, pair< double, double > size=make_pair(2.0, 1.0))
 
 ~Player ()
 
void update ()
 
void draw () const
 
void speedUp (double factor)
 
- 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::Player
Vector2D velocity
 
double speed
 
Vector2D origin
 The initial position of the Player.
 
double originalSpeed
 
bool notMoving
 
int speedUpDuration
 In frames.
 
- 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 SFML element that represents the arkanoid::Player in the game.

Definition at line 20 of file player_sfml.h.

Constructor & Destructor Documentation

◆ PlayerSFML()

arkanoidSFML::PlayerSFML::PlayerSFML ( double  x,
double  y,
sf::RenderWindow &  window,
double  speed = 10.0,
const string &  textureFile = "data/sprites/player/player.png" 
)

Constructor.

Creates a PlayerSFML sprite in the World at a specific position in the game window. Also applies the texture to this PlayerSFML.

Parameters
xThe x (on screen) position of the arkanoid::Player.
yThe y (on screen) position of the arkanoid::Player.
windowThe SFML window.
speed(optional) The speed of the arkanoid::Player.
textureFile(optional) The file that contains the texture of the PlayerSFML.

Definition at line 12 of file player_sfml.cpp.

◆ ~PlayerSFML()

arkanoidSFML::PlayerSFML::~PlayerSFML ( )

Destructor.

Definition at line 31 of file player_sfml.cpp.

Member Function Documentation

◆ draw()

void arkanoidSFML::PlayerSFML::draw ( ) const
virtual

Draws the PlayerSFML in the game window.

Implements arkanoid::Entity.

Definition at line 65 of file player_sfml.cpp.

◆ reset()

void arkanoidSFML::PlayerSFML::reset ( )
virtual

Resets the position of the arkanoid::Player to the one of the starting position. (-> call this method when the arkanoid::Player missed the Ball).

Reimplemented from arkanoid::Player.

Definition at line 69 of file player_sfml.cpp.

◆ update()

void arkanoidSFML::PlayerSFML::update ( )
virtual

Checks for user input and make the corresponding move if necessary and possible.

Implements arkanoid::Entity.

Definition at line 33 of file player_sfml.cpp.


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