resolt bug en jail_audio
treballant en Screen::renderInfo() deixa el programa congelat
This commit is contained in:
@@ -4,18 +4,25 @@
|
||||
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_SetRenderLogicalPrese...
|
||||
#include <SDL3/SDL_stdinc.h> // Para Uint32
|
||||
#include <SDL3/SDL_video.h> // Para SDL_Window, SDL_HideWindow, SDL_ShowWindow
|
||||
#include <SDL3/SDL_log.h> // Para SDL_LogCategory, SDL_LogError, SDL_L...
|
||||
#include <string> // Para string
|
||||
#include <memory> // Para shared_ptr
|
||||
#include "options.h" // Para Options, VideoOptions, options
|
||||
#include "param.h" // Para Param, ParamGame, param
|
||||
#include "utils.h" // Para Color
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "text.h"
|
||||
#include "resource.h"
|
||||
#endif
|
||||
|
||||
class Screen
|
||||
{
|
||||
private:
|
||||
// Constantes
|
||||
static constexpr int WINDOWS_DECORATIONS_ = 35;
|
||||
|
||||
// Estructuras
|
||||
// Estructura para gestionar los fotogramas por segundo
|
||||
struct FPS
|
||||
{
|
||||
Uint32 ticks; // Tiempo en milisegundos desde que se comenzó a contar.
|
||||
@@ -44,6 +51,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
// Estructura para gestionar el efecto de flash en la pantalla
|
||||
struct FlashEffect
|
||||
{
|
||||
bool enabled; // Indica si el efecto está activo
|
||||
@@ -63,6 +71,7 @@ private:
|
||||
bool isRendarable() { return enabled && counter < lenght - delay; }
|
||||
};
|
||||
|
||||
// Estructura para agitar la pantalla
|
||||
struct ShakeEffect
|
||||
{
|
||||
int desp; // Pixels de desplazamiento para agitar la pantalla en el eje x
|
||||
@@ -139,7 +148,27 @@ private:
|
||||
return enabled;
|
||||
}
|
||||
};
|
||||
#ifdef DEBUG
|
||||
// Estructura pra mostrar la información de debug
|
||||
struct Debug
|
||||
{
|
||||
std::shared_ptr<Text> text = nullptr; // Objeto de texto para escribir
|
||||
bool show = false; // Indica si se ha de mostrar la informacion por pantalla
|
||||
|
||||
void init()
|
||||
{
|
||||
if (Resource::get())
|
||||
{
|
||||
text = Resource::get()->getText("smb2");
|
||||
if (!text)
|
||||
{
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to retrieve debug_.text object!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
// [SINGLETON] Objeto privado
|
||||
static Screen *screen_;
|
||||
|
||||
@@ -156,13 +185,9 @@ private:
|
||||
FlashEffect flash_effect_; // Variable para gestionar el efecto de flash
|
||||
ShakeEffect shake_effect_; // Variable para gestionar el efecto de agitar la pantalla
|
||||
bool attenuate_effect_ = false; // Indica si la pantalla ha de estar atenuada
|
||||
|
||||
#ifdef DEBUG
|
||||
bool show_debug_info_ = true; // Indica si ha de mostrar/ocultar la información de la pantalla
|
||||
#else
|
||||
bool show_debug_info_ = false; // Indica si ha de mostrar/ocultar la información de la pantalla
|
||||
Debug debug_info_; // Variable para gestionar la informaciçón de debug
|
||||
#endif
|
||||
|
||||
// Arranca SDL VIDEO y crea la ventana
|
||||
bool initSDL();
|
||||
|
||||
@@ -250,10 +275,12 @@ public:
|
||||
|
||||
// Activa / desactiva los shaders
|
||||
void toggleShaders() { options.video.shaders = !options.video.shaders; }
|
||||
|
||||
#ifdef DEBUG
|
||||
// Activa / desactiva la información de debug
|
||||
void toggleDebugInfo() { show_debug_info_ = !show_debug_info_; }
|
||||
|
||||
void toggleDebugInfo() { debug_info_.show = !debug_info_.show; }
|
||||
void setDebugInfoEnabled(bool value) { debug_info_.show = value; }
|
||||
void initDebugInfo() { debug_info_.init(); }
|
||||
#endif
|
||||
// Activa / desactiva el escalado entero
|
||||
void toggleIntegerScale();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user