Compartilhar via


XInputEnable

Sets the reporting state of XInput.

Syntax

void XInputEnable(  
         BOOL enable  
)  

Parameters

enable   _In_
Type: BOOL

If enable is FALSE, XInput will send only neutral data in response to XInputGetState: that is, all buttons up, axes centered, and triggers at 0. XInputSetState calls will be registered but won't be sent to the device. Sending any value other than FALSE will restore the reading and writing functionality to normal.

Return value

Type: void

None.

Remarks

This function is deprecated and shouldn't be written into any new code. XInputEnable adds overhead to many XInput wrapper calls. You can #define XINPUT_ON_GAMEINPUT_NO_XINPUTENABLE to get rid of XInputEnable and the resulting overhead. For more information, see Porting from XInput to GameInput.

This function is meant to be called when an application gains or loses focus. When using this function, you won't have to change the XInput query loop in your application, because neutral data will always be reported if XInput is disabled.

In a controller that supports vibration effects:

  • Passing FALSE will stop any vibration effects playing at the moment. In this state, calls to XInputSetState will be registered but won't be passed to the device.
  • Passing TRUE will pass the last vibration request (even if it's 0) sent to XInputSetState and to the device.

Requirements

Header: XInputOnGameInput.h

Library: xgameruntime.lib

Supported platforms: Xbox One family consoles and Xbox Series consoles

See also

Port XInput to GameInput
XInputOnGameInput
XInputGetState
XInputSetState