I'm currently trying to settle various input challenges faced in my game development project. Ideally, what I want is 1) perfectly consistent keyboard input, and 2) mostly consistent onboard plug and play gamepad input support.
For number 1, I've been using _KEYDOWN, which has a bug involving the SHIFT key sticking keys under certain circumstances. I had been putting off switching to _KEYHIT, as it will require a pretty big code upheaval - I don't just have to change how the inputs during gameplay and in menus are read, I have to reorganize how the whole keybinding system is processed.
Then I stumbled on _DEVICES and its related functions, and this looks like a perfect solution to both number 1 and number 2, if I'm understanding it correctly, but the articles on the wiki raised a few questions I want to resolve first, to hopefully save myself a lot of work and headaches by way of others' experience.
1. Detecting devices using _DEVICES, _DEVICE$, and LEFT$ is pretty easy, and allows me to store the device index of keyboard and controller. However, _BUTTON and similar functions only take one index - the index of the button itself. How do I tell _BUTTON which device I'm trying to examine?
2. I'd like to avoid problems caused by controller disconnection mid-game. If you've used these functions to handle gamepad support before, how did you ensure the user would be able to resume play once controller connection was restored?
3. Is there a way to allow the window to detect gamepad inputs even when the window loses focus? I saw in the wiki that this is impossible for keyboard, so I thought it would be a good idea to check.
Thanks, and happy new year!