forked from jaildesigner-jailgames/jaildoctors_dilemma
Optimizado el calculo del tamaño de las notificaciones
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user