fix: tamany incorrecte per a la textura de shaders quan es desactiva el borde

This commit is contained in:
2025-03-06 23:20:07 +01:00
parent 9eaf3bc134
commit ae5c511988

View File

@@ -77,7 +77,9 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer)
} }
// Crea la textura donde se dibuja el borde que rodea el area de juego // Crea la textura donde se dibuja el borde que rodea el area de juego
shaders_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, options.game.width + options.video.border.width * 2, options.game.height + options.video.border.height * 2); const int EXTRA_WIDTH = options.video.border.enabled ? options.video.border.width * 2 : 0;
const int EXTRA_HEIGHT = options.video.border.enabled ? options.video.border.height * 2 : 0;
shaders_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, options.game.width + EXTRA_WIDTH, options.game.height + EXTRA_HEIGHT);
if (!shaders_texture_) if (!shaders_texture_)
{ {
// Registrar el error si está habilitado // Registrar el error si está habilitado
@@ -329,7 +331,7 @@ void Screen::resetShaders()
{ {
if (options.video.shaders) if (options.video.shaders)
{ {
const std::string GLSL_FILE = window_height_ == 192 ? "crtpi_192.glsl" : "crtpi_240.glsl"; const std::string GLSL_FILE = options.video.border.enabled ? "crtpi_240.glsl" : "crtpi_192.glsl";
std::ifstream f(Asset::get()->get(GLSL_FILE).c_str()); std::ifstream f(Asset::get()->get(GLSL_FILE).c_str());
std::string source((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>()); std::string source((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
@@ -466,7 +468,9 @@ void Screen::createShadersTexture()
} }
// Crea la textura donde se dibuja el borde que rodea el area de juego // Crea la textura donde se dibuja el borde que rodea el area de juego
shaders_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, options.game.width + options.video.border.width * 2, options.game.height + options.video.border.height * 2); const int EXTRA_WIDTH = options.video.border.enabled ? options.video.border.width * 2 : 0;
const int EXTRA_HEIGHT = options.video.border.enabled ? options.video.border.height * 2 : 0;
shaders_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, options.game.width + EXTRA_WIDTH, options.game.height + EXTRA_HEIGHT);
if (!shaders_texture_) if (!shaders_texture_)
{ {
// Registrar el error si está habilitado // Registrar el error si está habilitado