View Single Post
  #6   Spotlight this post!  
Unread 18-09-2015, 14:16
Maxwell777's Avatar
Maxwell777 Maxwell777 is offline
Is allowed to touch stuff now
AKA: Jackson Gray
FRC #0842 (Falcon Robotics)
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Phoenix, AZ
Posts: 72
Maxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura aboutMaxwell777 has a spectacular aura about
Re: Know a good Java library to read from a Gamepad or Joystick?

Quote:
Originally Posted by RyanCahoon View Post
In JInput, the comment for net.java.games.input.Controller.poll() says:
Code:
/**
 * Polls axes for data.  Returns false if the controller is no longer valid.
In LWJGL's GLFW library, there's
Code:
bool present = org.lwjgl.glfw.GLFW.glfwJoystickPresent(GLFW_JOYSTICK_1) == org.lwjgl.opengl.GL11.GL_TRUE;
[/quote]

Weird. I tried that in LWJGL, but it didn't work. I assumed it wouldn't work in JInput, but looks like it does.

LWJGL's docs

How would you check if the controller has reconnected? Would the .poll work again?
What if you connected a new joystick? How would you rebuild the list attached gamepads, if, say, you started the program and then connected a controller? IIRC, both JInput and LWJGL only build the list the first time you call it, and will give you only that list from that point on.
__________________
But why?

Last edited by Maxwell777 : 18-09-2015 at 14:20. Reason: forgot stuff
Reply With Quote