1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -05:00

Fixed legacy C warnings.

This commit is contained in:
Camilla Berglund 2012-04-09 23:56:14 +02:00
parent 3bd54e0b60
commit 8390121869

View File

@ -572,7 +572,7 @@ int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes)
int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons, int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
int numbuttons) int numbuttons)
{ {
int button; int i, j, button;
if (joy < GLFW_JOYSTICK_1 || joy > GLFW_JOYSTICK_LAST) if (joy < GLFW_JOYSTICK_1 || joy > GLFW_JOYSTICK_LAST)
return 0; return 0;
@ -599,13 +599,13 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
const int directions[9] = { 1, 3, 2, 6, 4, 12, 8, 9, 0 }; // Bit fields of button presses for each direction, including nil const int directions[9] = { 1, 3, 2, 6, 4, 12, 8, 9, 0 }; // Bit fields of button presses for each direction, including nil
for (int i = 0; i < joystick.numHats; i++) for (i = 0; i < joystick.numHats; i++)
{ {
_glfwJoystickElement* hat = (_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick.hats, i); _glfwJoystickElement* hat = (_glfwJoystickElement*) CFArrayGetValueAtIndex(joystick.hats, i);
int value = hat->value; int value = hat->value;
if (value < 0 || value > 8) value = 8; if (value < 0 || value > 8) value = 8;
for (int j = 0; j < 4 && button < numbuttons; j++) for (j = 0; j < 4 && button < numbuttons; j++)
{ {
buttons[button++] = directions[value] & (1 << j) ? GLFW_PRESS : GLFW_RELEASE; buttons[button++] = directions[value] & (1 << j) ? GLFW_PRESS : GLFW_RELEASE;
} }