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

# XINPUT_STATE

> XINPUT_STATE

# XINPUT\_STATE

描述控制器的状态。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
typedef struct XINPUT_STATE {  
    DWORD dwPacketNumber;  
    XINPUT_GAMEPAD Gamepad;  
} XINPUT_STATE  
```

<a id="membersSection" />

### 成员

*dwPacketNumber*\
类型：DWORD

状态包序号。包序号指示控制器状态是否发生变化。如果在依次返回的 `XINPUT_STATE` 对象中该值相同，则控制器状态未发生变化。

*Gamepad*\
类型：[XINPUT\_GAMEPAD](/reference/input/xinputongameinput/structs/xinput_gamepad)

包含控制器当前状态的 [XINPUT\_GAMEPAD](/reference/input/xinputongameinput/structs/xinput_gamepad) 对象。

<a id="remarksSection" />

## 备注

仅当自上次轮询以来控制器状态发生变化时，*dwPacketNumber* 的值才会递增。

此结构由 [XInputGetState](/reference/input/xinputongameinput/functions/xinputgetstate) 和 [XInputGetStateWithToken](/reference/input/xinputongameinput/functions/xinputgetstatewithtoken) 函数使用。

有关详细信息，请参阅 [XInputOnGameInput 包装器](/build/core-features/common/input/porting/input-porting-xinput#xinputWrapperSection)。

<a id="requirementsSection" />

## 要求

**头文件：** XInputOnGameInput.h

**支持的平台：** XBOX One 系列主机和 XBOX Series 主机

<a id="seealsoSection" />

## 另请参阅

[从 XInput 移植到 GameInput](/build/core-features/common/input/porting/input-porting-xinput)\
[XInputOnGameInput](/reference/input/xinputongameinput/xinputongameinput_members)


## Related topics

- [XInputGetState](/zh-CN/reference/input/xinputongameinput/functions/xinputgetstate.md)
- [XInputGetStateWithToken](/zh-CN/reference/input/xinputongameinput/functions/xinputgetstatewithtoken.md)
- [XINPUT_GAMEPAD](/zh-CN/reference/input/xinputongameinput/structs/xinput_gamepad.md)
- [XInputOnGameInput](/zh-CN/reference/input/xinputongameinput/xinputongameinput_members.md)
- [XINPUT_VIBRATION](/zh-CN/reference/input/xinputongameinput/structs/xinput_vibration.md)
