#include "../../devicePlugIn.h"#include <string>#include <GL/glut.h>Go to the source code of this file.
Defines | |
| #define | MAXAXES 100 |
| #define | MAXBUTTONS 200 |
Functions | |
| bool | openDevice (void) |
| void | closeDevice (void) |
| bool | update (void) |
| string | name (void) |
| int | axes (void) |
| int | buttons (void) |
| long | axis (int nr) |
| bool | buttonPressed (int nr) |
| void | mouse (int button, int state, int x, int y) |
| void | motion (int x, int y) |
Variables | |
| DevicePlugIn | inputPlugIn = { openDevice, closeDevice, update, name, axes, buttons, axis, buttonPressed } |
|
Definition at line 9 of file deviceMouse.h.
|
Definition at line 10 of file deviceMouse.h.
|
Definition at line 171 of file inputDeviceJoystick.cpp.
00171 {
00172 if (isPresent) {
00173 return intAxes;
00174 } else return 0;
00175 }
|
Definition at line 203 of file inputDeviceJoystick.cpp.
00203 {
00204 if (isPresent) {
00205 if (nr < intAxes) {
00206 return (intAxis[nr]);
00207 } else {
00208 return 0;
00209 };
00210 } else {
00211 return 0;
00212 };
00213 }
|
Definition at line 225 of file inputDeviceJoystick.cpp.
00225 {
00226 if (isPresent) {
00227 if (nr < intButtons) {
00228 return intButton[nr];
00229 } else {
00230 return false;
00231 };
00232 } else {
00233 return false;
00234 };
00235 }
|
Definition at line 187 of file inputDeviceJoystick.cpp.
00187 {
00188 if (isPresent) {
00189 return intButtons;
00190 } else return 0;
00191 }
|
Definition at line 104 of file inputDeviceJoystick.cpp.
00104 {
00105 close (joyHandle);
00106 return;
00107 }
|
|
Definition at line 226 of file deviceMouse.cpp.
00226 {
00227 if (state == GLUT_DOWN) {
00228 intButton[button]=true;
00229 } else {
00230 intButton[button]=false;
00231 };
00232 }
|
Definition at line 155 of file inputDeviceJoystick.cpp.
00155 {
00156 if (isPresent) {
00157 return intName;
00158 } else return "none found";
00159 }
|
Definition at line 60 of file inputDeviceJoystick.cpp.
00060 {
00061 for (int i = 1; i <= MAXAXES; i++) {
00062 intAxis[i]=0;
00063 maxAxis[i]=1;
00064 };
00065
00066 joyHandle = open ("/dev/js0", O_RDONLY | O_NONBLOCK);
00067
00068 if (joyHandle) {
00069 isPresent = true;
00070 } else {
00071 isPresent = false;
00072 return false;
00073 };
00074
00075 char tmp[128];
00076
00077 ioctl (joyHandle, JSIOCGAXES, &intAxes);
00078 ioctl (joyHandle, JSIOCGBUTTONS, &intButtons);
00079 ioctl (joyHandle, JSIOCGNAME(128), tmp);
00080
00081 intName.assign (tmp);
00082
00083 for (int i=0; i < intAxes; i++) {
00084 intAxis[i]=0;
00085 };
00086 for (int i=0; i < intButtons; i++) {
00087 intButton[i]=false;
00088 };
00089
00090 update ();
00091 return true;
00092 }
|
Definition at line 119 of file inputDeviceJoystick.cpp.
00119 {
00120 if (isPresent) {
00121
00122 read (joyHandle, &jsEvent, sizeof (struct js_event));
00123
00124 switch (jsEvent.type) {
00125 case 1 : { if (jsEvent.value == 1) {
00126 intButton[jsEvent.number]=true;
00127 } else {
00128 intButton[jsEvent.number]=false;
00129 };
00130 break;
00131 };
00132 case 2 : { intAxis[jsEvent.number] = jsEvent.value;
00133 break;
00134 };
00135 case 129:
00136 case 130: break;
00137 default: { printf ("unhandled InputDeviceJoystick event: type=%i, number=%i, value=%i\n", jsEvent.type, jsEvent.number, jsEvent.value);
00138 break;
00139 };
00140 };
00141 return true;
00142 } else return false;
00143 }
|
Definition at line 28 of file deviceMouse.h.
1.1.2 written by Dimitri van Heesch,
© 1997-2000