This repository has been archived on 2023-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
mipt_cpp/seminar13_polymorphism/arkanoid/paddle.cpp
2023-01-04 14:37:54 +03:00

18 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);
}