QtCraft API C++ classes QML types Handbook

QcFlightLatch Class

Two presses of the jump key in quick succession toggle flying in creative mode (decision E-284). More...

Header: #include <clientcore/player/QcFlightLatch.h>

Public Functions

bool jumpPressed(qint64 timestampMs)
void reset()

Static Public Members

const qint64 doubleTapMs

Detailed Description

Like the sprint's double tap (QcSprintLatch), taps are taken from the key press events with their time, so a short tap between two frames still counts; a third press after a toggle starts a new pair instead of toggling again.

Member Function Documentation

bool QcFlightLatch::jumpPressed(qint64 timestampMs)

A press of the jump key (not an auto-repeat) at timestampMs (any monotonic clock). Returns true when it completes a double tap.

void QcFlightLatch::reset()

Forgets earlier taps: a screen opened, the player died or the window lost the focus.

Member Variable Documentation

const qint64 QcFlightLatch::doubleTapMs

Two presses at most this far apart toggle flying (the model waits about as long).