(installation and download on the right)
NB: as an alternative to placing the .dll files in a folder that is in your system file path (a process that can be difficult or tedious for those less used to more complicated computer work), the files can be directly referenced as the native code for the java libraries. This is done as follows:
1. Open the build path of your java project and open the drop-down menus of the two external jars you added for the Xbox Controller input, then select Native Library Location.
2. Navigate to the folder where both of the .dll files are located and select them.
The method these libraries use to collect controller input is very similar to the way the default Java libraries create Key Listeners. Here is a picture of our code (borrowed heavily from the tutorials posted on the afore mentioned site):
Also, we set the dead zones of the two controller sticks so that they would not detect input until pressed to a certain degree. This is optional but helpful. Furthermore, one should not that frequent errors can occur with this library if it is used in tandem with too many swing components, such as JFrames and JWindows. It is therefore wise to keep ones listener in a class that can be run in a separate thread that is executed over and over. This allows the listener to be restarted if it crashes. Use a scheduled thread pool executor to manage the execution of your listener thread for Xbox input.
NB: a more detailed example of how to implement this library can be found at the first link listed above at the bottom of the page.
sadly i cannot downloade the library anymore, does anyone have the library and can send it to me?
ReplyDelete