migrant input: ja es poden redefinir els botons. Falta rebindar les accions a accions
This commit is contained in:
@@ -126,6 +126,8 @@ class Input {
|
||||
}
|
||||
};
|
||||
|
||||
using Gamepads = std::vector<std::shared_ptr<Gamepad>>;
|
||||
|
||||
// --- Métodos de singleton ---
|
||||
static void init(const std::string &game_controller_db_path, const std::string &gamepad_configs_file);
|
||||
static void destroy();
|
||||
@@ -146,7 +148,8 @@ class Input {
|
||||
[[nodiscard]] auto gameControllerFound() const -> bool;
|
||||
auto getControllerName(std::shared_ptr<Gamepad> gamepad) const -> std::string;
|
||||
[[nodiscard]] auto getNumGamepads() const -> int;
|
||||
[[nodiscard]] auto getJoyIndex(SDL_JoystickID id) const -> int;
|
||||
std::shared_ptr<Gamepad> getGamepad(SDL_JoystickID id) const;
|
||||
const Gamepads& getGamepads() const { return gamepads_; }
|
||||
|
||||
// --- Métodos de consulta y utilidades ---
|
||||
[[nodiscard]] auto getControllerBinding(std::shared_ptr<Gamepad> gamepad, Action input) const -> SDL_GamepadButton;
|
||||
@@ -161,15 +164,16 @@ class Input {
|
||||
|
||||
void printConnectedGamepads() const;
|
||||
|
||||
[[nodiscard]] auto getGamepads() const -> const std::vector<std::shared_ptr<Gamepad>> & { return gamepads_; }
|
||||
//[[nodiscard]] auto getGamepads() const -> const Gamepads & { return gamepads_; }
|
||||
std::shared_ptr<Gamepad> findAvailableGamepadByName(const std::string &gamepad_name);
|
||||
void saveGamepadConfigFromGamepad(std::shared_ptr<Gamepad> gamepad);
|
||||
|
||||
private:
|
||||
// --- Constantes ---
|
||||
static constexpr Sint16 AXIS_THRESHOLD = 30000;
|
||||
|
||||
// --- Variables internas ---
|
||||
std::vector<std::shared_ptr<Gamepad>> gamepads_;
|
||||
Gamepads gamepads_;
|
||||
Keyboard keyboard_;
|
||||
std::vector<Action> button_inputs_;
|
||||
std::string gamepad_mappings_file_;
|
||||
@@ -188,7 +192,6 @@ class Input {
|
||||
void loadGamepadConfigs();
|
||||
void saveGamepadConfigs();
|
||||
void applyGamepadConfig(std::shared_ptr<Gamepad> gamepad);
|
||||
void saveGamepadConfigFromGamepad(std::shared_ptr<Gamepad> gamepad);
|
||||
|
||||
// Métodos auxiliares opcionales
|
||||
void setGamepadConfigsFile(const std::string &filename);
|
||||
|
||||
Reference in New Issue
Block a user