diff --git a/source/screen.cpp b/source/screen.cpp index 253c73e..c501936 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -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 - 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_) { // Registrar el error si está habilitado @@ -329,7 +331,7 @@ void Screen::resetShaders() { 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::string source((std::istreambuf_iterator(f)), std::istreambuf_iterator()); @@ -466,7 +468,9 @@ void Screen::createShadersTexture() } // 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_) { // Registrar el error si está habilitado