12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #include <SFML/Graphics.hpp>
- #include <SFML/Audio.hpp>
-
- class Paddle : public sf::RectangleShape {
- private:
- float x,
- y;
- sf::Vector2f size;
-
- public:
- Paddle();
- void move(float x, float y);
- void draw(sf::RenderWindow);
- float getX() const;
- float getY() const;
- sf::Vector2f getSize() const;
- void setPosition(float x, float y);
- void render(sf::RenderWindow) const;
-
- };
-
- class Ball : public sf::CircleShape {
- private:
- float radius = 10,
- angle = 0;
- const float ballSpeed = 400;
-
- public:
- Ball();
- Ball(int radius);
- void move(float x, float y);
- void setPosition(float x, float y);
- float getX() const;
- float getY() const;
- float getSpeed() const;
- float getRadius() const;
- float getAngle() const;
- void setAngle(float a);
- void render(sf::RenderWindow) const;
- void checkLeftPaddle(Paddle leftPaddle, sf::Sound ballSound);
- void checkRightPaddle(Paddle rightPaddle, sf::Sound ballSound);
-
- };
|