#include "deviceKeyboard.h"#include <string.h>#include <iostream>#include <iomanip>Go to the source code of this file.
Functions | |
| DevicePlugIn* | GetDevicePlugIn (void) |
| bool | openDevice () |
| void | closeDevice () |
| bool | update () |
| string | name () |
| int | axes () |
| int | buttons () |
| long | axis (int nr) |
| bool | buttonPressed (int nr) |
| void | keyboard (unsigned char key, int x, int y) |
| void | keyboardUp (unsigned char key, int x, int y) |
| void | special (int key, int x, int y) |
| void | specialUp (int key, int x, int y) |
Variables | |
| bool | isPresent |
| int | intAxes |
| int | intButtons |
| long | intAxis [MAXAXES] |
| long | maxAxis [MAXAXES] |
| bool | intButton [MAXBUTTONS] |
| string | intName |
| bool | chatmode |
| bool | keyunderway |
| bool | keypassed |
|
|
Definition at line 147 of file deviceKeyboard.cpp.
00147 {
00148 if (isPresent) {
00149 return intAxes;
00150 } else return 0;
00151 }
|
Definition at line 179 of file deviceKeyboard.cpp.
00179 {
00180 if (isPresent) {
00181 if (nr < intAxes) {
00182 return (intAxis[nr]);
00183 } else {
00184 return 0;
00185 };
00186 } else {
00187 return 0;
00188 };
00189 }
|
Definition at line 201 of file deviceKeyboard.cpp.
00201 {
00202 if (isPresent) {
00203 if (nr < intButtons) {
00204 return intButton[nr];
00205 } else {
00206 return false;
00207 };
00208 } else {
00209 return false;
00210 };
00211 }
|
Definition at line 163 of file deviceKeyboard.cpp.
00163 {
00164 if (isPresent) {
00165 return intButtons;
00166 } else return 0;
00167 }
|
|
Definition at line 214 of file deviceKeyboard.cpp.
00214 {
00215 if (!chatmode) {
00216 intButton[0]=(key == 'f');
00217 intButton[1]=(key == 'b');
00218 intButton[2]=((key == 27) || (key == 'q') || (key == 'x'));
00219 intButton[3]=(key == '+');
00220 intButton[4]=(key == '-');
00221 } else {
00222 intAxis[2]=(long) key;
00223 keyunderway = true;
00224 };
00225 }
|
Definition at line 227 of file deviceKeyboard.cpp.
00227 {
00228 if (!chatmode) {
00229 switch (key) {
00230 case 'f' : { intButton[0] = false;
00231 break;
00232 };
00233 case 'b' : { intButton[1] = false;
00234 break;
00235 };
00236 case 27 :
00237 case 'q' :
00238 case 'x' : { intButton[2] = false;
00239 break;
00240 };
00241 case '+' : { intButton[3] = false;
00242 break;
00243 };
00244 case '-' : { intButton[4] = false;
00245 break;
00246 };
00247 default : break;
00248 };
00249 } else {
00250 intAxis[2]=0;
00251 };
00252 }
|
Definition at line 131 of file deviceKeyboard.cpp.
00131 {
00132 if (isPresent) {
00133 return intName;
00134 } else return "none found";
00135 }
|
Definition at line 57 of file deviceKeyboard.cpp.
00057 {
00058 intAxes =3;
00059 intButtons=6;
00060 intName ="glut-keyboard";
00061 isPresent =true;
00062 chatmode = false;
00063 keyunderway = false;
00064 keypassed = false;
00065
00066 for (int i=0; i < intAxes; i++) {
00067 intAxis[i]=0;
00068 };
00069 for (int i=0; i < intButtons; i++) {
00070 intButton[i]=false;
00071 };
00072
00073 glutKeyboardFunc (keyboard);
00074 glutKeyboardUpFunc (keyboardUp);
00075 glutSpecialFunc (special);
00076 glutSpecialUpFunc (specialUp);
00077
00078 update ();
00079
00080 return true;
00081 }
|
Definition at line 254 of file deviceKeyboard.cpp.
00254 {
00255 if (key == GLUT_KEY_UP) {
00256 intAxis[0]=32767;
00257 } else if (key == GLUT_KEY_DOWN) {
00258 intAxis[0]=-32767;
00259 } else {
00260 intAxis[0]=0;
00261 };
00262
00263 if (key == GLUT_KEY_LEFT) {
00264 intAxis[1]=32767;
00265 } else if (key == GLUT_KEY_RIGHT) {
00266 intAxis[1]=-32767;
00267 } else {
00268 intAxis[1]=0;
00269 };
00270
00271 if (key == GLUT_KEY_F1) {
00272 intButton[5]=true;
00273 chatmode = !chatmode;
00274 } else {
00275 intButton[5]=false;
00276 };
00277 }
|
Definition at line 279 of file deviceKeyboard.cpp.
00279 {
00280 switch (key) {
00281 case GLUT_KEY_UP :
00282 case GLUT_KEY_DOWN: { intAxis[0] = 0;
00283 break;
00284 };
00285 case GLUT_KEY_LEFT :
00286 case GLUT_KEY_RIGHT:{ intAxis[1] = 0;
00287 break;
00288 };
00289 case GLUT_KEY_F1 : { intButton[5] = false;
00290 break;
00291 };
00292 default : break;
00293 };
00294 }
|
Definition at line 107 of file deviceKeyboard.cpp.
00107 {
00108 if (isPresent) {
00109 if (keypassed) {
00110 intAxis[2]=0;
00111 keypassed = false;
00112 keyunderway = false;
00113 };
00114 if (keyunderway) {
00115 keypassed = true;
00116 };
00117 return true;
00118 } else return false;
00119 }
|
Definition at line 27 of file deviceKeyboard.cpp.
|
Definition at line 21 of file deviceKeyboard.cpp.
|
Definition at line 23 of file deviceKeyboard.cpp.
|
Definition at line 25 of file deviceKeyboard.cpp.
|
Definition at line 22 of file deviceKeyboard.cpp.
|
Definition at line 26 of file deviceKeyboard.cpp.
|
Definition at line 20 of file deviceKeyboard.cpp.
|
Definition at line 29 of file deviceKeyboard.cpp.
|
Definition at line 28 of file deviceKeyboard.cpp.
|
Definition at line 24 of file deviceKeyboard.cpp.
1.1.2 written by Dimitri van Heesch,
© 1997-2000