afegit SDL_ScaleMode scale_mode a VideoOptions

This commit is contained in:
2025-03-27 21:20:45 +01:00
parent 36b3048070
commit 11d015daf8
7 changed files with 22 additions and 39 deletions

View File

@@ -1,12 +1,11 @@
#include "options.h"
#include <SDL3/SDL_log.h> // Para SDL_LogCategory, SDL_LogInfo, SDL_LogWarn
#include <SDL3/SDL_log.h> // Para SDL_LogCategory, SDL_LogInfo, SDL_LogError
#include <algorithm> // Para clamp
#include <fstream> // Para basic_ostream, operator<<, basic_ostream::...
#include <utility> // Para swap
#include <vector> // Para vector
#include "input.h" // Para InputDeviceToUse
#include "lang.h" // Para Code
#include "screen.h" // Para ScreenFilter
#include "utils.h" // Para boolToString, stringToBool, getFileName
// Variables
@@ -23,7 +22,7 @@ void initOptions()
// Opciones de video
options.video.fullscreen = false;
options.video.filter = ScreenFilter::NEAREST;
options.video.scale_mode = SDL_ScaleMode::SDL_SCALEMODE_NEAREST;
options.video.v_sync = true;
options.video.integer_scale = true;
options.video.shaders = false;
@@ -118,12 +117,12 @@ bool saveOptionsFile(std::string file_path)
// Opciones de video
file << "## VIDEO\n";
file << "## video.filter [" << static_cast<int>(ScreenFilter::NEAREST) << ": nearest, " << static_cast<int>(ScreenFilter::LINEAL) << ": lineal]\n";
file << "## video.scale_mode [" << static_cast<int>(SDL_ScaleMode::SDL_SCALEMODE_NEAREST) << ": nearest, " << static_cast<int>(SDL_ScaleMode::SDL_SCALEMODE_LINEAR) << ": lineal]\n";
file << "\n";
file << "window.zoom=" << options.window.zoom << "\n";
file << "video.fullscreen=" << boolToString(options.video.fullscreen) << "\n";
file << "video.filter=" << static_cast<int>(options.video.filter) << "\n";
file << "video.scale_mode=" << static_cast<int>(options.video.scale_mode) << "\n";
file << "video.v_sync=" << boolToString(options.video.v_sync) << "\n";
file << "video.integer_scale=" << boolToString(options.video.integer_scale) << "\n";
file << "video.shaders=" << boolToString(options.video.shaders) << "\n";
@@ -190,14 +189,10 @@ bool setOptions(const std::string &var, const std::string &value)
else if (var == "window.zoom")
{
options.window.zoom = std::stoi(value);
if ((options.window.zoom < 1) || (options.window.zoom > 4))
{
options.window.zoom = 3;
}
}
else if (var == "video.filter")
else if (var == "video.scale_mode")
{
options.video.filter = static_cast<ScreenFilter>(std::stoi(value));
options.video.scale_mode = static_cast<SDL_ScaleMode>(std::stoi(value));
}
else if (var == "video.shaders")
{