Skip to main content
Retrieves the contacts on a touch surface from an input reading.

Syntax

Parameters

surfaceIndex   _In_
Type: uint32_t
Index of the touch surface. Must be less than the value returned by IGameInputDevice::GetTouchSurfaceCount. contactArrayCount   _In_
Type: uint32_t
Number of elements in contactArray. contactArray   _Out_writes_to_opt_(contactArrayCount, return)
Type: GameInputTouchContact*
Array that receives the contacts on the touch surface. Can be null.

Return value

Type: uint32_t If contactArray is null, returns the number of contacts on the touch surface. Otherwise, returns the number of contacts written to contactArray, which is the smaller of the number of contacts and contactArrayCount. Returns 0 if the reading doesn’t contain touch data or if surfaceIndex isn’t a valid surface index.

Remarks

Each element of contactArray describes one contact, such as a finger, on the surface. Elements of contactArray that aren’t written with a contact are set to zero. The contactId member of GameInputTouchContact stays the same for as long as the contact remains on the surface, so you can use it to track a contact across readings. To size contactArray, call IGameInputReading::GetTouchContactCount, or use the maxContactCount member of GameInputTouchSurfaceInfo to allocate an array that’s large enough for any reading. To interpret the contact coordinates, call IGameInputDevice::GetTouchSurfaceInfo with the same surface index. Readings that contain touch data include GameInputKindTouch in IGameInputReading::GetInputKind.
Touch support depends on the device and the platform.
The following example reads the contacts on every touch surface of a device.

Requirements

Header: GameInput.h Library: gameinput.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

Overview of GameInput
IGameInputReading
IGameInputReading::GetTouchContactCount
IGameInputDevice::GetTouchSurfaceInfo
GameInputTouchContact
GameInputTouchSurfaceInfo

Version History

Last modified on November 5, 2026