Cuando se cambia el tamaño de la ventana, aparece centrada en el escritorio
This commit is contained in:
@@ -86,15 +86,15 @@ 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
|
||||
SDL_SetWindowFullscreen(window, videoMode);
|
||||
|
||||
// Si está activo el modo ventana quita el borde
|
||||
if (videoMode == 0)
|
||||
{
|
||||
// Muestra el puntero
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
|
||||
if (options->borderEnabled)
|
||||
{
|
||||
windowWidth = gameCanvasWidth + borderWidth;
|
||||
@@ -109,9 +109,9 @@ void Screen::setVideoMode(int videoMode)
|
||||
dest = {0, 0, gameCanvasWidth, gameCanvasHeight};
|
||||
}
|
||||
|
||||
// Modifica el tamaño del renderizador y de la ventana
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||
// Modifica el tamaño de la ventana
|
||||
SDL_SetWindowSize(window, windowWidth * options->windowSize, windowHeight * options->windowSize);
|
||||
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||
}
|
||||
|
||||
// Si está activo el modo de pantalla completa añade el borde
|
||||
@@ -162,11 +162,11 @@ void Screen::setVideoMode(int videoMode)
|
||||
dest.h = windowHeight;
|
||||
dest.x = dest.y = 0;
|
||||
}
|
||||
|
||||
// Modifica el tamaño del renderizador
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||
}
|
||||
|
||||
// Modifica el tamaño del renderizador
|
||||
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
||||
|
||||
// Actualiza las opciones
|
||||
options->videoMode = videoMode;
|
||||
options->screen.windowWidth = windowWidth;
|
||||
|
||||
Reference in New Issue
Block a user