diff --git a/data/sound/notify.wav b/data/sound/notify.wav index 87927fc..ddb57c0 100644 Binary files a/data/sound/notify.wav and b/data/sound/notify.wav differ diff --git a/source/common/screen.cpp b/source/common/screen.cpp index 355e25a..876fbdb 100644 --- a/source/common/screen.cpp +++ b/source/common/screen.cpp @@ -18,6 +18,8 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options gameCanvasHeight = options->gameHeight; borderWidth = options->gameWidth * options->borderSize; borderHeight = options->gameHeight * options->borderSize; + notificationLogicalWidth = gameCanvasWidth; + notificationLogicalHeight = gameCanvasHeight; iniFade(); iniSpectrumFade(); @@ -84,6 +86,7 @@ void Screen::blit() // Establece el modo de video void Screen::setVideoMode(int videoMode) { + // Muestra el puntero SDL_ShowCursor(SDL_ENABLE); // Aplica el modo de video @@ -114,6 +117,7 @@ void Screen::setVideoMode(int videoMode) // Si está activo el modo de pantalla completa añade el borde else if (videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP) { + // Oculta el puntero SDL_ShowCursor(SDL_DISABLE); // Obten el alto y el ancho de la ventana @@ -165,6 +169,9 @@ void Screen::setVideoMode(int videoMode) // Actualiza el valor de la variable options->videoMode = videoMode; + + // Establece el tamaño de las notificaciones + setNotificationSize(); } // Camibia entre pantalla completa y ventana @@ -368,17 +375,31 @@ void Screen::renderNotifications() return; } - SDL_RenderSetLogicalSize(renderer, windowWidth * 2, windowHeight * 2); - if (options->windowSize == 3) + SDL_RenderSetLogicalSize(renderer, notificationLogicalWidth, notificationLogicalHeight); + notify->render(); + SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight); +} + +// Establece el tamaño de las notificaciones +void Screen::setNotificationSize() +{ + if (options->videoMode == 0) { - SDL_RenderSetLogicalSize(renderer, (windowWidth * 3) / 2, (windowHeight * 3) / 2); + if (options->windowSize == 3) + { + notificationLogicalWidth = (windowWidth * 3) / 2; + notificationLogicalHeight = (windowHeight * 3) / 2; + } + else + { + notificationLogicalWidth = windowWidth * 2; + notificationLogicalHeight = windowHeight * 2; + } } if (options->videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP) { - SDL_RenderSetLogicalSize(renderer, windowWidth / 3, windowHeight / 3); + notificationLogicalWidth = windowWidth / 3; + notificationLogicalHeight = windowHeight / 3; } - - notify->render(); - SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight); } \ No newline at end of file diff --git a/source/common/screen.h b/source/common/screen.h index ca9ceb5..deacea9 100644 --- a/source/common/screen.h +++ b/source/common/screen.h @@ -24,15 +24,17 @@ private: Notify *notify; // Dibuja notificaciones por pantalla // Variables - int windowWidth; // Ancho de la pantalla o ventana - int windowHeight; // Alto de la pantalla o ventana - int gameCanvasWidth; // Resolución interna del juego. Es el ancho de la textura donde se dibuja el juego - int gameCanvasHeight; // Resolución interna del juego. Es el alto de la textura donde se dibuja el juego - int borderWidth; // Anchura del borde - int borderHeight; // Anltura del borde - SDL_Rect dest; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana - color_t borderColor; // Color del borde añadido a la textura de juego para rellenar la pantalla - bool notifyActive; // Indica si hay notificaciones activas + int windowWidth; // Ancho de la pantalla o ventana + int windowHeight; // Alto de la pantalla o ventana + int gameCanvasWidth; // Resolución interna del juego. Es el ancho de la textura donde se dibuja el juego + int gameCanvasHeight; // Resolución interna del juego. Es el alto de la textura donde se dibuja el juego + int borderWidth; // Anchura del borde + int borderHeight; // Anltura del borde + SDL_Rect dest; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana + color_t borderColor; // Color del borde añadido a la textura de juego para rellenar la pantalla + bool notifyActive; // Indica si hay notificaciones activas + int notificationLogicalWidth; // Ancho lógico de las notificaciones en relación al tamaño de pantalla + int notificationLogicalHeight; // Alto lógico de las notificaciones en relación al tamaño de pantalla // Variables - Efectos bool fade; // Indica si esta activo el efecto de fade @@ -64,6 +66,9 @@ private: // Dibuja las notificaciones void renderNotifications(); + // Establece el tamaño de las notificaciones + void setNotificationSize(); + public: // Constructor Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options_t *options);