RemapControlsSection class
Remap controls menu section.
Lists the player actions and lets the player rebind the individual control mappings for a given player by assigning new keyboard, gamepad, or touch inputs.
Base classes
-
template<class TItem>class ScrollableMenuSection<RemapControlsItem>
- Simplifies creation of unified scrollable menu sections.
Constructors, destructors, conversion operators
-
RemapControlsSection(std::
int32_t playerIndex) - Creates a new instance for the specified player.
- ~RemapControlsSection() override
Public functions
Protected functions
- void OnLayoutItem(Canvas* canvas, ListViewItem& item) override
- Called when an item layout should be calculated.
-
void OnDrawItem(Canvas* canvas,
ListViewItem& item,
std::
int32_t& charOffset, bool isSelected) override - Called when an item should be drawn.
- void OnKeyPressed(const KeyboardEvent& event) override
- Called when a key is pressed.
- void OnHandleInput() override
- Called when input should be handled.
- void OnExecuteSelected() override
- Called when the selected item should be executed.
-
void OnTouchUp(std::
int32_t newIndex, Vector2i viewSize, Vector2i touchPos) override - Called when a touch event is released.
- void OnBackPressed() override
- Called when back button is pressed.
- void RefreshPreviousState()
- Refreshes the cached gamepad states.
-
auto HasCollision(PlayerAction action,
MappingTarget target,
PlayerAction& collidingAction,
std::
int32_t& collidingAssignment) -> bool - Returns
trueif the specified mapping target is already assigned to another action.
Protected variables
-
std::
int32_t _selectedColumn - Index of the currently selected mapping target column.
-
std::
int32_t _playerIndex - Index of the player whose controls are being remapped.
- float _timeout
- Remaining time to wait for input before the assignment is cancelled.
- float _hintAnimation
- Animation progress of the input hint.
- JoyMappedState _joyStatesLast
- Last sampled gamepad states, used to detect newly pressed buttons.
- bool _isDirty
- Whether the mapping has unsaved changes.
- bool _waitForInput
- Whether the section is currently waiting for input to assign.
- bool _waitForInputPrev
- Value of _
waitForInput from the previous frame.
Constants
-
static std::
int32_t MaxTargetCount constexpr - Maximum number of mapping targets.