Win32 port work dump.

This commit is contained in:
Camilla Berglund 2010-09-13 01:17:34 +02:00
parent 90df26ac3c
commit 327dce138f

View File

@ -134,22 +134,22 @@ int _glfwPlatformGetJoystickPos(int joy, float* pos, int numaxes)
// Get position values for all axes // Get position values for all axes
axis = 0; axis = 0;
if (axis < numaxes) if (axis < numaxes)
pos[axis++] = _glfwCalcJoystickPos(ji.dwXpos, jc.wXmin, jc.wXmax); pos[axis++] = calcJoystickPos(ji.dwXpos, jc.wXmin, jc.wXmax);
if (axis < numaxes) if (axis < numaxes)
pos[axis++] = -_glfwCalcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax); pos[axis++] = -calcJoystickPos(ji.dwYpos, jc.wYmin, jc.wYmax);
if (axis < numaxes && jc.wCaps & JOYCAPS_HASZ) if (axis < numaxes && jc.wCaps & JOYCAPS_HASZ)
pos[axis++] = _glfwCalcJoystickPos(ji.dwZpos, jc.wZmin, jc.wZmax); pos[axis++] = calcJoystickPos(ji.dwZpos, jc.wZmin, jc.wZmax);
if (axis < numaxes && jc.wCaps & JOYCAPS_HASR) if (axis < numaxes && jc.wCaps & JOYCAPS_HASR)
pos[axis++] = _glfwCalcJoystickPos(ji.dwRpos, jc.wRmin, jc.wRmax); pos[axis++] = calcJoystickPos(ji.dwRpos, jc.wRmin, jc.wRmax);
if (axis < numaxes && jc.wCaps & JOYCAPS_HASU) if (axis < numaxes && jc.wCaps & JOYCAPS_HASU)
pos[axis++] = _glfwCalcJoystickPos(ji.dwUpos, jc.wUmin, jc.wUmax); pos[axis++] = calcJoystickPos(ji.dwUpos, jc.wUmin, jc.wUmax);
if (axis < numaxes && jc.wCaps & JOYCAPS_HASV) if (axis < numaxes && jc.wCaps & JOYCAPS_HASV)
pos[axis++] = -_glfwCalcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax); pos[axis++] = -calcJoystickPos(ji.dwVpos, jc.wVmin, jc.wVmax);
return axis; return axis;
} }
@ -160,7 +160,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)
{ {
JOYCAPS jc; JOYCAPS jc;
JOYINFOEX ji; JOYINFOEX ji;
@ -178,12 +178,10 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
_glfw_joyGetPosEx(joy - GLFW_JOYSTICK_1, &ji); _glfw_joyGetPosEx(joy - GLFW_JOYSTICK_1, &ji);
// Get states of all requested buttons // Get states of all requested buttons
button = 0; for (button = 0; button < numbuttons && button < (int) jc.wNumButtons; button++)
while (button < numbuttons && button < (int) jc.wNumButtons)
{ {
buttons[button] = (unsigned char) buttons[button] = (unsigned char)
(ji.dwButtons & (1UL << button) ? GLFW_PRESS : GLFW_RELEASE); (ji.dwButtons & (1UL << button) ? GLFW_PRESS : GLFW_RELEASE);
button++;
} }
return button; return button;