JustAnotherDnDGame 0.1.0
Jeu de rôle tactique au d20, vue de dessus, en C++/Qt
Loading...
Searching...
No Matches
GameKeyBindings.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Valentin Eloy
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include <array>
7#include <cstddef>
8#include <filesystem>
9
11
16
17namespace hmi {
18
37
39constexpr int GAME_ACTION_COUNT = 7;
40
51public:
54
56 [[nodiscard]] Key key(GameAction action) const noexcept;
57
64 void setKey(GameAction action, Key newKey) noexcept;
65
67 void resetToDefaults() noexcept;
68
70 [[nodiscard]] static Key defaultKey(GameAction action) noexcept;
71
77 bool save(const std::filesystem::path& path) const;
78
84 [[nodiscard]] static GameKeyBindings load(const std::filesystem::path& path);
85
86private:
87 std::array<Key, GAME_ACTION_COUNT> _keys{};
88};
89
90} // namespace hmi
État des entrées clavier/souris/manette échantillonné une fois par frame.
GameKeyBindings()
Construit avec les valeurs par défaut (flèches/Espace/Maj/E, cf. PlayerInputMapper....
Definition GameKeyBindings.cpp:61
Key key(GameAction action) const noexcept
Definition GameKeyBindings.cpp:65
std::array< Key, GAME_ACTION_COUNT > _keys
Definition GameKeyBindings.h:87
void resetToDefaults() noexcept
Restaure les sept actions à leurs touches par défaut (defaultKey).
Definition GameKeyBindings.cpp:82
static GameKeyBindings load(const std::filesystem::path &path)
Charge la section "jeu" de path.
Definition GameKeyBindings.cpp:122
static Key defaultKey(GameAction action) noexcept
Definition GameKeyBindings.cpp:41
void setKey(GameAction action, Key newKey) noexcept
Lie action à newKey.
Definition GameKeyBindings.cpp:71
bool save(const std::filesystem::path &path) const
Sauvegarde dans la section "jeu" de path, en préservant une section "editeur" déjà présente (écrite p...
Definition GameKeyBindings.cpp:91
Definition AudioEngine.cpp:15
@ Jump
Definition ProceduralAtlas.h:27
GameAction
Action de jeu logique, remappable indépendamment de la touche physique qui la déclenche.
Definition GameKeyBindings.h:28
@ Dash
Definition GameKeyBindings.h:34
@ MoveRight
Definition GameKeyBindings.h:30
@ AimUp
Definition GameKeyBindings.h:31
@ AimDown
Definition GameKeyBindings.h:32
@ MoveLeft
Definition GameKeyBindings.h:29
@ Interact
Definition GameKeyBindings.h:35
Key
Touche du clavier, identifiée par son code virtuel Win32.
Definition InputState.h:29
constexpr int GAME_ACTION_COUNT
Nombre d'actions de jeu remappables (GameAction).
Definition GameKeyBindings.h:39