25 lines
618 B
C++
25 lines
618 B
C++
struct Paddle
|
|
{
|
|
inline static const sf::Color color {sf::Color::White};
|
|
sf::Vector2f position;
|
|
sf::Vector2f size;
|
|
|
|
Paddle() {}
|
|
Paddle(sf::Vector2f position, sf::Vector2f size) : position(position), size(size) {}
|
|
|
|
sf::FloatRect getBorder() const
|
|
{
|
|
return {position.x - size.x / 2.0f, position.y - size.y / 2.0f, size.x, size.y};
|
|
}
|
|
|
|
void draw(sf::RenderWindow& window)
|
|
{
|
|
static sf::RectangleShape shape{};
|
|
shape.setPosition(position - size / 2.0f);
|
|
shape.setSize(size);
|
|
shape.setFillColor(color);
|
|
window.draw(shape);
|
|
}
|
|
};
|
|
|
|
|