canvis de upscale i downscale en consola
This commit is contained in:
@@ -30,6 +30,8 @@ namespace Defaults::Video {
|
||||
constexpr bool INTEGER_SCALE = true; // Escalado entero activado por defecto
|
||||
constexpr bool KEEP_ASPECT = true; // Mantener aspecto activado por defecto
|
||||
constexpr const char* PALETTE_NAME = "zx-spectrum"; // Paleta por defecto
|
||||
constexpr bool LINEAR_UPSCALE = false; // Upscale NEAREST por defecto
|
||||
constexpr int DOWNSCALE_ALGO = 1; // Downscale Lanczos2 por defecto
|
||||
} // namespace Defaults::Video
|
||||
|
||||
namespace Defaults::Border {
|
||||
|
||||
@@ -388,6 +388,22 @@ namespace Options {
|
||||
}
|
||||
}
|
||||
|
||||
if (vid.contains("linear_upscale")) {
|
||||
try {
|
||||
video.linear_upscale = vid["linear_upscale"].get_value<bool>();
|
||||
} catch (...) {
|
||||
video.linear_upscale = Defaults::Video::LINEAR_UPSCALE;
|
||||
}
|
||||
}
|
||||
|
||||
if (vid.contains("downscale_algo")) {
|
||||
try {
|
||||
video.downscale_algo = vid["downscale_algo"].get_value<int>();
|
||||
} catch (...) {
|
||||
video.downscale_algo = Defaults::Video::DOWNSCALE_ALGO;
|
||||
}
|
||||
}
|
||||
|
||||
loadPaletteFromYaml(vid);
|
||||
}
|
||||
|
||||
@@ -644,6 +660,8 @@ namespace Options {
|
||||
file << " vertical_sync: " << (video.vertical_sync ? "true" : "false") << "\n";
|
||||
file << " integer_scale: " << (video.integer_scale ? "true" : "false") << "\n";
|
||||
file << " keep_aspect: " << (video.keep_aspect ? "true" : "false") << "\n";
|
||||
file << " linear_upscale: " << (video.linear_upscale ? "true" : "false") << "\n";
|
||||
file << " downscale_algo: " << video.downscale_algo << " # 0=bilinear, 1=Lanczos2, 2=Lanczos3\n";
|
||||
file << " palette: " << video.palette << "\n";
|
||||
file << " border:\n";
|
||||
file << " enabled: " << (video.border.enabled ? "true" : "false") << "\n";
|
||||
|
||||
@@ -84,9 +84,11 @@ namespace Options {
|
||||
bool supersampling{Defaults::Video::SUPERSAMPLING}; // Indica si el supersampling 3× está activo
|
||||
bool integer_scale{Defaults::Video::INTEGER_SCALE}; // Indica si el escalado de la imagen ha de ser entero en el modo a pantalla completa
|
||||
bool keep_aspect{Defaults::Video::KEEP_ASPECT}; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa
|
||||
Border border{}; // Borde de la pantalla
|
||||
std::string palette{Defaults::Video::PALETTE_NAME}; // Paleta de colores a usar en el juego
|
||||
std::string info; // Información sobre el modo de vídeo
|
||||
bool linear_upscale{Defaults::Video::LINEAR_UPSCALE}; // Upscale LINEAR (true) o NEAREST (false)
|
||||
int downscale_algo{Defaults::Video::DOWNSCALE_ALGO}; // 0=bilinear, 1=Lanczos2, 2=Lanczos3
|
||||
Border border{}; // Borde de la pantalla
|
||||
std::string palette{Defaults::Video::PALETTE_NAME}; // Paleta de colores a usar en el juego
|
||||
std::string info; // Información sobre el modo de vídeo
|
||||
};
|
||||
|
||||
// Estructura para las opciones de musica
|
||||
|
||||
@@ -69,6 +69,8 @@ static void printHelp() {
|
||||
SDL_Log(" FULLSCREEN [ON|OFF] Fullscreen mode (F3)");
|
||||
SDL_Log(" ZOOM [UP|DOWN] Window zoom (F1/F2)");
|
||||
SDL_Log(" INTSCALE [ON|OFF] Integer scaling (F7)");
|
||||
SDL_Log(" UPSCALE [NEAREST|LINEAR] SS upscale filter (toggle if no arg)");
|
||||
SDL_Log(" DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3] SS downscale algorithm");
|
||||
SDL_Log(" VSYNC [ON|OFF] Vertical sync");
|
||||
SDL_Log(" PALETTE [NEXT|PREV] Color palette (F5/F6)");
|
||||
#ifdef _DEBUG
|
||||
@@ -173,6 +175,41 @@ static const std::vector<ConsoleCommand> COMMANDS = {
|
||||
return std::string("IntScale ") + (Options::video.integer_scale ? "ON" : "OFF");
|
||||
}},
|
||||
|
||||
// UPSCALE [NEAREST|LINEAR] — Filtro de upscale en supersampling
|
||||
{.keyword = "UPSCALE", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
if (args.empty()) {
|
||||
Screen::get()->setLinearUpscale(!Options::video.linear_upscale);
|
||||
return std::string("Upscale: ") + (Options::video.linear_upscale ? "Linear" : "Nearest");
|
||||
}
|
||||
if (args[0] == "NEAREST") {
|
||||
if (!Options::video.linear_upscale) { return "Upscale already Nearest"; }
|
||||
Screen::get()->setLinearUpscale(false); return "Upscale: Nearest";
|
||||
}
|
||||
if (args[0] == "LINEAR") {
|
||||
if (Options::video.linear_upscale) { return "Upscale already Linear"; }
|
||||
Screen::get()->setLinearUpscale(true); return "Upscale: Linear";
|
||||
}
|
||||
return "Usage: UPSCALE [NEAREST|LINEAR]";
|
||||
}},
|
||||
|
||||
// DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3] — Algoritmo de downscale en supersampling
|
||||
{.keyword = "DOWNSCALE", .execute = [](const std::vector<std::string>& args) -> std::string {
|
||||
static const std::array<std::string_view, 3> NAMES = {"Bilinear", "Lanczos2", "Lanczos3"};
|
||||
if (args.empty()) {
|
||||
return std::string("Downscale: ") + std::string(NAMES[static_cast<size_t>(Options::video.downscale_algo)]);
|
||||
}
|
||||
int algo = -1;
|
||||
if (args[0] == "BILINEAR") { algo = 0; }
|
||||
if (args[0] == "LANCZOS2") { algo = 1; }
|
||||
if (args[0] == "LANCZOS3") { algo = 2; }
|
||||
if (algo == -1) { return "Usage: DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3]"; }
|
||||
if (Options::video.downscale_algo == algo) {
|
||||
return std::string("Downscale already ") + std::string(NAMES[static_cast<size_t>(algo)]);
|
||||
}
|
||||
Screen::get()->setDownscaleAlgo(algo);
|
||||
return std::string("Downscale: ") + std::string(NAMES[static_cast<size_t>(algo)]);
|
||||
}},
|
||||
|
||||
// VSYNC [ON|OFF] — Sincronización vertical
|
||||
{.keyword = "VSYNC", .execute = BOOL_TOGGLE_CMD("VSync",
|
||||
Options::video.vertical_sync,
|
||||
|
||||
Reference in New Issue
Block a user