Closed lukekarrys closed 10 years ago
:+1: that sounds like a very handy shortcut
agreed :+1:
I'll work on a patch for it tonight. I like that idea a lot, actually.
Will this clash with https://github.com/carldanley/node-gamepad/issues/5 at all?
I don't think we'll have the issues brought up in #5 since we don't automap anything. We rely on a user having a controller plugged in and knowing what that controller is and specifying it to the constructor.
I guess there could be an issue if there were NES and SNES Retrolink controllers plugged in and a user did new GamePad('snes')
since the NES and SNES controllers have the same vendor/product IDs.
We could look at the output from HID.devices
and if there are multiple values that would satisfy the requested platform, throw an error saying Please specify the full platform/vendor path.
or something like that?
I don't think so, as long as you are specifying the name of the controller you'll know which mapping to use, #5 is about trying to guess which controller is plugged in.
Take a look at https://github.com/carldanley/node-gamepad/commit/ec1cca7ba88e0fdaf01483217193feeb0030a3e9 and see if this looks good to you guys as far as automatically detecting a controller's product ID.
Made a PR for the one issue I saw, other than that it looks great (I tested with SNES).
:+1:
Thank you!
I think something like
new GamePad(' snes ')
would be nice, especially as more controllers get added. Then under the hood, it could look through all the config files incontrollers/snes
and see if any of them are available fromHID.devices()
.