29 #ifdef Q_OS_MAC // joystick support for Mac OS:
48 #ifdef Q_OS_MAC // joystick support for Mac OS:
49 int currentJoystick = 0;
62 if (numJoysticks != 0)
64 for (currentJoystick=0; currentJoystick<numJoysticks; currentJoystick++)
69 joystick[currentJoystick].Read();
77 if (joystick[currentJoystick].axis[buttonOrAxis].exist != 0)
80 emit
joystickMoved(buttonOrAxis, (
int) qRound(joystick[currentJoystick].axis[buttonOrAxis].GetCalibratedValue() * 32767) );
90 if (joystick[currentJoystick].button[buttonOrAxis].exist != 0)
92 if (joystick[currentJoystick].button[buttonOrAxis].value == 1)
109 if (joystick[currentJoystick].hatSwitch[buttonOrAxis].exist != 0)
124 switch (joystick[currentJoystick].hatSwitch[buttonOrAxis].value)
154 #ifdef Q_OS_LINUX // joystick support for Linux:
157 axisButtonNumber = 0;
167 ioctl(fd, JSIOCGVERSION, &version);
168 ioctl(fd, JSIOCGAXES, &axes);
169 ioctl(fd, JSIOCGBUTTONS, &buttons);
171 ioctl(fd, JSIOCGAXMAP, axmap);
172 ioctl(fd, JSIOCGBTNMAP, btnmap);
215 if (read(fd, &js,
sizeof(
struct js_event)) !=
sizeof(
struct js_event))
217 emit
message(
"Error reading joystick device!");
226 emit
message(
"Joystick initialised.");
228 case JS_EVENT_BUTTON:
229 axisButtonNumber = js.number;
242 axisButtonNumber = js.number;
243 axisButtonValue = js.value;
257 #ifdef Q_OS_LINUX // joystick support for Linux:
270 #ifdef Q_OS_MAC // joystick support for Mac OS:
274 if (numJoysticks != 0)