GamepadWidget Class
A debug widget to visualize the state of a specific gamepad. More...
Declaration
Base class
| class | ImGuiWidget |
|
Abstract base class for ImGui widgets rendered in debug overlays. More... | |
Public Constructors Index
| GamepadWidget (helios::input::InputManager *inputManager) | |
|
Constructs the GamepadWidget. More... | |
Public Member Functions Index
| void | draw () override |
|
Renders the gamepad debug interface using ImGui. More... | |
Private Member Functions Index
| helios::input::types::Gamepad | indexToId (int index) noexcept |
|
Helper to map an integer index (0-3) to a Gamepad enum ID. More... | |
| void | drawStickVisualizer (const char *label, const helios::math::vec2f &value, float radius) |
|
Helper method to draw a visual representation of an analog stick. More... | |
| void | drawSettingsPanel (helios::input::types::Gamepad gamepadId) |
|
Draws the settings panel for the currently selected gamepad. More... | |
Private Member Attributes Index
| helios::input::InputManager * | inputManager_ = nullptr |
|
Pointer to the InputManager used to query gamepad states and access settings. Non-owning pointer; must be valid for the lifetime of this widget. More... | |
| int | selectedGamepadIndex_ = 0 |
|
The currently selected index in the UI combo box (0-3). Maps to Gamepad::ONE through Gamepad::FOUR. More... | |
| bool | showSettings_ = true |
|
Flag to control visibility of the settings panel. More... | |
Description
A debug widget to visualize the state of a specific gamepad.
This widget provides a comprehensive visual overview of a connected gamepad's state. It includes:
- **Connection Status:** Live indicator if the gamepad is connected.
- **Stick Visualization:** 2D plot showing the position of left/right analog sticks within a circular boundary.
- **Triggers:** Progress bars visualizing the pressure level of left/right triggers.
- **Buttons:** Read-only checkboxes showing the current pressed state of all standard gamepad buttons.
- **Settings Panel:** Integrated configuration for deadzone and axis inversion (toggle via button).
The widget allows switching between different Gamepad IDs (1-4) at runtime via a dropdown menu. Settings configuration is automatically available through the InputManager's InputAdapter.
This widget is not thread-safe. Use from the main/render thread only.
Definition at line 43 of file GamepadWidget.ixx.
Public Constructors
GamepadWidget()
| inline explicit |
Constructs the GamepadWidget.
- Parameters
-
inputManager Pointer to the InputManager to query states and settings from. Pass nullptr to render an empty/disabled widget.
Definition at line 180 of file GamepadWidget.ixx.
Public Member Functions
draw()
| inline virtual |
Renders the gamepad debug interface using ImGui.
Definition at line 186 of file GamepadWidget.ixx.
Private Member Functions
drawSettingsPanel()
| inline |
Draws the settings panel for the currently selected gamepad.
- Parameters
-
gamepadId The gamepad to configure.
Definition at line 121 of file GamepadWidget.ixx.
drawStickVisualizer()
| inline |
Helper method to draw a visual representation of an analog stick.
Draws a circle representing the boundary and a dot representing the stick's position.
- Parameters
-
label The label to display below the visualizer.
value The normalized (x, y) vector of the stick axis.
radius The radius of the visualization circle in pixels.
Definition at line 88 of file GamepadWidget.ixx.
indexToId()
| inline nodiscard noexcept |
Helper to map an integer index (0-3) to a Gamepad enum ID.
- Parameters
-
index The index selected in the UI.
- Returns
The corresponding Gamepad enum value.
Definition at line 69 of file GamepadWidget.ixx.
Private Member Attributes
inputManager_
|
Pointer to the InputManager used to query gamepad states and access settings. Non-owning pointer; must be valid for the lifetime of this widget.
Definition at line 50 of file GamepadWidget.ixx.
selectedGamepadIndex_
|
The currently selected index in the UI combo box (0-3). Maps to Gamepad::ONE through Gamepad::FOUR.
Definition at line 56 of file GamepadWidget.ixx.
showSettings_
|
Flag to control visibility of the settings panel.
Definition at line 61 of file GamepadWidget.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.