From 536343387155622b14b1225e1eaff83e800fe608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Sun, 7 May 2023 18:33:03 +0200 Subject: [PATCH] Screen: resolucion del juego y del overlay independientes --- main.cpp | 6 +++--- units/screen.cpp | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index ced40ec..5a18956 100644 --- a/main.cpp +++ b/main.cpp @@ -33,8 +33,8 @@ int main(int argc, char *argv[]) initOptions(options); options->screen.nativeWidth = 320; options->screen.nativeHeight = 240; - options->screen.nativeZoom = 1; - options->screen.windowZoom = 2; + options->screen.nativeZoom = 2; + options->screen.windowZoom = 1; options->console = false; // Inicializa la lista de recursos @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) sprite->setVelY(2); // Bucle principal - JA_PlayMusic(music, true); + //JA_PlayMusic(music, true); bool should_exit = false; while (!should_exit) { diff --git a/units/screen.cpp b/units/screen.cpp index 7110d25..05bb8cb 100644 --- a/units/screen.cpp +++ b/units/screen.cpp @@ -56,6 +56,7 @@ void Screen::clean(color_t color) void Screen::start() { SDL_SetRenderTarget(renderer, gameCanvas); + SDL_RenderSetLogicalSize(renderer, options->screen.nativeWidth, options->screen.nativeHeight); } // Vuelca el contenido del renderizador en pantalla @@ -68,6 +69,8 @@ void Screen::blit() SDL_SetRenderDrawColor(renderer, borderColor.r, borderColor.g, borderColor.b, 0xFF); SDL_RenderClear(renderer); + SDL_RenderSetLogicalSize(renderer, gameWidth, gameHeight); + // Copia la textura de juego en el renderizador en la posición adecuada SDL_RenderCopy(renderer, gameCanvas, nullptr, &dest); @@ -167,7 +170,7 @@ void Screen::setVideoMode(int videoMode) // Modifica el tamaño del renderizador // SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight); - SDL_RenderSetLogicalSize(renderer, gameWidth, gameHeight); + //SDL_RenderSetLogicalSize(renderer, gameWidth, gameHeight); // Actualiza las opciones options->screen.mode = videoMode;