simvx.core.input.gestures

Gestures as controls: what fingers do together, recognised only while something names it.

Touch.LONG_PRESS and Touch.TWO_FINGER_TAP are buttons, Touch.PINCH and Touch.ROTATE axes, Touch.PAN a stick and Mouse.WHEEL an axis, so a gesture binds, rebinds and is heard by the one mechanism a key is. The router feeds every finger here and publishes what this recognises as ordinary events: a gesture button is a PointerEvent on the finger that made it, a gesture axis an AxisEvent carrying the frame’s motion.

Recognition is not free, so it runs only while a binding in the tree’s map, a handler, or Input.touch_secondary names one; a game that names none pays one set test per finger event.

Module Contents

Classes

GestureRecognition

One router’s recogniser: follows its fingers and publishes the gestures its tree names.

Functions

recognised_in

Which recognised controls control names: a gesture, its half or motion, a stick of two, or none.

gesture_event

The event a gesture button is: a press or release of it on the finger that made it, holding buttons after.

gesture_axis_event

The event a gesture axis is: the frame’s motion, with no position.

Data

API

simvx.core.input.gestures.__all__

[‘RECOGNISED’, ‘recognised_in’]

simvx.core.input.gestures.RECOGNISED: frozenset[simvx.core.input.controls.DeviceControl]

‘frozenset(…)’

simvx.core.input.gestures.recognised_in(control: object) → tuple[simvx.core.input.controls.DeviceControl, ...][source]

Which recognised controls control names: a gesture, its half or motion, a stick of two, or none.

class simvx.core.input.gestures.GestureRecognition(router: simvx.core.input.router.InputRouter)[source]

One router’s recogniser: follows its fingers and publishes the gestures its tree names.

Initialization

touch(key: tuple, pointer_id: int | None, phase: simvx.core.input.enums.PointerPhase, position: tuple[float, float], stamp: float) → None[source]

A finger went down, moved, lifted or was cancelled.

frame() → None[source]

Once a frame, after the frame’s motion: time the long presses and publish the pair’s motion.

simvx.core.input.gestures.gesture_event(pointer_id: int, device_id: int, button: simvx.core.input.controls.DeviceButton, pressed: bool, position: tuple[float, float], buttons: int) → simvx.core.input.events.PointerEvent[source]

The event a gesture button is: a press or release of it on the finger that made it, holding buttons after.

simvx.core.input.gestures.gesture_axis_event(axis: simvx.core.input.controls.DeviceAxis, motion: float, device_id: int) → simvx.core.input.events.AxisEvent[source]

The event a gesture axis is: the frame’s motion, with no position.