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
+6 -6
View File
@@ -459,26 +459,26 @@ static void monitor_callback(GLFWmonitor* monitor, int event)
}
}
static void joystick_callback(int joy, int event)
static void joystick_callback(int jid, int event)
{
if (event == GLFW_CONNECTED)
{
int axisCount, buttonCount;
glfwGetJoystickAxes(joy, &axisCount);
glfwGetJoystickButtons(joy, &buttonCount);
glfwGetJoystickAxes(jid, &axisCount);
glfwGetJoystickButtons(jid, &buttonCount);
printf("%08x at %0.3f: Joystick %i (%s) was connected with %i axes and %i buttons\n",
counter++, glfwGetTime(),
joy,
glfwGetJoystickName(joy),
jid,
glfwGetJoystickName(jid),
axisCount,
buttonCount);
}
else
{
printf("%08x at %0.3f: Joystick %i was disconnected\n",
counter++, glfwGetTime(), joy);
counter++, glfwGetTime(), jid);
}
}
+7 -7
View File
@@ -60,17 +60,17 @@ static void error_callback(int error, const char* description)
fprintf(stderr, "Error: %s\n", description);
}
static void joystick_callback(int joy, int event)
static void joystick_callback(int jid, int event)
{
if (event == GLFW_CONNECTED)
joysticks[joystick_count++] = joy;
joysticks[joystick_count++] = jid;
else if (event == GLFW_DISCONNECTED)
{
int i;
for (i = 0; i < joystick_count; i++)
{
if (joysticks[i] == joy)
if (joysticks[i] == jid)
break;
}
@@ -90,7 +90,7 @@ static const char* joystick_label(int jid)
int main(void)
{
int joy;
int jid;
GLFWwindow* window;
struct nk_context* nk;
struct nk_font_atlas* atlas;
@@ -102,10 +102,10 @@ int main(void)
if (!glfwInit())
exit(EXIT_FAILURE);
for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
{
if (glfwJoystickPresent(joy))
joystick_callback(joy, GLFW_CONNECTED);
if (glfwJoystickPresent(jid))
joystick_callback(jid, GLFW_CONNECTED);
}
glfwSetJoystickCallback(joystick_callback);