Files
jaildoctors_dilemma/source/debug.h
Sergio Valor 7c102e42cc corregits mes includes
llevats els errors en texture
2025-10-15 09:14:30 +02:00

53 lines
1.6 KiB
C++

#pragma once
#include <SDL3/SDL.h>
#include <string> // Para string
#include <vector> // Para 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_; }
};