> ## 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

> Obtém informações sobre uma superfície de toque do dispositivo de entrada.

Obtém informações sobre uma superfície de toque do dispositivo de entrada.

## Sintaxe

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

### Parâmetros

*surfaceIndex*\
Tipo: uint32\_t

O índice baseado em zero da superfície de toque. Deve ser menor que o valor retornado por [IGameInputDevice::GetTouchSurfaceCount](https://docs.xbox.com/pt-BR/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfacecount.md).

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

Recebe informações sobre a superfície de toque.

### Valor retornado

Tipo: HRESULT

Retorna `S_OK` em caso de êxito. Retorna `E_BOUNDS` se *surfaceIndex* for maior ou igual ao número de superfícies de toque do dispositivo; nesse caso, *info* é zerado.

## Comentários

As informações retornadas descrevem o número máximo de contatos simultâneos que a superfície pode relatar, as dimensões da superfície em unidades do dispositivo e o tipo da superfície, como touchpad ou tela sensível ao toque. As posições de contato relatadas por [IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/pt-BR/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md) são relativas a essas dimensões, portanto você pode usá-las para normalizar as posições de contato.

As informações não mudam durante o tempo de vida do objeto de dispositivo.

O exemplo a seguir normaliza a posição do primeiro contato em cada superfície de toque de um dispositivo para o intervalo \[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]
>
> O suporte ao toque depende do dispositivo e da plataforma.

## Requisitos

**Cabeçalho:** GameInput.h

**Biblioteca:** gameinput.lib

**Plataformas com suporte:** Windows, consoles da família XBOX One e consoles XBOX Series

## Confira também

[Visão geral do GameInput](https://docs.xbox.com/pt-BR/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputDevice](https://docs.xbox.com/pt-BR/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/pt-BR/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfacecount.md)\
[IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/pt-BR/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md)

## Histórico de versões

| Versão | Alterações |
| - | - |
| **v4** | Introduzido. |


## Related topics

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