• Advertisement
Sign in to follow this  

XInput - Detecting new controllers

This topic is 3570 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
Alright, that's what I figured. I'm always on the lookout for better ways to do things, so I thought I'd at least ask.

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
Sign in to follow this  

  • Advertisement