Detect if gamepad is connected
Monkey Forums/Monkey Programming/Detect if gamepad is connected
| ||
Hello, I want to make a control type switch for my game and I want it to work only when gamepad is connected. But I didn't find a proper way to detect a gamepad connection. Is it possible to achieve? |
| ||
The method I use for detecting if a gamepad is connected is just waiting for a joypad action, like pressing a button. Many games out there use this method. |
| ||
You'll need to either write your own system for plugged in controllers via a button-press check (Which is what I do), or you'll need to use platform specific checks. For GLFW / "Desktop" based targets, this forum thread may help you. Generally, your best bet is the platform independent option, but writing a module for more advanced detection shouldn't be too hard. I actually have my own input module with partial support for this (The platform-specific option), and I'm planning on releasing it soon. |
| ||
ilovepixel Yes, I thought about this, but first I was expecting to find a better solution. ImmutableOctet(SKNG) Thanks for the link, I'm currently working on GLFW target. And it would be great to see your input module once you finish it! |