Is there a way to interpret the input from a PlayStation 3 controller, and use it in a Windows and MacOS program that I am writing in Java? I have been looking at SDL and OIS, but they aren't coded in Java, so I would have to write a Java wrapper.
-
3\$\begingroup\$ sourceforge.net/projects/sdljava <-- 5 seconds on Google indicates that you wouldn't need to write your own wrapper. \$\endgroup\$– Sean MiddleditchCommented Jun 27, 2013 at 0:20
-
\$\begingroup\$ This post is six years old, but I hope it will help you. \$\endgroup\$– Nick CaplingerCommented Jun 27, 2013 at 15:26
-
\$\begingroup\$ IIRC LibGDX has controller support, the source is on Github, you may want to check what they used \$\endgroup\$– Cedric MartensCommented Jul 20, 2017 at 16:40
1 Answer
After doing a little research I found a good library I could use called JInput.
HowTo: Set up JInput API and Library for Java Development on Mac OS X or Linux Platform (archived)
This tutorial helps you install it and start up a basic programming. I used this tutorial to install JInput but ended up not using the library that the author offers.
For using Netbeans if you get stuck at the step where you have to add the .jnilib
put the file path in the virtual machine options under right click your project > project > run. Then add something like this -Djava.library.path="/path-to-folder-of-the-jnilib"
Put the path to the folder where it is located not the actual file.