mitch3a / SuperMarioWar

Hoping to rewrite existing SMW code in java with the hopes to fix crashes + expand play
7 stars 2 forks source link

Generic Gamepad Handling #8

Open grawin opened 10 years ago

grawin commented 10 years ago

Should be able to handle using any type of game pad using the LWJGL. The Xbox controller code uses a somewhat obscure 3rd party library that only works in Windows. It would be best to use a single "generic" library to handle the controllers. Aside from swapping Xbox to that library the game should be able to detect / setup any semi-standard controller.

mitch3a commented 10 years ago
  1. just testing replying by email... pretty sweet if it works (seems like it will).
  2. I thought the library we are using for my SNES controller was that "generic" library? I agree that the current solution is def incomplete, but is there something better out there? I'd also be curious if there is some sort of unique identifier our library can pull from a gamepad... so we check all connected devices... and if any don't have a "saved settings" file (kind of like how we hardcoded in for mine), then just prompt the user real quick to get an initial settings. Then any controller of that type will just use that settings file?

On Mon, Mar 3, 2014 at 9:22 AM, Ryan Grawin notifications@github.comwrote:

Should be able to handle using any type of game pad using the LWJGL. The Xbox controller code uses a somewhat obscure 3rd party library that only works in Windows. It would be best to use a single "generic" library to handle the controllers. Aside from swapping Xbox to that library the game should be able to detect / setup any semi-standard controller.

— Reply to this email directly or view it on GitHubhttps://github.com/mitch3a/SuperMarioWar/issues/8 .

grawin commented 10 years ago

The one for the SNES controller is a "generic" library. The Xbox one is the problem (I picked something that was easy to use just to get it up and running following an example I found).

Now that we're a little bit smarter, I think it would be better to use the LWJGL to handle controller input. That way it will be less specialized and work on any computer (I think). http://www.lwjgl.org/javadoc/org/lwjgl/input/package-summary.html

mitch3a commented 10 years ago

If it sort of just "does everything for you" then im for it. Then again, this is all java so "everything is pretty much already done for you" haha. The only two counter-arguments i have 1. sometimes setting up something built in can be a pain and 2. some packages can be buggy, or missing functionality, etc. vs having full control of your own. That said, I haven't really looked into that library (or the one i started with) so for all i know this one is the standard and does everything you want very simply.

I think this should be a major chunk of the 0.2 version.

On Mon, Mar 3, 2014 at 9:34 AM, Ryan Grawin notifications@github.comwrote:

The one for the SNES controller is a "generic" library. The Xbox one is the problem (I picked something that was easy to use just to get it up and running following an example I found).

Now that we're a little bit smarter, I think it would be better to use the LWJGL to handle controller input. That way it will be less specialized and work on any computer (I think). http://www.lwjgl.org/javadoc/org/lwjgl/input/package-summary.html

— Reply to this email directly or view it on GitHubhttps://github.com/mitch3a/SuperMarioWar/issues/8#issuecomment-36514906 .

grawin commented 10 years ago

Right, it's not an easy change. It will be broken into a couple parts anyway. The initial rev would just be to get the Xbox controller using it. Then move other things over. I did some research and it seems to be very stable and sort of the "de facto" library for doing games in plain Java and provides controller interfaces. (I think our Sound System library uses parts of LWJGL too)

I guess we could have a config file with known settings, if that doesn't exist try to auto detect things, and offer a way to change the controls in the menu (once those exist). Sounds trivial, but it's kind of not.