2021-06-09 14:08:58 -04:00
|
|
|
#pragma once
|
|
|
|
|
2021-08-05 14:59:48 -04:00
|
|
|
#include "tools/mathutils.h"
|
2021-09-14 15:02:23 -04:00
|
|
|
#include "sprite.h"
|
|
|
|
#include <SFML/Graphics/RectangleShape.hpp>
|
|
|
|
#include <SFML/Graphics/Text.hpp>
|
2021-06-09 14:08:58 -04:00
|
|
|
|
|
|
|
class ClassicSprite : public Sprite, public sf::Drawable
|
|
|
|
{
|
|
|
|
public:
|
2021-06-11 13:39:47 -04:00
|
|
|
ClassicSprite(const sf::RectangleShape& shape, const sf::Font &font);
|
2021-06-09 14:08:58 -04:00
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
2021-06-16 11:16:18 -04:00
|
|
|
virtual void reset() override;
|
2021-06-09 14:08:58 -04:00
|
|
|
|
2021-06-24 14:04:09 -04:00
|
|
|
void setCoordinates(const Coordinates &coordinates, float trail_x, float trail_y) noexcept;
|
|
|
|
Coordinates coordinates() const;
|
2021-07-14 22:45:52 -04:00
|
|
|
Coordinates trailCoordinates() const;
|
2021-06-11 13:39:47 -04:00
|
|
|
void update(float trail_x, float trail_y) noexcept;
|
2021-06-16 11:16:18 -04:00
|
|
|
void update() noexcept;
|
|
|
|
|
|
|
|
void pulse();
|
2021-06-11 13:39:47 -04:00
|
|
|
void fade();
|
2021-06-17 15:13:25 -04:00
|
|
|
void trailFade();
|
2021-06-11 13:39:47 -04:00
|
|
|
bool isDead() const;
|
2021-06-09 14:08:58 -04:00
|
|
|
|
|
|
|
private:
|
2021-06-16 13:11:00 -04:00
|
|
|
sf::RectangleShape _prototype;
|
|
|
|
|
2021-06-09 14:08:58 -04:00
|
|
|
sf::RectangleShape _shape;
|
2021-06-11 12:58:44 -04:00
|
|
|
sf::RectangleShape _trail;
|
2021-06-11 13:39:47 -04:00
|
|
|
sf::Text _grade_text;
|
|
|
|
sf::Font _font;
|
2021-06-17 15:13:25 -04:00
|
|
|
|
|
|
|
bool _trail_fade = false;
|
2021-06-09 14:08:58 -04:00
|
|
|
};
|