1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Formatting pass (no code changes).

This commit is contained in:
Camilla Berglund 2010-09-08 16:02:02 +02:00
parent a4d888c2f5
commit 61cc652a2f

View File

@ -101,14 +101,17 @@ void _glfwInitJoysticks(void)
// Pick joystick base name // Pick joystick base name
switch (k) switch (k)
{ {
case 0: case 0:
joy_base_name = "/dev/input/js"; // USB sticks // USB joysticks
break; joy_base_name = "/dev/input/js";
case 1: break;
joy_base_name = "/dev/js"; // "Legacy" sticks case 1:
break; // "Legacy" joysticks
default: joy_base_name = "/dev/js";
continue; // (should never happen) break;
default:
// This should never happen
continue;
} }
// Try to open a few of these sticks // Try to open a few of these sticks
@ -229,21 +232,21 @@ static void pollJoystickEvents(void)
// Check event type // Check event type
switch (e.type) switch (e.type)
{ {
case JS_EVENT_AXIS: case JS_EVENT_AXIS:
_glfwJoy[i].Axis[e.number] = (float) e.value / 32767.0f; _glfwJoy[i].Axis[e.number] = (float) e.value / 32767.0f;
// We need to change the sign for the Y axes, so that // We need to change the sign for the Y axes, so that
// positive = up/forward, according to the GLFW spec. // positive = up/forward, according to the GLFW spec.
if (e.number & 1) if (e.number & 1)
_glfwJoy[i].Axis[e.number] = -_glfwJoy[i].Axis[e.number]; _glfwJoy[i].Axis[e.number] = -_glfwJoy[i].Axis[e.number];
break; break;
case JS_EVENT_BUTTON: case JS_EVENT_BUTTON:
_glfwJoy[i].Button[e.number] = _glfwJoy[i].Button[e.number] =
e.value ? GLFW_PRESS : GLFW_RELEASE; e.value ? GLFW_PRESS : GLFW_RELEASE;
break; break;
default: default:
break; break;
} }
} }
} }
@ -267,17 +270,17 @@ int _glfwPlatformGetJoystickParam(int joy, int param)
switch (param) switch (param)
{ {
case GLFW_PRESENT: case GLFW_PRESENT:
return GL_TRUE; return GL_TRUE;
case GLFW_AXES: case GLFW_AXES:
return _glfwJoy[joy].NumAxes; return _glfwJoy[joy].NumAxes;
case GLFW_BUTTONS: case GLFW_BUTTONS:
return _glfwJoy[joy].NumButtons; return _glfwJoy[joy].NumButtons;
default: default:
break; break;
} }
return 0; return 0;