From fb314457313301f7c601e20d2e5a02787f4f2948 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Mon, 23 Dec 2024 11:22:26 +0100 Subject: [PATCH] Comprova al iniciar que el tamany de finestra no siga mes gran que el tamany de la pantalla --- source/director.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/director.cpp b/source/director.cpp index 887e6bc..ff848db 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -296,14 +296,17 @@ bool Director::initSDL() } */ - // Muestra información sobre el tamañi de la pantalla y de la ventana de juego + // Obtiene información sobre la pantalla SDL_DisplayMode DM; SDL_GetCurrentDisplayMode(0, &DM); - std::cout << "\nCurrent display mode: " << DM.w << "x" << DM.h << " @ " << DM.refresh_rate << "Hz" << std::endl; - std::cout << "Window resolution : " << param.game.width << "x" << param.game.height << " x" << options.video.window.size << std::endl; // Calcula el máximo factor de zoom que se puede aplicar a la pantalla options.video.window.max_size = std::min(DM.w / param.game.width, DM.h / param.game.height); + options.video.window.size = std::min(options.video.window.size, options.video.window.max_size); + + // Muestra información sobre el tamaño de la pantalla y de la ventana de juego + std::cout << "\nCurrent display mode: " << DM.w << "x" << DM.h << " @ " << DM.refresh_rate << "Hz" << std::endl; + std::cout << "Window resolution : " << param.game.width << "x" << param.game.height << " x" << options.video.window.size << std::endl; // Establece el filtro de la textura if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(static_cast(options.video.filter)).c_str()))