2021-04-05 10:17:57 -04:00
|
|
|
#ifndef DEBUGHELPER_H
|
|
|
|
#define DEBUGHELPER_H
|
|
|
|
|
|
|
|
#include <SFML/Graphics/RenderWindow.hpp>
|
|
|
|
#include <SFML/Graphics/RectangleShape.hpp>
|
|
|
|
#include <SFML/Graphics/Font.hpp>
|
|
|
|
#include <SFML/Graphics/Text.hpp>
|
|
|
|
|
2021-04-06 13:39:29 -04:00
|
|
|
using microsec = sf::Int64;
|
|
|
|
|
2021-04-08 09:34:03 -04:00
|
|
|
class DebugHelper : public sf::Drawable
|
2021-04-05 10:17:57 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
DebugHelper(bool init = true);
|
|
|
|
|
|
|
|
void toggle();
|
2021-04-06 13:39:29 -04:00
|
|
|
void update(const microsec& microseconds);
|
2021-04-08 09:34:03 -04:00
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
2021-04-06 13:39:29 -04:00
|
|
|
|
|
|
|
void spawnGreenPulse();
|
|
|
|
void spawnRedPulse();
|
|
|
|
void spawnBluePulse();
|
2021-04-05 10:17:57 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool _toggled;
|
|
|
|
sf::Font _font;
|
|
|
|
sf::Text _time_print;
|
2021-04-06 13:39:29 -04:00
|
|
|
|
2021-04-08 09:34:03 -04:00
|
|
|
class Pulse : public sf::Drawable
|
2021-04-06 13:39:29 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Pulse(sf::Vector2f position, sf::Color fill_color);
|
|
|
|
void appear();
|
|
|
|
void fade();
|
|
|
|
|
2021-04-08 09:34:03 -04:00
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
2021-04-06 13:39:29 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
sf::RectangleShape _pulse_shape;
|
|
|
|
};
|
|
|
|
|
|
|
|
Pulse _red_pulse;
|
|
|
|
Pulse _green_pulse;
|
|
|
|
Pulse _blue_pulse;
|
2021-04-05 10:17:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DEBUGHELPER_H
|