clase Debug ara carrega la posicio i habitacio inicial desde un fitxer

This commit is contained in:
2026-03-28 20:15:44 +01:00
parent 71c7b8e553
commit 268763f162
6 changed files with 93 additions and 15 deletions

View File

@@ -10,6 +10,13 @@
// Clase Debug
class Debug {
public:
struct SpawnSettings {
std::string room;
int spawn_x = 0;
int spawn_y = 0;
SDL_FlipMode flip = SDL_FLIP_NONE;
};
static void init(); // [SINGLETON] Crearemos el objeto con esta función estática
static void destroy(); // [SINGLETON] Destruiremos el objeto con esta función estática
static auto get() -> Debug*; // [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
@@ -27,6 +34,11 @@ class Debug {
void setEnabled(bool value) { enabled_ = value; } // Establece si el debug está activo
void toggleEnabled() { enabled_ = !enabled_; } // Alterna el estado del debug
void setDebugFile(const std::string& path); // Establece la ruta del archivo debug.yaml
void loadFromFile(); // Carga la configuración de debug desde debug.yaml
void saveToFile() const; // Guarda la configuración de debug en debug.yaml
[[nodiscard]] auto getSpawnSettings() const -> const SpawnSettings& { return spawn_settings_; } // Obtiene los valores de spawn
private:
static Debug* debug; // [SINGLETON] Objeto privado
@@ -39,6 +51,8 @@ class Debug {
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
std::string debug_file_path_; // Ruta del archivo debug.yaml
SpawnSettings spawn_settings_; // Configuración de spawn para debug
};
#endif // _DEBUG