millorada una mica la classe Debug en quant a mostrar info
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <map> // Para map
|
||||
#include <string> // Para string
|
||||
#include <vector> // Para vector
|
||||
|
||||
@@ -27,10 +28,13 @@ class Debug {
|
||||
|
||||
[[nodiscard]] auto isEnabled() const -> bool { return enabled_; } // Obtiene si el debug está activo
|
||||
|
||||
void add(const std::string& text) { slot_.push_back(text); } // Añade texto al slot de debug
|
||||
void clear() { slot_.clear(); } // Limpia el slot de debug
|
||||
void addToLog(const std::string& text) { log_.push_back(text); } // Añade texto al log
|
||||
void clearLog() { log_.clear(); } // Limpia el log
|
||||
void add(const std::string& text) { slot_.push_back(text); } // Añade texto one-shot al slot (se limpia cada frame)
|
||||
void clear() { slot_.clear(); } // Limpia el slot one-shot (no afecta a watches)
|
||||
void addToLog(const std::string& text) { log_.push_back(text); } // Añade texto al log
|
||||
void clearLog() { log_.clear(); } // Limpia el log
|
||||
void set(const std::string& key, const std::string& value); // Establece/actualiza un valor persistente en el watch window
|
||||
void unset(const std::string& key); // Elimina un valor del watch window
|
||||
void clearWatches() { watches_.clear(); } // Limpia todos los watches
|
||||
void setEnabled(bool value) { enabled_ = value; } // Establece si el debug está activo
|
||||
void toggleEnabled() { enabled_ = !enabled_; } // Alterna el estado del debug
|
||||
|
||||
@@ -47,8 +51,9 @@ class Debug {
|
||||
~Debug() = default; // Destructor
|
||||
|
||||
// Variables
|
||||
std::vector<std::string> slot_; // Vector con los textos a escribir
|
||||
std::vector<std::string> log_; // Vector con los textos a escribir
|
||||
std::map<std::string, std::string> watches_; // Watch window: valores persistentes (key→value)
|
||||
std::vector<std::string> slot_; // One-shot: textos que se limpian cada frame
|
||||
std::vector<std::string> log_; // Log persistente
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user