Reputation: 85
I'm trying to get input from a joystick(Thrustmaster Hotas x, if it matters) with GLFW, but using glfwGetJoystickAxes and Buttons does not work as expected. The axes output as 00007FF77FC0D820 and there is no information about the state of the buttons. What would I be doing wrong here?
const float* Joystick::getAxesState()
{
axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axesCount);
return axes;
}
const unsigned char* Joystick::getButtonState()
{
buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &buttonCount);
return buttons;
}
Upvotes: 0
Views: 2111
Reputation: 965
glfwGetJoystickAxes(<joystick>,<count>)
returns an array of float[<count>]
glfwGetJoystickButtons(<joystick>,<count>)
returns an array of unsigned char[<count>]
Try accessing them as <axes_return>[index]
and <buttons_return>[index]
.
Also as @Quentin mentioned, you should only call these functions once because the returns are pointers to glfw's internally stored states.
Upvotes: 2