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

# XGameStreamingShowTouchControlsWithStateUpdate

> XGameStreamingShowTouchControlsWithStateUpdate

# XGameStreamingShowTouchControlsWithStateUpdate

接続されているすべてのストリーミング クライアント デバイスに対して、タッチ コントロールの状態を更新し、指定されたタッチ レイアウトを表示するよう要求します。すべての状態の更新は、新しいタッチ レイアウトが表示される前に行われます。

## Syntax

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

### Parameters

*layout*   \_In\_opt\_z\_\
型: char\*

表示するタッチ コントロール レイアウトの名前。または、標準レイアウトを表示する場合は `nullptr`。

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

渡される操作配列のサイズ。

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

要求される状態変数の更新の配列。

### Return value

型: HRESULT

成功した場合は **S\_OK** を返します。それ以外の場合はエラー コードを返します。

#### 想定されるエラー

| エラー コード                            | エラー値       | エラーの理由                                                                                                                                                                 |
| ---------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| E\_GAMESTREAMING\_NOT\_INITIALIZED | 0x89245400 | XGameStreaming ランタイムが初期化されていません。他の API を呼び出す前に [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize) を呼び出してください。             |
| E\_INVALIDARG                      | 0x80070057 | 指定された操作に、その操作の [XGameStreamingTouchControlsStateValueKind](/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstatevaluekind) で指定されたデータ型と一致するデータがありません。 |

## Remarks

この API は、レンダリングに影響する可能性のある一部の状態更新も必要とする特定のタッチ レイアウトをゲームが表示する必要がある場合に使用します。新しいタッチ レイアウトで参照される変数の状態を更新すると同時に、接続されているすべてのストリーミング クライアント デバイスのタッチ レイアウトを切り替えたい場合にこの API を使用します。この API は、すべての状態更新が新しいレイアウトの表示前に確実に行われるようにします。

特定のクライアントにのみ影響を与えたい場合は、[XGameStreamingShowTouchControlsWithStateUpdateOnClient](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient) を使用してください。

レイアウトの変更のみを行いたい場合は、代わりに [XGameStreamingShowTouchControlLayout](/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrollayout) を使用してください。

状態の更新が現在のレイアウトや他のレイアウトに影響する可能性があり、特定のタッチ レイアウト変更に関係なく更新を行う必要がある場合は、代わりに [XGameStreamingUpdateTouchControlsState](/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstate) を使用してください。

## Examples

```c++ theme={null}
// In this example, the player has just selected a specific building in an strategy game 
// and the game wants to populate the two building specific action slots with the appropriate imagery
// before selecting the layouts
//
// Assumes passing in game structure that refers to the selected building and a game function to get the image
// assets for a particular building capability.


void GameStreamingClientManager::UpdateBuildingStateAndControls(const BuildingProperties& building)
{
    
    

    std::vector<XGameStreamingTouchControlsStateOperation> updateOperations;
    
    // update the image for the first two building slots   
    XGameStreamingTouchControlsStateOperation buildingCapability1Image;
    buildingCapability1Image.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    buildingCapability1Image.path = "/buildingCapability1Image";
    buildingCapability1Image.valueKind = XGameStreamingTouchControlsStateValueKind::String;
    buildingCapability1Image.stringValue =  GetImageName(building.capability[0].id);        
    updateOperations.push_back(buildingCapability1Image);

    XGameStreamingTouchControlsStateOperation buildingCapability2Image;
    buildingCapability2Image.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    buildingCapability2Image.path = "/buildingCapability2Image";
    buildingCapability2Image.valueKind = XGameStreamingTouchControlsStateValueKind::String;
    buildingCapability2Image.stringValue =  GetImageName(building.capability[1].id);        
    updateOperations.push_back(buildingCapability2Image);
    
    // enable the second slot if the building is of level 3 or above, otherwise the third slot will be disabled
    XGameStreamingTouchControlsStateOperation buildingCapability2Enabled;
    buildingCapability2Enabled.operationKind = XGameStreamingTouchControlsStateOperationKind::Replace;
    buildingCapability2Enabled.path = "/buildingCapability2IsEnabled";
    buildingCapability2Enabled.valueKind = XGameStreamingTouchControlsStateValueKind::Boolean;
    buildingCapability2Enabled.booleanValue =  building.level >= 3;
    updateOperations.push_back(buildingCapability2Enabled);
  
    // Switch to the building layout with the state update being sent as well
    XGameStreamingShowTouchControlsWithStateUpdate("building", updateOperations.size(), updateOperations.data());
}

```

## Requirements

**ヘッダー:** XGameStreaming.h

**ライブラリ:** xgameruntime.lib\
**サポートされているプラットフォーム**: Windows、XBOX One ファミリー本体および XBOX Series 本体

## See also

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


## Related topics

- [XGameStreamingShowTouchControlsWithStateUpdateOnClient](/ja-jp/reference/system/xgamestreaming/functions/xgamestreamingshowtouchcontrolswithstateupdateonclient.md)
- [XGameStreamingUpdateTouchControlsState](/ja-jp/reference/system/xgamestreaming/functions/xgamestreamingupdatetouchcontrolsstate.md)
- [XGameStreamingTouchControlsStateOperation](/ja-jp/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstateoperation.md)
- [XGameStreamingTouchControlsStateValue](/ja-jp/reference/system/xgamestreaming/structs/xgamestreamingtouchcontrolsstatevalue.md)
- [XGameStreamingTouchControlsStateOperationKind](/ja-jp/reference/system/xgamestreaming/enums/xgamestreamingtouchcontrolsstateoperationkind.md)
