C++ Project 2016-2017: Arkanoid
|
The SFML element that represents the arkanoid::Player in the game. More...
#include <player_sfml.h>
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 () |
![]() | |
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) |
![]() | |
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 | |
![]() | |
Vector2D | velocity |
double | speed |
Vector2D | origin |
The initial position of the Player. | |
double | originalSpeed |
bool | notMoving |
int | speedUpDuration |
In frames. | |
![]() | |
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. | |
The SFML element that represents the arkanoid::Player in the game.
Definition at line 20 of file player_sfml.h.
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.
x | The x (on screen) position of the arkanoid::Player. |
y | The y (on screen) position of the arkanoid::Player. |
window | The 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.
arkanoidSFML::PlayerSFML::~PlayerSFML | ( | ) |
Destructor.
Definition at line 31 of file player_sfml.cpp.
|
virtual |
Draws the PlayerSFML in the game window.
Implements arkanoid::Entity.
Definition at line 65 of file player_sfml.cpp.
|
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.
|
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.