migrant input: ja compila, ja no peta... falta descomentar mig codi

This commit is contained in:
2025-07-31 12:02:16 +02:00
parent 2d9a6e744e
commit 89a0638a89
13 changed files with 171 additions and 142 deletions

View File

@@ -25,7 +25,7 @@ VideoOptions video; // Opciones de vídeo
AudioOptions audio; // Opciones de audio
std::vector<GamepadOptions> controllers; // Opciones de mando para cada jugador
PendingChanges pending_changes; // Opciones que se aplican al cerrar
std::vector<GamepadConfig> gamepad_configs; // Lista con las configuraciones registradas para cada mando
//std::vector<GamepadConfig> gamepad_configs; // Lista con las configuraciones registradas para cada mando
// Declaraciones
auto set(const std::string& var, const std::string& value) -> bool;
@@ -160,11 +160,6 @@ auto saveToFile() -> bool {
file << "controller." << controller_index << ".name=" << controller.name << "\n";
file << "controller." << controller_index << ".player=" << controller.player_id << "\n";
file << "controller." << controller_index << ".type=" << static_cast<int>(controller.type) << "\n";
file << "controller." << controller_index << ".button.fire_left=" << controller.buttons.at(0) << "\n";
file << "controller." << controller_index << ".button.fire_center=" << controller.buttons.at(1) << "\n";
file << "controller." << controller_index << ".button.fire_right=" << controller.buttons.at(2) << "\n";
file << "controller." << controller_index << ".button.start=" << controller.buttons.at(3) << "\n";
file << "controller." << controller_index << ".button.service=" << controller.buttons.at(4) << "\n";
// Incrementa el índice
++controller_index;
@@ -193,16 +188,6 @@ void parseAndSetController(const std::string& var, const std::string& value) {
controller.player_id = std::clamp(std::stoi(value), 1, 2);
} else if (setting_key == "type") {
controller.type = static_cast<Input::Device>(std::stoi(value));
} else if (setting_key == "button.fire_left") {
controller.buttons.at(0) = static_cast<SDL_GamepadButton>(std::stoi(value));
} else if (setting_key == "button.fire_center") {
controller.buttons.at(1) = static_cast<SDL_GamepadButton>(std::stoi(value));
} else if (setting_key == "button.fire_right") {
controller.buttons.at(2) = static_cast<SDL_GamepadButton>(std::stoi(value));
} else if (setting_key == "button.start") {
controller.buttons.at(3) = static_cast<SDL_GamepadButton>(std::stoi(value));
} else if (setting_key == "button.service") {
controller.buttons.at(4) = static_cast<SDL_GamepadButton>(std::stoi(value));
}
}