QtCraft API C++ classes QML types Handbook

QcGamepadMenuInput Class

What a pad does on the screens (decision E-583), without a window: the d-pad or the left stick move the focus (held: repeated after repeatDelayMs every repeatIntervalMs), south confirms, east goes back, west and north are the secondary actions (in slot screens: one item, quick move), start, and the shoulders switch tabs; the right stick scrolls. More...

Header: #include <clientcore/input/QcGamepadMenuInput.h>
Inherits: QObject

Public Types

enum class Command { Up, Down, Left, Right, Confirm, …, TabNext }
Gate

Public Functions

QcGamepadMenuInput(const QcGamepadMenuInput &)
QcGamepadMenuInput(QcGamepadMenuInput &&)
void advance(qint64 nowMs)
qint64 now() const
void setGate(QcGamepadMenuInput::Gate gate)
void setSource(QcGamepadSource *source)
QcGamepadMenuInput &operator=(QcGamepadMenuInput &&)
QcGamepadMenuInput &operator=(const QcGamepadMenuInput &)

Signals

void command(QcGamepadMenuInput::Command command)
void scrolled(float pixels)
void scrolledSideways(float pixels)

Static Public Members

std::optional<QcGamepadMenuInput::Command> direction(const QcGamepadState &raw)
const qint64 repeatDelayMs
const qint64 repeatIntervalMs
const float scrollDeadZone
const float scrollSpeed
const float stickDirection
const int timerIntervalMs

Detailed Description

Any pad counts. Commands come from the source's state changes and, for repeats and scrolling, from a timer that runs only while a direction is held or the right stick is pushed. The window side (QcMenuNavigator) acts on them; whether screens take them at all decides its owner through the gate: while it is closed (the world takes the pad) held directions and the scrolling stick are dropped, and once it opens they count again only after they went back to neutral, so a direction or a look held in the world does not run on in a screen that opens. Lives in one thread.

Member Type Documentation

enum class QcGamepadMenuInput::Command

What a pad asks of the screens.

ConstantValueDescription
QcGamepadMenuInput::Command::Up0moves the focus up
QcGamepadMenuInput::Command::Down1moves the focus down
QcGamepadMenuInput::Command::Left2moves the focus left
QcGamepadMenuInput::Command::Right3moves the focus right
QcGamepadMenuInput::Command::Confirm4south: confirms
QcGamepadMenuInput::Command::Back5east: goes back
QcGamepadMenuInput::Command::Secondary6west: secondary action (one item)
QcGamepadMenuInput::Command::Tertiary7north: secondary action (quick move)
QcGamepadMenuInput::Command::Start8start
QcGamepadMenuInput::Command::TabPrevious9left shoulder: the previous tab
QcGamepadMenuInput::Command::TabNext10right shoulder: the next tab

[alias] QcGamepadMenuInput::Gate

Whether the screens take the commands now.

Member Function Documentation

[delete] QcGamepadMenuInput::QcGamepadMenuInput(const QcGamepadMenuInput &)

Copy-constructs an instance of QcGamepadMenuInput. This function is deleted.

[delete] QcGamepadMenuInput::QcGamepadMenuInput(QcGamepadMenuInput &&)

Move-constructs an instance of QcGamepadMenuInput. This function is deleted.

void QcGamepadMenuInput::advance(qint64 nowMs)

Repeats and scrolls up to nowMs (the timer passes its clock; tests call it directly).

[signal] void QcGamepadMenuInput::command(QcGamepadMenuInput::Command command)

The pad asks for command.

[static] std::optional<QcGamepadMenuInput::Command> QcGamepadMenuInput::direction(const QcGamepadState &raw)

Returns the direction of the state raw: the d-pad first, else the left stick's main axis.

qint64 QcGamepadMenuInput::now() const

Returns the time of the clock advance() runs on.

[signal] void QcGamepadMenuInput::scrolled(float pixels)

The right stick scrolls by pixels (positive: down) since the last advance.

[signal] void QcGamepadMenuInput::scrolledSideways(float pixels)

Emitted when the right stick moves sideways: pixels to scroll a wide page to the right (negative: left).

void QcGamepadMenuInput::setGate(QcGamepadMenuInput::Gate gate)

Sets gate; without a gate (the default) the screens always take the commands.

void QcGamepadMenuInput::setSource(QcGamepadSource *source)

Sets the pads to follow, source (nullptr: none); it must outlive this object or be set to another.

[delete] QcGamepadMenuInput &QcGamepadMenuInput::operator=(QcGamepadMenuInput &&)

Move-assigns other to this QcGamepadMenuInput instance. This function is deleted.

[delete] QcGamepadMenuInput &QcGamepadMenuInput::operator=(const QcGamepadMenuInput &)

Copy-assigns other to this QcGamepadMenuInput instance. This function is deleted.

Member Variable Documentation

const qint64 QcGamepadMenuInput::repeatDelayMs

Milliseconds a direction is held before it repeats.

const qint64 QcGamepadMenuInput::repeatIntervalMs

Milliseconds between two repeats.

const float QcGamepadMenuInput::scrollDeadZone

A stick scrolls beyond this deflection (raw).

const float QcGamepadMenuInput::scrollSpeed

Pixels per second of the right stick at full deflection.

const float QcGamepadMenuInput::stickDirection

A stick moves the focus beyond this deflection (raw) and scrolls beyond scrollDeadZone.

const int QcGamepadMenuInput::timerIntervalMs

Milliseconds between two timer runs of advance() while a direction is held or the stick scrolls.