#ifndef GRAPHICS_HPP #define GRAPHICS_HPP #include #include #include #include constexpr float TILESIZE = 32.0f; constexpr float WIDTH = (TILESIZE * 16); constexpr float HEIGHT = (TILESIZE * 13); constexpr float SIZE_X = 10.f; constexpr float SIZE_Y = 50.f; constexpr float POS_Y = (HEIGHT / 2) - (SIZE_Y / 2); constexpr float PADDLE_VELOCITY = 4.f; constexpr float BALL_VELOCITY_X = 3.f; constexpr float BALL_VELOCITY_Y = 2.f; constexpr float BALL_SIZE = 5.f; struct Paddle { Paddle(sf::Vector2f pos) { rect.setSize({ SIZE_X, SIZE_Y }); rect.setPosition(pos); }; int points { 0 }; void check_and_move(enum sf::Keyboard::Key key_up, enum sf::Keyboard::Key key_down); sf::RectangleShape rect; }; struct Ball { Ball() { object.setSize({ BALL_SIZE, BALL_SIZE }); object.setPosition( { (WIDTH / 2) - BALL_SIZE, (HEIGHT / 2) - BALL_SIZE }); }; sf::Vector2f velocity { BALL_VELOCITY_X, BALL_VELOCITY_Y }; sf::RectangleShape object; void handle_ball(Paddle* p1, Paddle* p2); }; #endif