Sign in to follow this  
marshdabeachy

XInput - Detecting new controllers

Recommended Posts

marshdabeachy    100
I was just curious if the XInput interface provided any kind of notification when a new controller becomes active. Obviously I could constantly poll for new controllers every frame, but that seems rather wasteful. I checked Microsoft's documentation but I didn't see anything. Anyone know of a magic function that provides this?

Share this post


Link to post
Share on other sites
andur    781
I'm not aware of any way of doing it other than by polling every frame. It really isn't that much of an overhead to do so.

Course, you could probably get away with only polling once a second or something.

Share this post


Link to post
Share on other sites
I scan the unused indices to check for a new controller over many frames (1 controller every 4 or 5 frames). Why? When XInput was first introduced, it took several milliseconds to determine that controllers weren't attached, each frame. I'm not sure if it ever got fixed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this