53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <SDL2/SDL_rect.h> // for SDL_Point
|
|
#include <string> // for string
|
|
#include <vector> // for vector
|
|
|
|
// Clase Debug
|
|
class Debug
|
|
{
|
|
private:
|
|
// [SINGLETON] Objeto privado
|
|
static Debug *debug_;
|
|
|
|
// Variables
|
|
std::vector<std::string> slot_; // Vector con los textos a escribir
|
|
std::vector<std::string> log_; // Vector con los textos a escribir
|
|
int x_ = 0; // Posicion donde escribir el texto de debug
|
|
int y_ = 0; // Posición donde escribir el texto de debug
|
|
bool enabled_ = false; // Indica si esta activo el modo debug
|
|
|
|
// Constructor
|
|
Debug() = default;
|
|
|
|
// Destructor
|
|
~Debug() = default;
|
|
|
|
public:
|
|
// [SINGLETON] Crearemos el objeto con esta función estática
|
|
static void init();
|
|
|
|
// [SINGLETON] Destruiremos el objeto con esta función estática
|
|
static void destroy();
|
|
|
|
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
|
static Debug *get();
|
|
|
|
// Dibuja en pantalla
|
|
void render();
|
|
|
|
// Establece la posición donde se colocará la información de debug
|
|
void setPos(SDL_Point p);
|
|
|
|
// Getters
|
|
bool getEnabled() { return enabled_; }
|
|
|
|
// Setters
|
|
void add(std::string text) { slot_.push_back(text); }
|
|
void clear() { slot_.clear(); }
|
|
void addToLog(std::string text) { log_.push_back(text); }
|
|
void clearLog() { log_.clear(); }
|
|
void setEnabled(bool value) { enabled_ = value; }
|
|
void toggleEnabled() { enabled_ = !enabled_; }
|
|
}; |