19 lines
482 B
C++
19 lines
482 B
C++
|
#include "paddle.hpp"
|
||
|
|
||
|
Paddle::Paddle() {}
|
||
|
Paddle::Paddle(sf::Vector2f position, sf::Vector2f size) : position(position), size(size) {}
|
||
|
|
||
|
sf::FloatRect Paddle::getBorder() const
|
||
|
{
|
||
|
return {position.x - size.x / 2.0f, position.y - size.y / 2.0f, size.x, size.y};
|
||
|
}
|
||
|
|
||
|
void Paddle::draw(sf::RenderWindow& window)
|
||
|
{
|
||
|
static sf::RectangleShape shape{};
|
||
|
shape.setPosition(position - size / 2.0f);
|
||
|
shape.setSize(size);
|
||
|
shape.setFillColor(color);
|
||
|
window.draw(shape);
|
||
|
}
|