Share via


UINavigationController.FromGameController(IGameController) メソッド

定義

UI ナビゲーション コントローラーとして、指定されたゲーム コントローラーを返します。

public:
 static UINavigationController ^ FromGameController(IGameController ^ gameController);
 static UINavigationController FromGameController(IGameController const& gameController);
public static UINavigationController FromGameController(IGameController gameController);
function fromGameController(gameController)
Public Shared Function FromGameController (gameController As IGameController) As UINavigationController

パラメーター

gameController
IGameController

UI ナビゲーション コントローラーとして返されるゲーム コントローラー。

戻り値

指定されたゲーム コントローラーから返された UI ナビゲーション コントローラー。

Windows の要件

デバイス ファミリ
Windows 10 Creators Update (10.0.15063.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v4.0 で導入)

次の例では、アプリは最初に使用可能な RawGameController オブジェクトを取得し、 UINavigationController クラスを介してこのゲーム コントローラーへのアクセスを試みます。

#include <winrt/Windows.Gaming.Input.h>
using namespace winrt;
using namespace Windows::Gaming::Input;
...
UINavigationController uiNavigationController{ nullptr };

if (RawGameController::RawGameControllers().Size() > 0)
{
    RawGameController rawGameController{ RawGameController::RawGameControllers().GetAt(0) };
    uiNavigationController = UINavigationController::FromGameController(rawGameController);
}

if (uiNavigationController)
{
    // Assign a standard button mapping to this controller.
}
UINavigationController^ uiNavigationController;

if (RawGameController::RawGameControllers->Size > 0)
{
    RawGameController^ rawGameController = 
        RawGameController::RawGameControllers->GetAt(0);

    uiNavigationController = 
        UINavigationController::FromGameController(rawGameController);
}

if (uiNavigationController != nullptr)
{
    // Assign a standard button mapping to this controller.
}

注釈

このメソッドは、提供されたゲーム コントローラーに UI ナビゲーション コントローラーの実装があるかどうかを確認し、存在する場合は、その実装を返します。 このメソッドは、最初にコントローラーを RawGameController として取得し、 UINavigationController として使用できるかどうかを確認する場合に使用できます。その場合は、UI ナビゲーション コントローラーの既定の制御スキームを使用できます。それ以外の場合は、プレーヤーが独自の入力マッピングを行うことができます。

適用対象

こちらもご覧ください