project-kyoku/src/classicgame/classicsprite.cpp

25 lines
622 B
C++
Raw Normal View History

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