diff --git a/source/common/screen.cpp b/source/common/screen.cpp index 5d30fd9..b5a9479 100644 --- a/source/common/screen.cpp +++ b/source/common/screen.cpp @@ -16,8 +16,8 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options gameCanvasWidth = options->gameWidth; gameCanvasHeight = options->gameHeight; - borderWidth = options->gameWidth * options->borderSize; - borderHeight = options->gameHeight * options->borderSize; + borderWidth = options->borderWidth * 2; + borderHeight = options->borderHeight * 2; notificationLogicalWidth = gameCanvasWidth; notificationLogicalHeight = gameCanvasHeight; @@ -203,9 +203,15 @@ void Screen::setBlendMode(SDL_BlendMode blendMode) } // Establece el tamaño del borde -void Screen::setBorderSize(float s) +void Screen::setBorderWidth(int s) { - options->borderSize = s; + options->borderWidth = s; +} + +// Establece el tamaño del borde +void Screen::setBorderHeight(int s) +{ + options->borderHeight = s; } // Establece si se ha de ver el borde en el modo ventana diff --git a/source/common/screen.h b/source/common/screen.h index deacea9..0c19343 100644 --- a/source/common/screen.h +++ b/source/common/screen.h @@ -101,7 +101,8 @@ public: void setBlendMode(SDL_BlendMode blendMode); // Establece el tamaño del borde - void setBorderSize(float s); + void setBorderWidth(int s); + void setBorderHeight(int s); // Establece si se ha de ver el borde en el modo ventana void setBorderEnabled(bool value); diff --git a/source/common/utils.h b/source/common/utils.h index 57e236f..a5834a0 100644 --- a/source/common/utils.h +++ b/source/common/utils.h @@ -136,7 +136,8 @@ struct options_t bool integerScale; // Indica si el escalado de la imagen ha de ser entero en el modo a pantalla completa bool keepAspect; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa bool borderEnabled; // Indica si ha de mostrar el borde en el modo de ventana - float borderSize; // Porcentaje de borde que se añade a lo ventana + int borderWidth; // Cantidad de pixels que se añade en el borde de la ventana + int borderHeight; // Cantidad de pixels que se añade en el borde de la ventana palette_e palette; // Paleta de colores a usar en el juego bool console; // Indica si ha de mostrar información por la consola de texto cheat_t cheat; // Contiene trucos y ventajas para el juego diff --git a/source/director.cpp b/source/director.cpp index 850c0b7..7ebe4e7 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -125,7 +125,8 @@ void Director::initOptions() options->integerScale = true; options->keepAspect = true; options->borderEnabled = true; - options->borderSize = 0.2f; + options->borderWidth = 32; + options->borderHeight = 24; options->palette = p_zxspectrum; // Estos valores no se guardan en el fichero de configuraci´ón @@ -358,7 +359,8 @@ bool Director::saveConfig() file << "integerScale=" + boolToString(options->integerScale) + "\n"; file << "keepAspect=" + boolToString(options->keepAspect) + "\n"; file << "borderEnabled=" + boolToString(options->borderEnabled) + "\n"; - file << "borderSize=" + std::to_string(options->borderSize) + "\n"; + file << "borderWidth=" + std::to_string(options->borderWidth) + "\n"; + file << "borderHeight=" + std::to_string(options->borderHeight) + "\n"; file << "palette=" + std::to_string(options->palette) + "\n"; file << "\n## ONLINE OPTIONS\n"; @@ -1097,13 +1099,14 @@ bool Director::setOptions(options_t *options, std::string var, std::string value options->borderEnabled = stringToBool(value); } - else if (var == "borderSize") + else if (var == "borderWidth") { - options->borderSize = std::stof(value); - if (options->borderSize < 0.0f || options->borderSize > 0.5f) - { - options->borderSize = 0.1f; - } + options->borderWidth = std::stoi(value); + } + + else if (var == "borderHeight") + { + options->borderHeight = std::stoi(value); } else if (var == "palette") @@ -1278,8 +1281,8 @@ bool Director::initSDL() int incH = 0; if (options->borderEnabled) { - incW = options->gameWidth * options->borderSize; - incH = options->gameHeight * options->borderSize; + incW = options->borderWidth * 2; + incH = options->borderHeight * 2; } window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options->gameWidth + incW) * options->windowSize, (options->gameHeight + incH) * options->windowSize, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);