canvis de upscale i downscale en consola

This commit is contained in:
2026-03-28 00:37:52 +01:00
parent 8355c266a6
commit a7f0a18e6d
6 changed files with 69 additions and 4 deletions

View File

@@ -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,