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

# 仮想キーボードのサポート

> 仮想キーボードのサポート

物理的に接続されたキーボードは PC では一般的な前提ですが、ゲームパッドやタッチのような新しい入力モダリティはこの前提に挑戦しています。これはハンドヘルドおよびコンソールのゲーマーにとって特に重要です。プラットフォームに応じて、仮想キーボードを表示するさまざまな解決策があります。タイトルは独自の仮想キーボードを実装して作成することもできますが、システムはプラットフォームに最適化された、すべてのゲーム間で一貫したユーザーエクスペリエンスを提供する独自の仮想キーボード代替を提供します。

Windows では、新しい `CoreInputViewKind::Gamepad` オプションと共に `TryShow` API を活用できます。その後、必要でないときにキーボードを閉じるために `TryHide` API を使用できます。これは次のコードサンプルで示されています。

```C theme={null}
#include <winrt/windows.ui.viewmanagement.core.h>
using namespace winrt::Windows::UI::ViewManagement::Core;

// CoreInputViewKind::Gamepad enum requires headers from 26100.3624 Windows SDK or greater
// Otherwise, use static_cast<CoreInputViewKind>(7) for earlier SDKs

CoreInputView::GetForCurrentView().TryShow(CoreInputViewKind::Gamepad));

CoreInputView::GetForCurrentView().TryHide();
```

コンソールの場合、GDK は仮想キーボードを使用したテキスト入力を処理するための 2 つの異なる解決策を提供します。ほとんどのゲームにとって最良の解決策は [XGameUiShowTextEntryAsync](/reference/system/xgameui/functions/xgameuishowtextentryasync) に依存することです。複数行のテキストや 1024 文字を超える入力をレンダリングする必要があるゲームは、[XGameUiTextEntryOpen](/reference/system/xgameui/functions/xgameuitextentryopen) に依存できます。

以下の表は、これら 2 つの解決策の比較を示しています。

| 説明            | XGameUiShowTextEntryAsync | XGameUiTextEntryOpen  |
| ------------- | ------------------------- | --------------------- |
| 複数行サポート       | いいえ                       | はい                    |
| 最大文字数         | 1024                      | 1024 \* 32            |
| 入力フォーカス       | 仮想キーボードが入力フォーカスを取得        | 仮想キーボードが入力フォーカスを取得    |
| 位置決め          | 固定位置                      | ゲームによる位置指定            |
| テキストのレンダリング   | 仮想キーボードによって処理             | ゲームによって処理             |
| クラウドストリーミング動作 | クライアント上で仮想キーボードを活用        | ストリーミングサーバーによってレンダリング |

## 関連項目

[Windows ハンドヘルドデバイス上の GDK ゲームのチェックリスト - Check 3: Text Input](/build/gdk-and-engines/handheld/handheld-guidance) [XGameUiShowTextEntryAsync](/reference/system/xgameui/functions/xgameuishowtextentryasync) [XGameUiTextEntryOpen](/reference/system/xgameui/functions/xgameuitextentryopen)


## Related topics

- [XGameUiTextEntryOpen](/ja-jp/reference/system/xgameui/functions/xgameuitextentryopen.md)
- [XGameUiShowTextEntryAsync](/ja-jp/reference/system/xgameui/functions/xgameuishowtextentryasync.md)
- [概要](/ja-jp/build/core-features/common/input/overviews/index.md)
- [Input](/ja-jp/build/core-features/common/input/gc-input-toc.md)
- [アクセシビリティメタデータ](/ja-jp/publishing/game-publishing/concepts/metadata-accessibility.md)
