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

# XGameStreamingUpdateTouchControlsState

> XGameStreamingUpdateTouchControlsState

# XGameStreamingUpdateTouchControlsState

Met à jour, sur tous les clients de streaming, l'état que les dispositions tactiles peuvent utiliser pour modifier leur comportement.  Toutes les modifications visuelles de l'ensemble de commandes tactiles actuellement affiché sont effectuées après la mise à jour de TOUTES les variables.

## Syntaxe

```cpp theme={null}
HRESULT XGameStreamingUpdateTouchControlsState(  
         size_t operationCount,  
         const XGameStreamingTouchControlsStateOperation* operations  
)  
```

### Paramètres

*operationCount*   \_In\_\
Type : size\_t

Taille du tableau d'opérations transmis.

*operations*   \_In\_reads\_opt\_(operationCount)\
Type : [XGameStreamingTouchControlsStateOperation\*](/fr/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation)

Tableau de toutes les mises à jour de variables d'état demandées.

### Valeur de retour

Type : HRESULT

Retourne **S\_OK** en cas de réussite ; sinon, retourne un code d'erreur.

#### Erreurs potentielles

| Code d'erreur | Valeur d'erreur | Cause de l'erreur |
| - | - | - |
| E\_GAMESTREAMING\_NOT\_INITIALIZED | 0x89245400 | Le runtime XGameStreaming n'a pas été initialisé. Appelez [XGameStreamingInitialize](/fr/reference/system/xgamestreaming/functions/xgamestreaminginitialize) avant d'appeler d'autres API. |
| E\_INVALIDARG | 0x80070057 | Une opération spécifiée ne comporte pas de données correspondant au type de données spécifié dans le [XGameStreamingTouchControlsStateValueKind](/fr/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstatevaluekind) des opérations |

## Remarques

Les dispositions tactiles utilisées par les clients de streaming peuvent dépendre d'un état, dont les valeurs initiales sont incorporées dans le bundle de dispositions tactiles.  Le jeu peut mettre à jour cet état, ce qui peut modifier la disposition actuellement affichée pour le joueur.

Le jeu peut utiliser `XGameStreamingUpdateTouchControlsState` pour mettre à jour l'état de tous les clients connectés, ou [XGameStreamingUpdateTouchControlsStateOnClient](/fr/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstateonclient) pour mettre à jour un client connecté spécifique.

Si le jeu doit mettre à jour l'état ET changer de disposition en même temps, il peut utiliser [XGameStreamingShowTouchControlsWithStateUpdate](/fr/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate) ou [XGameStreamingShowTouchControlsWithStateUpdateOnClient](/fr/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient).

## Exemples

```C++ theme={null}
// In this example, after the player has switched their active weapon - update the image of the fire
// button to match the current weapon and set the enabled state of reload based on whether the player has
// extra magazines.  
// 
// Assumes passing in game structure that includes the active weapon with appropriate state.  
//
// Assumes a game speciic GetImageName function which returns a constant string for the specified weapoon


void GameStreamingClientManager::UpdateStateAfterWeaponChange(const playerWeapon& playerWeapon)
{
    // create an update for the active weapon's image
    XGameStreamingTouchControlsStateOperation weaponImage;
    weaponImage.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    weaponImage.path = "/ActiveWeaponImage";
    weaponImage.value.valueKind = XGameStreamingTouchControlsStateValueKind::String;
    weaponImage.value.stringValue = GetImageName(playerWeapon.activeWeapon.id);

    // create an update for whether the reload button should be enabled
    XGameStreamingTouchControlsStateOperation reloadEnabled;
    reloadEnabled.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    reloadEnabled.path = "/ReloadEnabled";
    reloadEnabled.valueKind = XGameStreamingTouchControlsStateValueKind::Bool;
    reloadEnabled.booleanValue = playerWeapon.activeWeapon.reloadClips > 0;

    // combine all the updates into the update state call and make the call
    XGameStreamingTouchControlsStateOperation[2] updateOperations = {weaponImage, reloadEnabled};
    
    XGameStreamingUpdateTouchControlsState(updateOperations, _countof(updateOperations));
}
```

```c++ theme={null}
// In this example, after the player has gone to their inventory screen and had the ability to apply items
// to two active slots. Update the state for layouts to have layouts match the player's current
// loaded items from inventory (may or may not be the current layout being displayed).
// 
// Assumes passing in game structure that includes the player's active inventory


void GameStreamingClientManager::AfterInventoryScreen(const PlayerInventory& playerInventory)
{
    std::vector<XGameStreamingTouchControlsStateOperation> updateOperations;
    
    // check the first inventory slots, if empty hide that button from the layout
    // if item is placed in that slot, update the image to match the inventory items
    
    XGameStreamingTouchControlsStateOperation slot1Visible;
    slot1Visible.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    slot1Visible.path = "/Slot1IsVisible";
    slot1Visible.valueKind = XGameStreamingTouchControlsStateValueKind::Boolean;
    slot1Visible.boolValue =  playerInventory.slot1 != nullptr;
    
    updateOperations.push_back(slot1Visible);

    if (playerInventory.slot1 != nullptr) 
    {
        // create an update for the active weapon's image
        XGameStreamingTouchControlsStateOperation slot1Image;
        slot1Image.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
        slot1Image.path = "/Slot1Image";
        slot1Image.value.valueKind = XGameStreamingTouchControlsStateValueKind::String;
        slot1Image.value.stringValue = GetImageName(playerInventory.slot1.id);        
        updateOperations.pushBack(slot1Image);
    }
    

    // ... 
    // do the same for the second inventory spot
    // ...

    // Update the state so that layouts will be updated correctly
    XGameStreamingUpdateTouchControlsState(updateOperations.data(), updateOperations.size());
}

```

## Configuration requise

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

**Bibliothèque :** xgameruntime.lib\
**Plateformes prises en charge** : Windows, consoles de la famille XBOX One et consoles XBOX Series

## Voir aussi

[XGameStreaming](/fr/reference/system/xgamestreaming/xgamestreaming_members#TouchAdaptation)\
[XGameStreamingTouchControlsStateOperationKind](/fr/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstateoperationkind)\
[XGameStreamingTouchControlsStateOperation](/fr/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation)\
[XGameStreamingTouchControlsStateValue](/fr/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstatevalue)\
[XGameStreamingShowTouchControlsWithStateUpdate](/fr/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate)\
[XGameStreamingShowTouchControlsWithStateUpdateOnClient](/fr/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient)\
[XGameStreamingUpdateTouchControlsStateOnClient](/fr/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstateonclient)


## Related topics

- [XGameStreamingUpdateTouchControlsState](/ko/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstate.md)
- [XGameStreamingUpdateTouchControlsStateOnClient](/ko/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstateonclient.md)
- [XGameStreamingShowTouchControlsWithStateUpdate](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdate.md)
- [XGameStreamingTouchControlsStateOperation](/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation.md)
- [XGameStreamingTouchControlsStateValue](/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstatevalue.md)
