#include "deviceMouse.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 | mouse (int button, int state, int x, int y) |
void | motion (int x, int y) |
Variables | |
bool | isPresent |
int | intAxes |
int | intButtons |
long | intAxis [MAXAXES] |
bool | intButton [MAXBUTTONS] |
string | intName |
int | intX |
int | intY |
|
|
Definition at line 159 of file deviceMouse.cpp.
00159 { 00160 if (isPresent) { 00161 return intAxes; 00162 } else return 0; 00163 }
|
Definition at line 191 of file deviceMouse.cpp.
00191 { 00192 if (isPresent) { 00193 if (nr < intAxes) { 00194 return (intAxis[nr]); 00195 } else { 00196 return 0; 00197 }; 00198 } else { 00199 return 0; 00200 }; 00201 }
|
Definition at line 213 of file deviceMouse.cpp.
00213 { 00214 if (isPresent) { 00215 if (nr < intButtons) { 00216 return intButton[nr]; 00217 } else { 00218 return false; 00219 }; 00220 } else { 00221 return false; 00222 }; 00223 }
|
Definition at line 175 of file deviceMouse.cpp.
00175 { 00176 if (isPresent) { 00177 return intButtons; 00178 } else return 0; 00179 }
|
|
|
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 143 of file deviceMouse.cpp.
00143 { 00144 if (isPresent) { 00145 return intName; 00146 } else return "none found"; 00147 }
|
Definition at line 54 of file deviceMouse.cpp.
00054 { 00055 intAxes =2; 00056 intButtons=3; 00057 intName ="glut-mouse"; 00058 isPresent =true; 00059 00060 for (int i=0; i < intAxes; i++) { 00061 intAxis[i]=0; 00062 }; 00063 for (int i=0; i < intButtons; i++) { 00064 intButton[i]=false; 00065 }; 00066 00067 glutMouseFunc (mouse); 00068 glutPassiveMotionFunc (motion); 00069 00070 update (); 00071 00072 return true; 00073 }
|
Definition at line 99 of file deviceMouse.cpp.
00099 { 00100 if (isPresent) { 00101 int WindowHeight = glutGet ((GLenum)GLUT_WINDOW_HEIGHT); 00102 int WindowWidth = glutGet ((GLenum)GLUT_WINDOW_WIDTH); 00103 00104 intAxis[0]= ( ( WindowHeight / 2) - intY) * 100; 00105 intAxis[1]= ( ( WindowWidth / 2) - intX) * 100; 00106 00107 if ( intY > ( WindowHeight - 1 ) ) 00108 { 00109 intY = WindowHeight - 1; 00110 glutWarpPointer ( intX, intY ); 00111 } 00112 else if ( intY < 0 ) 00113 { 00114 intY = 1; 00115 glutWarpPointer ( intX, intY ); 00116 } 00117 00118 if ( intX > ( WindowWidth - 1 ) ) 00119 { 00120 intX = WindowWidth - 1; 00121 glutWarpPointer ( intX, intY ); 00122 } 00123 else if ( intX < 0 ) 00124 { 00125 intX = 1; 00126 glutWarpPointer ( intX, intY ); 00127 } 00128 00129 return true; 00130 } else return false; 00131 }
|
Definition at line 21 of file deviceMouse.cpp.
|
Definition at line 23 of file deviceMouse.cpp.
|
Definition at line 24 of file deviceMouse.cpp.
|
Definition at line 22 of file deviceMouse.cpp.
|
Definition at line 25 of file deviceMouse.cpp.
|
Definition at line 26 of file deviceMouse.cpp.
|
Definition at line 26 of file deviceMouse.cpp.
|
Definition at line 20 of file deviceMouse.cpp.