QtCraft API C++ classes QML types Handbook

QcGamepadMapping::Bindings Struct

struct QcGamepadMapping::Bindings

Default bindings (Auftrag point 40, decisions E-541 and E-580, after the console layout of the model): south jumps (double tap: creative flight), the left stick click sprints, the right stick click sneaks, the shoulders step through the hotbar; start pauses, north opens the inventory, east drops, west picks the block in view; the d-pad holds the radial menu (left), switches the camera (up), opens the chat (down) and the handbook (right); back holds the player list. More...

Header: #include <clientcore/input/QcGamepadMapping.h>

Public Functions

std::optional<QcGamepadMapping::Action> action(QcGamepadButton button) const
std::optional<QcGamepadMapping::Action> bind(QcGamepadMapping::Action action, QcGamepadButton button)
std::optional<QcGamepadButton> button(QcGamepadMapping::Action action) const
QList<QcGamepadMapping::Action> conflicts() const
void setButton(QcGamepadMapping::Action action, QcGamepadButton button)
std::optional<QcGamepadMapping::Action> stranded(QcGamepadMapping::Action action, QcGamepadButton button) const

Detailed Description

The triggers (right mines and attacks, left uses) are axes and not in this table.

Member Function Documentation

std::optional<QcGamepadMapping::Action> Bindings::action(QcGamepadButton button) const

Returns the action on button, nullopt for a free one (the first in table order for a table in conflict).

std::optional<QcGamepadMapping::Action> Bindings::bind(QcGamepadMapping::Action action, QcGamepadButton button)

Binds button to action (decision E-611). An action that had the button already gets the action's old one (a swap, which leaves it without a button when the action had none), so every button keeps at most one action; returns that action. Refused (nullopt, nothing changes) for the triggers, buttons that cannot be bound and a swap that would leave an action bound by default without a button (stranded).

std::optional<QcGamepadButton> Bindings::button(QcGamepadMapping::Action action) const

Returns the button of action; nullopt for the triggers and actions without a button.

See also setButton().

QList<QcGamepadMapping::Action> Bindings::conflicts() const

Returns the actions sharing a button with an earlier one in table order; empty for a usable table.

void Bindings::setButton(QcGamepadMapping::Action action, QcGamepadButton button)

Sets button for the rebindable action as it is (unbound too), without resolving conflicts (loading).

See also button().

std::optional<QcGamepadMapping::Action> Bindings::stranded(QcGamepadMapping::Action action, QcGamepadButton button) const

Returns the action bound by default (pause, jump, ...) that binding button to action would leave without a button, because action has none to give in the swap; nullopt when the bind is fine.