class

TouchInput

Per-frame touch state. SDL events arrive between Update() calls; Update() folds them into a stable snapshot and drops Ended/Canceled entries so each frame sees only currently-active contacts plus their final-frame Ended states.

Module
Input
Header
#include "Input/TouchInput.h"
Namespace
Mowo

Public functions

ReturnsNameDescription
voidOnFingerDownCalled by InputManager / Window from SDL_EVENT_FINGER_* handlers.
voidOnFingerMotion
voidOnFingerUp
voidOnFingerCanceled
voidUpdateCalled once per frame before event polling — promotes Began/Moved → Stationary, drops Ended/Canceled.
const std::vector<TouchPoint>&GetActiveTouchesActive touches snapshot for the current frame.
size_tTouchCount
boolHasAnyTouch
boolIsMultiTouch
const TouchPoint*GetTouchByFingerIdLookup by SDL finger ID — returns nullptr if not active this frame.
const TouchPoint*GetTouchLookup by zero-based index (for for (int i = 0; i < TouchCount(); ++i) iteration in scripting languages without iterator support).

Function details

OnFingerDown

C++
void OnFingerDown(uint64_t fingerId, float x, float y, float pressure)

Called by InputManager / Window from SDL_EVENT_FINGER_* handlers. x/y are pixel coordinates (window space), already converted from SDL's normalised 0..1 by the caller. SDL doesn't emit Stationary — that's synthesised internally.

OnFingerMotion

C++
void OnFingerMotion(uint64_t fingerId, float x, float y, float dx, float dy, float pressure)

OnFingerUp

C++
void OnFingerUp(uint64_t fingerId, float x, float y, float pressure)

OnFingerCanceled

C++
void OnFingerCanceled(uint64_t fingerId)

Update

C++
void Update()

Called once per frame before event polling — promotes Began/Moved → Stationary, drops Ended/Canceled. Window's ProcessMessages runs polling immediately after this, so the new SDL events overwrite the synthesised Stationary phase for any finger that actually moved.

GetActiveTouches

C++
const std::vector<TouchPoint>& GetActiveTouches() const

Active touches snapshot for the current frame. Includes Ended/Canceled entries for the single frame they fired in — gameplay can detect a release without missing it.

TouchCount

C++
size_t TouchCount() const

HasAnyTouch

C++
bool HasAnyTouch() const

IsMultiTouch

C++
bool IsMultiTouch() const

GetTouchByFingerId

C++
const TouchPoint* GetTouchByFingerId(uint64_t fingerId) const

Lookup by SDL finger ID — returns nullptr if not active this frame.

GetTouch

C++
const TouchPoint* GetTouch(size_t index) const

Lookup by zero-based index (for for (int i = 0; i < TouchCount(); ++i) iteration in scripting languages without iterator support).

Generated from Input/TouchInput.h via input.json · Nov 2, 2026Version 1.0.0