From f071b602123b6f2cc1da8872558c1031aec562de Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 10 Sep 2024 08:12:37 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adida=20informaci=C3=B3n=20de=20la=20pan?= =?UTF-8?q?talla=20antes=20de=20crear=20la=20ventana?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/common/screen.cpp | 7 ++----- source/common/screen.h | 3 --- source/director.cpp | 8 ++++++++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/common/screen.cpp b/source/common/screen.cpp index f86f7b6..f76fb84 100644 --- a/source/common/screen.cpp +++ b/source/common/screen.cpp @@ -45,10 +45,7 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input * #endif SDL_DisplayMode DM; SDL_GetCurrentDisplayMode(0, &DM); - displayWidth = DM.w; - displayHeight = DM.h; - displayRefreshRate = DM.refresh_rate; - infoResolution = std::to_string(displayWidth) + " X " + std::to_string(displayHeight) + " AT " + std::to_string(displayRefreshRate) + " HZ"; + infoResolution = std::to_string(DM.w) + " X " + std::to_string(DM.h) + " AT " + std::to_string(DM.refresh_rate) + " HZ"; // Crea los objetos notify = new Notify(renderer, asset->get("notify.png"), asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"), options); @@ -144,7 +141,7 @@ void Screen::blit() void Screen::setVideoMode(int videoMode) { #ifdef ARCADE - videoMode = SCREEN_VIDEO_MODE_WINDOW; + //videoMode = SCREEN_VIDEO_MODE_WINDOW; #endif // Si está activo el modo ventana quita el borde diff --git a/source/common/screen.h b/source/common/screen.h index a26d538..f21f302 100644 --- a/source/common/screen.h +++ b/source/common/screen.h @@ -38,9 +38,6 @@ private: int fpsCounter; // Contador de frames por segundo int fps; // Frames calculados en el último segundo bool showInfo; // Indica si ha de mostrar/ocultar la información de la pantalla - int displayWidth; // Anchura de la pantalla - int displayHeight; // Altura de la pantalla - int displayRefreshRate; // Frecuencia de refresco de la pantalla std::string infoResolution; // Texto con la informacion de la pantalla struct effect_t diff --git a/source/director.cpp b/source/director.cpp index 04917a4..d05c860 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -207,6 +207,14 @@ bool Director::initSDL() // Inicia el generador de numeros aleatorios std::srand(static_cast(SDL_GetTicks())); + // Muestra información de la pantalla + if (options->console) + { + SDL_DisplayMode DM; + SDL_GetCurrentDisplayMode(0, &DM); + std::cout << "\nDisplay info: " + std::to_string(DM.w) + "x" + std::to_string(DM.h) + " @ " + std::to_string(DM.refresh_rate) + "Hz" << std::endl; + } + // Establece el filtro de la textura if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options->video.filter).c_str())) {