So, I’m developing a split screen game using OpenGL. So obviously, I need to be able to get inputs from different controllers. right now I do it like this:
// Get joystick input values int count; const float *axes = glfwGetJoystickAxes(joystick, &count); const unsigned char *buttons = glfwGetJoystickButtons(joystick, &count);
the joystick variable is ofcourse which controller this player is using. Player one uses GLFW_JOYSTICK_1 and player 2 uses GLFW_JOYSTICK_2.
Then I use the values like this:
// Get throttle input from right trigger if (joystickPresent) throttleInput += (axes + 1) / 2; // Convert input from -1.0 - 1.0 to 0.0 - 1.0
this works great for the joysticks on the controllers but when I press one of the triggers, both players receive the input. Does anyone know why this happens and how to fix it?
I should probably also mention that I use xbox 360 controllers.