|
C++ Project 2016-2017: Arkanoid
|
The SFML element that represents the arkanoid::Ball in the game. More...
#include <ball_sfml.h>
Public Member Functions | |
| BallSFML (double x, double y, sf::RenderWindow &window, double speed=8.0, const string &textureFile="data/sprites/ball/ball.png") | |
| ~BallSFML () | |
| void | update () |
| void | draw () const |
| void | reset () |
Public Member Functions inherited from arkanoid::Ball | |
| Ball () | |
| Ball (double x, double y, double newSpeed=8.0, pair< double, double > size=make_pair(1.0, 1.0)) | |
| ~Ball () | |
| void | update () |
| void | draw () const |
| void | speedUp (double factor) |
| void | setInvisible (int period) |
| template<typename T > | |
| vector< int > | bounceIfPossible (vector< unique_ptr< T >> const &entities) |
| void | bounceIfPossible (unique_ptr< Player > const &player) |
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::Ball | |
| Vector2D | velocity |
| Vector2D | origin |
| double | speed |
| bool | notMoving |
| int | invisDuration |
| bool | spedUp |
| Random * | random |
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. | |
The SFML element that represents the arkanoid::Ball in the game.
Definition at line 19 of file ball_sfml.h.
| arkanoidSFML::BallSFML::BallSFML | ( | double | x, |
| double | y, | ||
| sf::RenderWindow & | window, | ||
| double | speed = 8.0, |
||
| const string & | textureFile = "data/sprites/ball/ball.png" |
||
| ) |
Constructor.
Creates a BallSFML sprite in the World at a specific position in the game window. Also applies the texture to this BallSFML.
| x | The x (on screen) position of the arkanoid::Ball. |
| y | The y (on screen) position of the arkanoid::Ball. |
| window | The SFML window. |
| speed | (optional) The speed of the arkanoid::Ball. |
| textureFile | (optional) The file that contains the texture of the BallSFML. |
Definition at line 12 of file ball_sfml.cpp.
| arkanoidSFML::BallSFML::~BallSFML | ( | ) |
Destructor.
Definition at line 31 of file ball_sfml.cpp.
|
virtual |
Draws the BallSFML in the game window.
Implements arkanoid::Entity.
Definition at line 49 of file ball_sfml.cpp.
|
virtual |
Reset the position and direction of the arkanoid::Ball to the one of the starting position. (-> call this method when the Player missed the arkanoid::Ball).
Reimplemented from arkanoid::Ball.
Definition at line 55 of file ball_sfml.cpp.
|
virtual |
Updates the BallSFML position.
Implements arkanoid::Entity.
Definition at line 33 of file ball_sfml.cpp.
1.8.13