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

> デバイスが備えているモーション センサーや方位センサーなど、デバイスのセンサーのプロパティを取得します。

デバイスが備えているモーション センサーや方位センサーなど、デバイスのセンサーのプロパティを取得します。

## 構文

```cpp theme={null}
bool GetSensorsInfo(
    GameInputSensorsInfo* info
);
```

### パラメーター

*info*   \_Out\_\
型: [GameInputSensorsInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/structs/gameinputsensorsinfo.md)\*

デバイスのセンサーのプロパティを受け取る `GameInputSensorsInfo` 構造体へのポインター。デバイスがセンサー入力をサポートしていない場合、構造体のすべてのメンバーは 0 に設定されます。

### 戻り値

型: bool

デバイスがセンサー入力をサポートしていて、*info* にデータが格納された場合は `true`。それ以外の場合は `false`。

## 解説

`GetSensorsInfo` メソッドは、デバイスのセンサーのプロパティを、呼び出し元が用意した構造体にコピーします。[GetSupportedInput](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md) から返される値に `GameInputKindSensors` が含まれている場合、そのデバイスはセンサー入力をサポートしています。デバイスがセンサー入力をサポートしていない場合、`GetSensorsInfo` は *info* を 0 で初期化し、`false` を返します。

`supportedSensors` メンバーは [GameInputSensorsKind](https://docs.xbox.com/ja-jp/reference/input/gameinput/enums/gameinputsensorskind.md) フラグの組み合わせで、デバイス上のセンサーを示します。センサーの状態は、[IGameInputReading::GetSensorsState](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getsensorsstate.md) を使用して読み取りから取得します。

このメソッドによって返されるプロパティはデバイスの有効期間中は固定されているため、一度 (たとえば、デバイスの接続時に) クエリを実行して結果をキャッシュできます。

次の例は、デバイスのセンサーのプロパティをクエリする方法を示しています。

```cpp theme={null}
GameInputSensorsInfo info;
if (device->GetSensorsInfo(&info))
{
    if (info.supportedSensors & GameInputSensorsGyrometer)
    {
        // Enable gyro aiming.
    }
}
```

GameInput v3 以前では、この情報は [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) から返される [GameInputDeviceInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 構造体の `sensorsInfo` メンバーから取得できました。

## 要件

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

**ライブラリ:** gameinput.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体、XBOX Series 本体

## 関連項目

[GameInput の概要](https://docs.xbox.com/ja-jp/build/core-features/common/input/overviews/input-overview.md)\
[GameInputSensorsInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/structs/gameinputsensorsinfo.md)\
[GetSupportedInput](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md)\
[GameInputKind](https://docs.xbox.com/ja-jp/reference/input/gameinput/enums/gameinputkind.md)\
[GameInputSensorsKind](https://docs.xbox.com/ja-jp/reference/input/gameinput/enums/gameinputsensorskind.md)\
[IGameInputReading::GetSensorsState](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getsensorsstate.md)\
[IGameInputDevice](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## バージョン履歴

| バージョン | 変更内容 |
| - | - |
| **v4** | 導入されました。 |


## Related topics

- [GameInputSensorsInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/structs/gameinputsensorsinfo.md)
- [GameInputSensorsKind](https://docs.xbox.com/ja-jp/reference/input/gameinput/enums/gameinputsensorskind.md)
- [IGameInputDevice::GetInputReportInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getinputreportinfo.md)
- [IGameInputDevice::GetKeyboardInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getkeyboardinfo.md)
- [IGameInputDevice::GetGamepadInfo](https://docs.xbox.com/ja-jp/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getgamepadinfo.md)
