- afegides noves paletes

- ordenades les paletes que tenien els color mal ubicats
- eliminades responsabilitats a Options sobre les paletes
- "pretty" name per a les paletes (canvia els "-" per " ")
- nova tool/ en python per a reordenar paletes
This commit is contained in:
2026-03-31 20:02:18 +02:00
parent 417643018f
commit c689507982
28 changed files with 424 additions and 137 deletions

View File

@@ -11,6 +11,7 @@
#include "core/input/input_types.hpp" // Para BUTTON_TO_STRING, STRING_TO_BUTTON
#include "external/fkyaml_node.hpp" // Para fkyaml::node
#include "game/defaults.hpp" // Para GameDefaults::VERSION
#include "utils/utils.hpp" // Para toLower
namespace Options {
@@ -177,24 +178,6 @@ namespace Options {
{"LEFT_STICK_LEFT", 200},
{"LEFT_STICK_RIGHT", 201}};
// Lista de paletas válidas
const std::vector<std::string> VALID_PALETTES = {
"black-and-white",
"green-phosphor",
"island-joy-16",
"lost-century",
"na16",
"orange-screen",
"pico-8",
"ruzx-spectrum",
"ruzx-spectrum-revision-2",
"steam-lords",
"sweetie-16",
"sweetie-16_bona",
"zx-spectrum",
"zx-spectrum-adjusted",
"zxarne-5-2"};
// Funciones helper de conversión
auto filterToString(Screen::Filter filter) -> std::string {
auto it = FILTER_TO_STRING.find(filter);
@@ -257,12 +240,6 @@ namespace Options {
}
}
auto isValidPalette(const std::string& palette) -> bool {
std::string lower_palette = palette;
std::ranges::transform(lower_palette, lower_palette.begin(), ::tolower);
return std::ranges::any_of(VALID_PALETTES, [&lower_palette](const auto& valid) { return valid == lower_palette; });
}
// --- Funciones helper para loadFromFile() ---
// Carga configuración de ventana desde YAML
@@ -309,12 +286,12 @@ namespace Options {
}
}
// Helper: carga el campo palette con validación extra
// Helper: carga el campo palette; PaletteManager hará el fallback si el nombre no existe
void loadPaletteFromYaml(const fkyaml::node& vid) {
if (!vid.contains("palette")) { return; }
try {
auto palette_str = vid["palette"].get_value<std::string>();
video.palette = isValidPalette(palette_str) ? palette_str : Defaults::Video::PALETTE_NAME;
video.palette = toLower(palette_str);
} catch (...) {
video.palette = Defaults::Video::PALETTE_NAME;
}