5 #include <SFML/Graphics.hpp> 12 BallSFML::BallSFML(
double x,
double y, sf::RenderWindow &window,
double speed,
const string &textureFile) :
13 screenOrigin(x, y), windowSFML(window), transformation(
Transformation::getInstance()), Ball(0, 0, speed) {
16 if(!texture.loadFromFile(textureFile)) {
17 throw runtime_error(
"Couldn't load ball texture image: " + textureFile);
19 texture.setSmooth(
true);
20 sprite.setTexture(texture);
23 sprite.setPosition(x, y);
27 sf::FloatRect rect = sprite.getLocalBounds();
34 if(invisDuration > 0) {
40 sprite.move(velocity.
x, velocity.
y);
43 if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Space)) {
50 if(invisDuration == 0) {
51 windowSFML.draw(sprite);
56 sprite.setPosition(screenOrigin.
x, screenOrigin.
y);
void setSize(pair< double, double > newSize)
All the game gui elements of the Arkanoid game.
double y
The 'y' component of the Vector2D.
double x
The 'x' component of the Vector2D.
void setPosition(double x, double y)