From 61297ff3407b6a768b65881539eec2d185435cbb Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 9 Aug 2022 17:23:58 +0200 Subject: [PATCH] Actualizado renderGame y screen.h --- source/director.cpp | 10 ++++++---- source/screen.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/director.cpp b/source/director.cpp index c89ed6d..b4af0c2 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -442,16 +442,18 @@ void Director::updateGame() // Pinta la sección de juego void Director::renderGame() { + // Prepara para empezar a dibujar el frame + screen->start(); + // Limpia la pantalla - SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); - SDL_RenderClear(renderer); + screen->clean(); // Dibuja los objetos map->render(); player->render(); - // Muestra el backbuffer en pantalla - SDL_RenderPresent(renderer); + // Vuelca el contenido del renderizador en pantalla + screen->blit(); } // Bucle principal diff --git a/source/screen.h b/source/screen.h index 45bfef1..22b9421 100644 --- a/source/screen.h +++ b/source/screen.h @@ -30,7 +30,7 @@ public: ~Screen(); // Limpia la pantalla - void clean(color_t color); + void clean(color_t color = {0x00, 0x00, 0x00}); // Prepara para empezar a dibujar en la textura de juego void start();