When I start my engine I query for which controller has 28 axes and I assign that GLFW_JOYSTICK_x to an int variable called moveController. Then I check using the following snippet:
void Engine::checkMove()
{
float position[28];
unsigned char buttons[19];
std::fill_n(position,28,0.0f);
if (glfwGetJoystickPos( moveController, position,28) == 28 ) {
glfwGetJoystickButtons(moveController,buttons,19);
// for loop limited to 16 because 16-17-18 seemed// to be always GLFW_PRESS for some reasonfor (int i=0;i < 16;++i) {
if (buttons[i] == GLFW_PRESS) {
std::cout << "Button " << i << " pressed " <<std::endl;
}
}
}
}
No comments:
Post a Comment