2021-04-05 16:17:57 +02: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 19:39:29 +02:00
|
|
|
using microsec = sf::Int64;
|
|
|
|
|
2021-04-08 15:34:03 +02:00
|
|
|
class DebugHelper : public sf::Drawable
|
2021-04-05 16:17:57 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
DebugHelper(bool init = true);
|
|
|
|
|
|
|
|
void toggle();
|
2021-04-06 19:39:29 +02:00
|
|
|
void update(const microsec& microseconds);
|
2021-04-08 15:34:03 +02:00
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
2021-04-06 19:39:29 +02:00
|
|
|
|
|
|
|
void spawnGreenPulse();
|
|
|
|
void spawnRedPulse();
|
|
|
|
void spawnBluePulse();
|
2021-04-05 16:17:57 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool _toggled;
|
|
|
|
sf::Font _font;
|
|
|
|
sf::Text _time_print;
|
2021-04-06 19:39:29 +02:00
|
|
|
|
2021-04-08 15:34:03 +02:00
|
|
|
class Pulse : public sf::Drawable
|
2021-04-06 19:39:29 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Pulse(sf::Vector2f position, sf::Color fill_color);
|
|
|
|
void appear();
|
|
|
|
void fade();
|
|
|
|
|
2021-04-08 15:34:03 +02:00
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
2021-04-06 19:39:29 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
sf::RectangleShape _pulse_shape;
|
|
|
|
};
|
|
|
|
|
|
|
|
Pulse _red_pulse;
|
|
|
|
Pulse _green_pulse;
|
|
|
|
Pulse _blue_pulse;
|
2021-04-05 16:17:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DEBUGHELPER_H
|