project-kyoku/debughelper.h

48 lines
1.0 KiB
C
Raw Normal View History

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>
using microsec = sf::Int64;
class DebugHelper : public sf::Drawable
2021-04-05 10:17:57 -04:00
{
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();
2021-04-05 10:17:57 -04:00
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;
2021-04-05 10:17:57 -04:00
};
#endif // DEBUGHELPER_H