Es pot fer la finestra tan gran com deixe la pantalla, es a dir, el factor de zoom ja no va de 1 a 4 sino de 1 a X
This commit is contained in:
@@ -296,11 +296,15 @@ bool Director::initSDL()
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Muestra información sobre el tamañi de la pantalla y de la ventana de juego
|
||||||
SDL_DisplayMode DM;
|
SDL_DisplayMode DM;
|
||||||
SDL_GetCurrentDisplayMode(0, &DM);
|
SDL_GetCurrentDisplayMode(0, &DM);
|
||||||
std::cout << "\nCurrent display mode: " << DM.w << "x" << DM.h << " @ " << DM.refresh_rate << "Hz" << std::endl;
|
std::cout << "\nCurrent display mode: " << DM.w << "x" << DM.h << " @ " << DM.refresh_rate << "Hz" << std::endl;
|
||||||
std::cout << "Window resolution : " << param.game.width << "x" << param.game.height << " x" << options.video.window.size << std::endl;
|
std::cout << "Window resolution : " << param.game.width << "x" << param.game.height << " x" << options.video.window.size << std::endl;
|
||||||
|
|
||||||
|
// Calcula el máximo factor de zoom que se puede aplicar a la pantalla
|
||||||
|
options.video.window.max_size = std::min(DM.w / param.game.width, DM.h / param.game.height);
|
||||||
|
|
||||||
// Establece el filtro de la textura
|
// Establece el filtro de la textura
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(static_cast<int>(options.video.filter)).c_str()))
|
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(static_cast<int>(options.video.filter)).c_str()))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ enum class GameDifficulty
|
|||||||
// Estructura para las opciones de la ventana
|
// Estructura para las opciones de la ventana
|
||||||
struct OptionsWindow
|
struct OptionsWindow
|
||||||
{
|
{
|
||||||
int size; // Contiene el valor por el que se multiplica el tamaño de la ventana
|
int size = 1; // Contiene el valor por el que se multiplica el tamaño de la ventana
|
||||||
|
int max_size = 1; // Tamaño máximo para que el tamaño de la ventana no sea mayor que el tamaño de la pantalla
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura con opciones para el video
|
// Estructura con opciones para el video
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ void Screen::decWindowSize()
|
|||||||
void Screen::incWindowSize()
|
void Screen::incWindowSize()
|
||||||
{
|
{
|
||||||
++options.video.window.size;
|
++options.video.window.size;
|
||||||
options.video.window.size = std::min(options.video.window.size, 4);
|
options.video.window.size = std::min(options.video.window.size, options.video.window.max_size);
|
||||||
setVideoMode(ScreenVideoMode::WINDOW);
|
setVideoMode(ScreenVideoMode::WINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user