Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting joystick input in Java

I am working on a project which requires me to take input from a joystick. I'll be using my Logitech Extreme 3D Pro, but I guess it will be the same for all joysticks. If it matters I am using windows 10. I have made several google searches but I can't seem to find a good answer. I have found this, but I have no Idea how to set it up or use it usefully as I have never installed new libraries before. So I would be thankful if anyone guided me as to what to do with this link. If any other solutions are available I would be more than happy to try them out. Finally, is there any way for me to directly access the joystick through the COM port it is connected to and perhaps read registers inside the joystick indicating the values of each axis and the buttons? or is this too low level for java?

like image 772
sir_weasels Avatar asked Nov 07 '16 17:11

sir_weasels


1 Answers

This is an old article with instructions on how to install Jinput in Netbeans, but the idea is the same in Eclipse. Follow the instructions, but for adding the jinput.jar file into your project, you'll want to go to your Project menu > Properties > Java Build Path > Libraries > "Add JAR" or "Add External JAR"

After you have it installed, this seems to be a pretty good forum post on how to get started on writing the code for the controller input.

Let me know if you need more help with following the instructions in Eclipse.

like image 102
Nam Tran Avatar answered Oct 14 '22 12:10

Nam Tran