> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IGameInputDevice::GetTouchSurfaceInfo

> Gets information about a touch surface on the input device.

Gets information about a touch surface on the input device.

## Syntax

```cpp theme={null}
HRESULT GetTouchSurfaceInfo(
    uint32_t surfaceIndex,
    GameInputTouchSurfaceInfo* info
);
```

### Parameters

*surfaceIndex*\
Type: uint32\_t

The zero-based index of the touch surface. This must be less than the value returned by [IGameInputDevice::GetTouchSurfaceCount](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfacecount.md).

*info*   \_Out\_\
Type: [GameInputTouchSurfaceInfo](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/structs/gameinputtouchsurfaceinfo)\*

Receives information about the touch surface.

### Return value

Type: HRESULT

Returns `S_OK` on success. Returns `E_BOUNDS` if *surfaceIndex* is greater than or equal to the number of touch surfaces on the device; in that case, *info* is zeroed.

## Remarks

The returned information describes the maximum number of simultaneous contacts that the surface can report, the dimensions of the surface in device units, and the type of the surface, such as a touchpad or a touchscreen. Contact positions reported by [IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md) are relative to these dimensions, so you can use them to normalize contact positions.

The information doesn't change for the lifetime of the device object.

The following example normalizes the position of the first contact on each touch surface of a device to the range \[0, 1).

```cpp theme={null}
void ProcessTouch(IGameInputDevice* device, IGameInputReading* reading) noexcept
{
    const uint32_t surfaceCount = device->GetTouchSurfaceCount();
    for (uint32_t surfaceIndex = 0; surfaceIndex < surfaceCount; ++surfaceIndex)
    {
        GameInputTouchSurfaceInfo info = {};
        if (FAILED(device->GetTouchSurfaceInfo(surfaceIndex, &info)) ||
            info.padWidth == 0 || info.padHeight == 0)
        {
            continue;
        }

        GameInputTouchContact contact = {};
        if (reading->GetTouchSurfaceState(surfaceIndex, 1, &contact) == 1)
        {
            const float x = static_cast<float>(contact.padX) / info.padWidth;
            const float y = static_cast<float>(contact.padY) / info.padHeight;
            // Use the normalized position (x, y) of the contact.
        }
    }
}
```

> [!NOTE]
>
> Touch support depends on the device and the platform.

## Requirements

**Header:** GameInput.h

**Library:** gameinput.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[Overview of GameInput](https://docs.xbox.com/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputDevice](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)\
[GameInputTouchSurfaceInfo](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/structs/gameinputtouchsurfaceinfo)\
[IGameInputDevice::GetTouchSurfaceCount](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfacecount.md)\
[IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md)

## Version History

| Version | Changes |
| - | - |
| **v4** | Introduced. |


## Related topics

- [IGameInputDevice::GetTouchSurfaceCount](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfacecount.md)
- [IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md)
- [IGameInputReading::GetTouchContactCount](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchcontactcount.md)
- [IGameInputDevice::GetSupportedInput](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md)
- [IGameInputDevice::GetInputReportInfo](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportinfo.md)
