Input: mogudes structs, enums i consts a la part publica

This commit is contained in:
2025-07-30 08:53:57 +02:00
parent 677feb3afe
commit 989f081a25
14 changed files with 302 additions and 275 deletions

View File

@@ -189,7 +189,7 @@ void parseAndSetController(const std::string& var, const std::string& value) {
} else if (setting_key == "player") {
controller.player_id = std::clamp(std::stoi(value), 1, 2);
} else if (setting_key == "type") {
controller.type = static_cast<InputDevice>(std::stoi(value));
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") {
@@ -272,9 +272,9 @@ auto set(const std::string& var, const std::string& value) -> bool {
void setKeyboardToPlayer(int player_id) {
for (auto& controller : controllers) {
if (controller.player_id == player_id) {
controller.type = InputDevice::ANY;
controller.type = Input::Device::ANY;
} else {
controller.type = InputDevice::CONTROLLER;
controller.type = Input::Device::CONTROLLER;
}
}
}
@@ -293,7 +293,7 @@ void swapControllers() {
// Averigua quien está usando el teclado
auto getPlayerWhoUsesKeyboard() -> int {
for (const auto& controller : controllers) {
if (controller.type == InputDevice::ANY) {
if (controller.type == Input::Device::ANY) {
return controller.player_id;
}
}