2021-06-09 20:08:58 +02:00
|
|
|
#include "classicsprite.h"
|
|
|
|
#include <SFML/Graphics/RenderTarget.hpp>
|
|
|
|
|
|
|
|
ClassicSprite::ClassicSprite(const sf::RectangleShape& shape) :
|
2021-06-11 18:58:44 +02:00
|
|
|
_shape(shape),
|
|
|
|
_trail(shape)
|
2021-06-09 20:08:58 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
void ClassicSprite::draw(sf::RenderTarget& target, sf::RenderStates states) const
|
|
|
|
{
|
|
|
|
target.draw(_shape, states);
|
2021-06-11 18:58:44 +02:00
|
|
|
target.draw(_trail, states);
|
2021-06-09 20:08:58 +02:00
|
|
|
}
|
|
|
|
|
2021-06-11 18:58:44 +02:00
|
|
|
void ClassicSprite::setCoordinates(float x, float y, float trail_x, float trail_y) noexcept
|
2021-06-09 20:08:58 +02:00
|
|
|
{
|
|
|
|
_shape.setPosition(x, y);
|
2021-06-11 18:58:44 +02:00
|
|
|
_trail.setPosition(trail_x, trail_y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ClassicSprite::setTrailCoordinates(float trail_x, float trail_y) noexcept
|
|
|
|
{
|
|
|
|
_trail.setPosition(trail_x, trail_y);
|
2021-06-09 20:08:58 +02:00
|
|
|
}
|