Changeset 1875 in orxonox.OLD for orxonox/trunk/core
- Timestamp:
- May 7, 2004, 10:49:55 AM (21 years ago)
- Location:
- orxonox/trunk/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/input_output.cc
r1872 r1875 53 53 void InputOutput::goLeft() 54 54 { 55 cout << "left";56 55 (*player).goY(-BASE_STEP); 57 56 } … … 59 58 void InputOutput::goRight() 60 59 { 61 cout << "right";62 60 (*player).goY(BASE_STEP); 63 61 } -
orxonox/trunk/core/orxonox.cc
r1874 r1875 39 39 40 40 41 Orxonox::~Orxonox () {} 41 Orxonox::~Orxonox () 42 { 43 glutSetKeyRepeat(GLUT_KEY_REPEAT_ON); 44 } 42 45 43 46 … … 47 50 InputOutput* Orxonox::io = 0; 48 51 bool Orxonox::pause = false; 49 52 bool Orxonox::upWeGo = false; 53 bool Orxonox::downWeGo = false; 54 bool Orxonox::rightWeGo = false; 55 bool Orxonox::leftWeGo = false; 50 56 51 57 Orxonox* Orxonox::getInstance (void) … … 87 93 // (*localPlayer).addIO(io); 88 94 95 glutIgnoreKeyRepeat(1); /* for win32 */ 96 glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); /* for linux X11 */ 89 97 glutSpecialFunc(specFunc); 98 glutSpecialUpFunc(releaseKey); 90 99 91 100 //for testing purps only … … 114 123 break; 115 124 case 27: 116 exit(0); 125 quitGame(); 126 break; 127 } 128 } 129 130 131 void Orxonox::quitGame() 132 { 133 glutSetKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); /*do not remove or you will have 134 no repeating keys anymore...*/ 135 cout << "finished garbage colletion, quitting..." << endl; 136 exit(0); 137 } 138 139 140 void Orxonox::releaseKey(int key, int x, int y) 141 { 142 switch(key) { 143 case GLUT_KEY_UP: 144 upWeGo = false; 145 break; 146 case GLUT_KEY_DOWN: 147 downWeGo = false; 148 break; 149 case GLUT_KEY_RIGHT: 150 rightWeGo = false; 151 break; 152 case GLUT_KEY_LEFT: 153 leftWeGo = false; 117 154 break; 118 155 } … … 129 166 switch(key) { 130 167 case GLUT_KEY_UP: 131 cout << "key_up" << endl; 132 (*io).goUp(); 168 upWeGo = true; 133 169 break; 134 170 case GLUT_KEY_DOWN: 135 cout << "key_down" << endl; 136 (*io).goDown(); 171 downWeGo = true; 137 172 break; 138 173 case GLUT_KEY_RIGHT: 139 cout << "key_right" << endl; 140 (*io).goRight(); 174 rightWeGo = true; 141 175 break; 142 176 case GLUT_KEY_LEFT: 143 cout << "key_left" << endl; 144 (*io).goLeft(); 177 leftWeGo = true; 145 178 break; 146 179 } … … 158 191 void Orxonox::continousRedraw() 159 192 { 193 /* check for input to pass it over */ 194 if ( !pause && (rightWeGo || leftWeGo || upWeGo || downWeGo)) { 195 if (upWeGo) 196 (*io).goUp(); 197 if (downWeGo) 198 (*io).goDown(); 199 if (rightWeGo) 200 (*io).goRight(); 201 if (leftWeGo) 202 (*io).goLeft(); 203 } 204 /* request repaint */ 160 205 glutPostRedisplay(); 161 206 } -
orxonox/trunk/core/orxonox.h
r1872 r1875 28 28 static InputOutput* io; 29 29 static bool pause; 30 static bool upWeGo; 31 static bool downWeGo; 32 static bool rightWeGo; 33 static bool leftWeGo; 30 34 31 35 public: … … 41 45 static void reshape (int w, int h); 42 46 static void keyboard(unsigned char key, int x, int y); 47 static void releaseKey(int key, int x, int y); 43 48 static void specFunc(int key, int x, int y); 49 static void quitGame(void); 44 50 }; 45 51 -
orxonox/trunk/core/player.cc
r1872 r1875 44 44 void Player::goX(int x) 45 45 { 46 // (*player).goUp();47 46 xCor += x; 48 cout << "goX now..." << endl;49 47 } 50 48
Note: See TracChangeset
for help on using the changeset viewer.