48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
#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>
|
|
|
|
using microsec = sf::Int64;
|
|
|
|
class DebugHelper : public sf::Drawable
|
|
{
|
|
public:
|
|
DebugHelper(bool init = true);
|
|
|
|
void toggle();
|
|
void update(const microsec& microseconds);
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
|
|
|
void spawnGreenPulse();
|
|
void spawnRedPulse();
|
|
void spawnBluePulse();
|
|
|
|
private:
|
|
bool _toggled;
|
|
sf::Font _font;
|
|
sf::Text _time_print;
|
|
|
|
class Pulse : public sf::Drawable
|
|
{
|
|
public:
|
|
Pulse(sf::Vector2f position, sf::Color fill_color);
|
|
void appear();
|
|
void fade();
|
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
|
|
|
private:
|
|
sf::RectangleShape _pulse_shape;
|
|
};
|
|
|
|
Pulse _red_pulse;
|
|
Pulse _green_pulse;
|
|
Pulse _blue_pulse;
|
|
};
|
|
|
|
#endif // DEBUGHELPER_H
|