migrant input: ja guarda i llig configuracions de gamepad en fitxer

This commit is contained in:
2025-08-01 12:51:24 +02:00
parent 6385e413da
commit c066cc32d3
7 changed files with 260 additions and 127 deletions

View File

@@ -26,10 +26,12 @@ struct GamepadConfig {
}
};
using GamepadConfigs = std::vector<GamepadConfig>;
class GamepadConfigManager {
public:
// Escribir vector de GamepadConfig a archivo JSON
static bool writeToJson(const std::vector<GamepadConfig>& configs, const std::string& filename) {
static bool writeToJson(const GamepadConfigs& configs, const std::string& filename) {
try {
nlohmann::json j;
j["gamepads"] = nlohmann::json::array();
@@ -69,7 +71,7 @@ class GamepadConfigManager {
}
// Leer vector de GamepadConfig desde archivo JSON
static bool readFromJson(std::vector<GamepadConfig>& configs, const std::string& filename) {
static bool readFromJson(GamepadConfigs& configs, const std::string& filename) {
try {
std::ifstream file(filename);
if (!file.is_open()) {