Cambiado el tamaño del borde de porcentaje a valor absoluto en pixeles

This commit is contained in:
2022-11-29 18:45:25 +01:00
parent 4a430c0d5b
commit c59739c7ba
4 changed files with 27 additions and 16 deletions

View File

@@ -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);