feat(input): assignació mando↔jugador persistida a config.yaml
This commit is contained in:
1 parent
4e9d5df872
commit
a725b76684
5 files changed
+226
-13
No files matched your search
@@ -104,10 +104,26 @@ namespace Options {
|
||||
Sound sound{};
|
||||
};
|
||||
|
||||
// Assignació d'un mando a un jugador: nom visible (el que retorna
|
||||
// `GamepadManager::Info::name`) + ruta física (de `SDL_GetGamepadPath`).
|
||||
// Tots dos buits = sense mando. La ruta serveix per re-vincular
|
||||
// automàticament el mateix mando al mateix port; el nom és el
|
||||
// fallback quan l'usuari el canvia de port USB.
|
||||
struct GamepadAssignment {
|
||||
std::string name;
|
||||
std::string path;
|
||||
};
|
||||
|
||||
struct Controls {
|
||||
GamepadAssignment gamepad_p1{};
|
||||
GamepadAssignment gamepad_p2{};
|
||||
};
|
||||
|
||||
// --- Getters de l'estat (read-only) ---
|
||||
[[nodiscard]] auto window() -> const Window&;
|
||||
[[nodiscard]] auto video() -> const Video&;
|
||||
[[nodiscard]] auto audio() -> const Audio&;
|
||||
[[nodiscard]] auto controls() -> const Controls&;
|
||||
[[nodiscard]] auto locale() -> const std::string&;
|
||||
[[nodiscard]] auto configVersion() -> const std::string&;
|
||||
[[nodiscard]] auto postfxPresets() -> const std::vector<PostFXPreset>&;
|
||||
@@ -132,6 +148,10 @@ namespace Options {
|
||||
void setAudioMusicVolume(float value);
|
||||
void setAudioSoundEnabled(bool value);
|
||||
void setAudioSoundVolume(float value);
|
||||
// Fixa l'assignació mando→jugador. Persisteix a `config.yaml` i
|
||||
// propaga a `GamepadManager::assignToPlayer`. `name` i `path` buits
|
||||
// = desassignació. `player_id`: 0 = P1, 1 = P2.
|
||||
void setGamepadAssignment(int player_id, const std::string& name, const std::string& path);
|
||||
|
||||
// --- API pública: càrrega/desament de fitxers ---
|
||||
void setConfigFile(const std::string& path);
|
||||
|
||||
Reference in new issue
Block a user