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

> Obtient des informations sur une surface tactile du périphérique d'entrée.

Obtient des informations sur une surface tactile du périphérique d'entrée.

## Syntaxe

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

### Paramètres

*surfaceIndex*\
Type : uint32\_t

Index de base zéro de la surface tactile. Doit être inférieur à la valeur retournée par [IGameInputDevice::GetTouchSurfaceCount](https://docs.xbox.com/fr/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)\*

Reçoit des informations sur la surface tactile.

### Valeur de retour

Type : HRESULT

Retourne `S_OK` en cas de réussite. Retourne `E_BOUNDS` si *surfaceIndex* est supérieur ou égal au nombre de surfaces tactiles du périphérique ; dans ce cas, *info* est mis à zéro.

## Remarques

Les informations retournées décrivent le nombre maximal de contacts simultanés que la surface peut signaler, les dimensions de la surface en unités du périphérique et le type de la surface, comme un pavé tactile ou un écran tactile. Les positions de contact signalées par [IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/fr/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md) sont relatives à ces dimensions ; vous pouvez donc les utiliser pour normaliser les positions de contact.

Ces informations ne changent pas pendant toute la durée de vie de l'objet périphérique.

L'exemple suivant normalise dans la plage \[0, 1) la position du premier contact sur chaque surface tactile d'un périphérique.

```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]
>
> La prise en charge tactile dépend du périphérique et de la plateforme.

## Configuration requise

**En-tête :** GameInput.h

**Bibliothèque :** gameinput.lib

**Plateformes prises en charge :** Windows, consoles de la famille XBOX One et consoles XBOX Series

## Voir aussi

[Vue d'ensemble de GameInput](https://docs.xbox.com/fr/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputDevice](https://docs.xbox.com/fr/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/fr/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfacecount.md)\
[IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/fr/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md)

## Historique des versions

| Version | Modifications |
| - | - |
| **v4** | Introduite. |


## Related topics

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