Getting joystick input in Java
Asked Answered
W

1

6

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?

Washedup answered 7/11, 2016 at 17:21 Comment(3)
what IDE are you using?Moorehead
Joystick connected to a COM port? Haven't seen a COM port in years, except in legacy hardware... did you mean USB?Croaky
I am using Eclipse. Concerning the COM port part I was just suggesting an idea. I use them when connecting to an Arduino via a serial port.Washedup
B
1

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.

Balmung answered 7/11, 2016 at 18:7 Comment(1)
I didn't really understand the instructions as this is my first time to install a library. So if you can just tell me what should I be moving and where that would be great. I think I understand the last part concerning adding the jinput.jar part so no need to explain this.Washedup

© 2022 - 2024 — McMap. All rights reserved.