JustAnotherDnDGame 0.1.0
Jeu de rôle tactique au d20, vue de dessus, en C++/Qt
Loading...
Searching...
No Matches
GamepadBindingsWidget.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 <QWidget>
7#include <array>
8#include <filesystem>
9
10#include "HMI/Input/GameKeyBindings.h" // GAME_ACTION_COUNT
14
19
20class QLabel;
21class QPushButton;
22class QTimer;
23
24namespace hmi {
25
26class Localization;
27
38class GamepadBindingsWidget : public QWidget {
39 Q_OBJECT
40
41public:
42 GamepadBindingsWidget(hmi::GamepadBindings& bindings, std::filesystem::path savePath,
43 QWidget* parent = nullptr);
44
46 void retranslateUi(const Localization& loc);
47
48protected:
50 void showEvent(QShowEvent* event) override;
51 void hideEvent(QHideEvent* event) override;
52
53private:
54 void startCapture(int index);
55 void onCaptureTick();
56 void refresh();
58 void updateStatus();
59
61 std::filesystem::path _savePath;
62 int _capturing = -1;
65 QTimer* _timer;
66 QTimer* _statusTimer = nullptr;
67 std::array<QPushButton*, hmi::GAME_ACTION_COUNT> _buttons{};
68 std::array<QLabel*, hmi::GAME_ACTION_COUNT> _actionLabels{};
69 QLabel* _help = nullptr;
70 QLabel* _status = nullptr;
71 const Localization* _loc = nullptr;
72};
73
74} // namespace hmi
Association remappable action de jeu -> touche clavier, avec persistance (EX-CTRL-012).
Association remappable action de jeu -> bouton manette, avec persistance (EX-CTRL-002,...
Sondage XInput de la manette, fusionné dans un InputState (réutilisable).
État des entrées clavier/souris/manette échantillonné une fois par frame.
void startCapture(int index)
Definition GamepadBindingsWidget.cpp:109
hmi::GamepadPoller _poller
Definition GamepadBindingsWidget.h:63
QLabel * _status
État de connexion de la manette (informatif).
Definition GamepadBindingsWidget.h:70
void refresh()
Definition GamepadBindingsWidget.cpp:138
std::filesystem::path _savePath
Definition GamepadBindingsWidget.h:61
hmi::GamepadBindings & _bindings
Definition GamepadBindingsWidget.h:60
int _capturing
Definition GamepadBindingsWidget.h:62
void retranslateUi(const Localization &loc)
Applique la langue active (libellés d'actions, invite de capture, aide, état manette).
Definition GamepadBindingsWidget.cpp:98
const Localization * _loc
Definition GamepadBindingsWidget.h:71
void updateStatus()
Sonde la manette et met à jour le libellé d'état (connectée / non connectée).
Definition GamepadBindingsWidget.cpp:75
void onCaptureTick()
Definition GamepadBindingsWidget.cpp:122
std::array< QLabel *, hmi::GAME_ACTION_COUNT > _actionLabels
Definition GamepadBindingsWidget.h:68
QLabel * _help
Definition GamepadBindingsWidget.h:69
QTimer * _statusTimer
Sondage périodique de l'état de connexion (hors capture).
Definition GamepadBindingsWidget.h:66
void showEvent(QShowEvent *event) override
Démarre/arrête le sondage d'état manette avec la visibilité de l'onglet.
Definition GamepadBindingsWidget.cpp:85
GamepadBindingsWidget(hmi::GamepadBindings &bindings, std::filesystem::path savePath, QWidget *parent=nullptr)
Definition GamepadBindingsWidget.cpp:36
void hideEvent(QHideEvent *event) override
Definition GamepadBindingsWidget.cpp:93
hmi::InputState _input
Definition GamepadBindingsWidget.h:64
QTimer * _timer
Definition GamepadBindingsWidget.h:65
std::array< QPushButton *, hmi::GAME_ACTION_COUNT > _buttons
Definition GamepadBindingsWidget.h:67
Association action de jeu (GameAction, partagée avec GameKeyBindings) -> bouton manette,...
Definition GamepadBindings.h:31
Sonde la manette (XInput, joueur 0) et fusionne son état dans un InputState.
Definition GamepadPoller.h:57
État des entrées d'une frame, avec détection des fronts (pressée / relâchée).
Definition InputState.h:97
Catalogue de traduction (i18n) : associe des clés stables à des chaînes selon la langue active,...
Definition Localization.h:29
Definition AudioEngine.cpp:15