Rename joystick ID variables

This commit is contained in:
Camilla Berglund
2016-10-10 03:24:07 +02:00
parent bf747e32b4
commit efc6b35615
9 changed files with 119 additions and 119 deletions
+32 -32
View File
@@ -332,26 +332,26 @@ static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
//
static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
{
int joy = 0;
int jid = 0;
DIDEVCAPS dc;
DIPROPDWORD dipd;
IDirectInputDevice8* device;
_GLFWobjenumWin32 data;
_GLFWjoystickWin32* js;
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
{
if (memcmp(&_glfw.win32_js[joy].guid, &di->guidInstance, sizeof(GUID)) == 0)
if (memcmp(&_glfw.win32_js[jid].guid, &di->guidInstance, sizeof(GUID)) == 0)
return DIENUM_CONTINUE;
}
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
{
if (!_glfw.win32_js[joy].present)
if (!_glfw.win32_js[jid].present)
break;
}
if (joy > GLFW_JOYSTICK_LAST)
if (jid > GLFW_JOYSTICK_LAST)
return DIENUM_STOP;
if (supportsXInput(&di->guidProduct))
@@ -426,7 +426,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
sizeof(_GLFWjoyobjectWin32),
compareJoystickObjects);
js = _glfw.win32_js + joy;
js = _glfw.win32_js + jid;
js->device = device;
js->guid = di->guidInstance;
js->axisCount = data.axisCount + data.sliderCount;
@@ -438,7 +438,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
js->name = _glfwCreateUTF8FromWideStringWin32(di->tszInstanceName);
js->present = GLFW_TRUE;
_glfwInputJoystickChange(joy, GLFW_CONNECTED);
_glfwInputJoystickChange(jid, GLFW_CONNECTED);
return DIENUM_CONTINUE;
}
@@ -447,33 +447,33 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
//
static GLFWbool openXinputDevice(DWORD index)
{
int joy;
int jid;
XINPUT_CAPABILITIES xic;
_GLFWjoystickWin32* js;
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
{
if (_glfw.win32_js[joy].present &&
_glfw.win32_js[joy].device == NULL &&
_glfw.win32_js[joy].index == index)
if (_glfw.win32_js[jid].present &&
_glfw.win32_js[jid].device == NULL &&
_glfw.win32_js[jid].index == index)
{
return GLFW_FALSE;
}
}
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
{
if (!_glfw.win32_js[joy].present)
if (!_glfw.win32_js[jid].present)
break;
}
if (joy > GLFW_JOYSTICK_LAST)
if (jid > GLFW_JOYSTICK_LAST)
return GLFW_FALSE;
if (_glfw_XInputGetCapabilities(index, 0, &xic) != ERROR_SUCCESS)
return GLFW_FALSE;
js = _glfw.win32_js + joy;
js = _glfw.win32_js + jid;
js->axisCount = 6;
js->axes = calloc(js->axisCount, sizeof(float));
js->buttonCount = 14;
@@ -482,7 +482,7 @@ static GLFWbool openXinputDevice(DWORD index)
js->name = strdup(getDeviceDescription(&xic));
js->index = index;
_glfwInputJoystickChange(joy, GLFW_CONNECTED);
_glfwInputJoystickChange(jid, GLFW_CONNECTED);
return GLFW_TRUE;
}
@@ -675,10 +675,10 @@ void _glfwInitJoysticksWin32(void)
//
void _glfwTerminateJoysticksWin32(void)
{
int joy;
int jid;
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
closeJoystick(_glfw.win32_js + joy);
for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
closeJoystick(_glfw.win32_js + jid);
if (_glfw.win32.dinput8.api)
IDirectInput8_Release(_glfw.win32.dinput8.api);
@@ -715,10 +715,10 @@ void _glfwDetectJoystickConnectionWin32(void)
//
void _glfwDetectJoystickDisconnectionWin32(void)
{
int joy;
int jid;
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
pollJoystickState(_glfw.win32_js + joy, _GLFW_PRESENCE_ONLY);
for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
pollJoystickState(_glfw.win32_js + jid, _GLFW_PRESENCE_ONLY);
}
@@ -726,15 +726,15 @@ void _glfwDetectJoystickDisconnectionWin32(void)
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
int _glfwPlatformJoystickPresent(int joy)
int _glfwPlatformJoystickPresent(int jid)
{
_GLFWjoystickWin32* js = _glfw.win32_js + joy;
_GLFWjoystickWin32* js = _glfw.win32_js + jid;
return pollJoystickState(js, _GLFW_PRESENCE_ONLY);
}
const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
const float* _glfwPlatformGetJoystickAxes(int jid, int* count)
{
_GLFWjoystickWin32* js = _glfw.win32_js + joy;
_GLFWjoystickWin32* js = _glfw.win32_js + jid;
if (!pollJoystickState(js, _GLFW_UPDATE_STATE))
return NULL;
@@ -742,9 +742,9 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
return js->axes;
}
const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
const unsigned char* _glfwPlatformGetJoystickButtons(int jid, int* count)
{
_GLFWjoystickWin32* js = _glfw.win32_js + joy;
_GLFWjoystickWin32* js = _glfw.win32_js + jid;
if (!pollJoystickState(js, _GLFW_UPDATE_STATE))
return NULL;
@@ -752,9 +752,9 @@ const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
return js->buttons;
}
const char* _glfwPlatformGetJoystickName(int joy)
const char* _glfwPlatformGetJoystickName(int jid)
{
_GLFWjoystickWin32* js = _glfw.win32_js + joy;
_GLFWjoystickWin32* js = _glfw.win32_js + jid;
if (!pollJoystickState(js, _GLFW_PRESENCE_ONLY))
return NULL;