Changeset 1879 in orxonox.OLD for orxonox/trunk/core
- Timestamp:
- May 8, 2004, 1:12:33 PM (21 years ago)
- Location:
- orxonox/trunk/core
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/Makefile
r1872 r1879 51 51 52 52 .cc.o: 53 @ echo "$@ wird kompiliert..."53 @ echo "$@ is being compiled..." 54 54 @ $(CXX) -c $(CFLAGS) -I$(INCDIR) -o $@ $< 55 55 … … 60 60 61 61 $(TARGET): $(OBJECTS) 62 @ echo "orxonox wird gelinkt..."62 @ echo "orxonox is being linked..." 63 63 @ $(CXX) $(LIBS) -o $(TARGET) $(OBJECTS) 64 64 … … 74 74 75 75 clean: 76 rm -rf *.o *~ 76 rm -rf *.o *~ orxonox 77 77 78 78 -
orxonox/trunk/core/input_output.cc
r1875 r1879 43 43 void InputOutput::goUp() 44 44 { 45 (*player).go X(BASE_STEP);45 (*player).goY(STEP_FRONT); 46 46 } 47 47 48 48 void InputOutput::goDown() 49 49 { 50 (*player).go X(-BASE_STEP);50 (*player).goY(-STEP_FRONT); 51 51 } 52 52 53 53 void InputOutput::goLeft() 54 54 { 55 (*player).goY(-BASE_STEP); 55 (*player).goX(-STEP_SIDE); 56 56 57 } 57 58 58 59 void InputOutput::goRight() 59 60 { 60 (*player).goY(BASE_STEP); 61 62 (*player).goX(STEP_SIDE); 61 63 } 62 64 63 65 void InputOutput::shoot() 64 66 { 65 (*player).shoot( BASE_STEP);67 (*player).shoot(1); 66 68 } -
orxonox/trunk/core/input_output.h
r1873 r1879 9 9 #include "player.h" 10 10 11 #define BASE_STEP 2 11 #define STEP_SIDE 0.4 12 #define STEP_FRONT 0.2 12 13 13 14 class InputOutput { -
orxonox/trunk/core/orxonox.cc
r1875 r1879 54 54 bool Orxonox::rightWeGo = false; 55 55 bool Orxonox::leftWeGo = false; 56 int Orxonox::alpha = 0; 57 int Orxonox::beta = 0; 58 //int Orxonox::offsetX = 0; 59 //int Orxonox::offsetY = 0; 56 60 57 61 Orxonox* Orxonox::getInstance (void) … … 68 72 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); 69 73 glutInitWindowSize(500, 500); 74 //glutFullScreen(); 70 75 glutInitWindowPosition(100, 100); 71 76 glutCreateWindow("orxOnox"); … … 93 98 // (*localPlayer).addIO(io); 94 99 95 glutIgnoreKeyRepeat(1); /* for win32 */96 glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); /* for linux X11 */100 //glutIgnoreKeyRepeat(1); /* for win32 */ 101 //glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); /* for linux X11 */ 97 102 glutSpecialFunc(specFunc); 98 103 glutSpecialUpFunc(releaseKey); … … 107 112 { 108 113 switch(key) { 114 115 /* perspectiv control */ 116 case 'w': 117 beta -= 1; 118 break; 119 case 's': 120 beta += 1; 121 break; 122 case 'a': 123 alpha -= 1; 124 break; 125 case 'd': 126 alpha += 1; 127 break; 128 129 /* game controls */ 109 130 110 131 case 'p': … … 131 152 void Orxonox::quitGame() 132 153 { 133 glutSetKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); /*do not remove or you will have 134 no repeating keys anymore...*/ 154 //glutIgnoreKeyRepeat(0); /* for win32 */ 155 //glutSetKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); /*do not remove or you will have 156 // no repeating keys anymore...*/ 135 157 cout << "finished garbage colletion, quitting..." << endl; 136 158 exit(0); … … 165 187 { 166 188 switch(key) { 189 190 /* spacecraft controls */ 191 167 192 case GLUT_KEY_UP: 168 193 upWeGo = true; … … 184 209 { 185 210 glClear(GL_COLOR_BUFFER_BIT); 211 212 glColor3f(0.0, 0.5, 0.6); 213 glLoadIdentity(); 214 gluLookAt(0.0, -14.0, 15.0, 0.0 + alpha, 0.0 + beta, 0.0, 0.0, 1.0, 0.0); 186 215 (*world).drawWorld(); 216 187 217 glutSwapBuffers(); 188 218 } … … 203 233 } 204 234 /* request repaint */ 235 236 //cout << "contiousRedraw" << endl; 205 237 glutPostRedisplay(); 206 238 } … … 212 244 glMatrixMode(GL_PROJECTION); 213 245 glLoadIdentity(); 214 glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); 246 //glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); pb: //simple and working 247 glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 200.0); 248 //glFrustum(-10.0, 10.0, -5.0, 10.0, 0.0, 100.0); 215 249 glMatrixMode(GL_MODELVIEW); 216 250 glLoadIdentity(); //pb why a second time? … … 220 254 void Orxonox::testTheShit() 221 255 { 222 Player* pl = new Player;223 (*pl).setPosition(1, 1, 1);224 (*world).addPlayer(pl);256 //Player* pl = new Player; 257 //(*pl).setPosition(1, 1, 1); 258 //(*world).addPlayer(pl); 225 259 226 260 //NPC* nl = new NPC; -
orxonox/trunk/core/orxonox.h
r1875 r1879 33 33 static bool leftWeGo; 34 34 35 static int alpha; 36 static int beta; 37 static int offsetX; 38 static int offsetY; 39 35 40 public: 36 41 -
orxonox/trunk/core/player.cc
r1875 r1879 32 32 33 33 34 void Player::setPosition( int x, int y, int z)34 void Player::setPosition( float x, float y, float z) 35 35 { 36 36 xCor = x; yCor = y; zCor = z; 37 37 } 38 38 39 void Player::getPosition( int* x, int* y, int* z)39 void Player::getPosition(float* x, float* y, float* z) 40 40 { 41 41 *x = xCor; *y = yCor; *z = zCor; 42 42 } 43 43 44 void Player::goX( int x)44 void Player::goX(float x) 45 45 { 46 46 xCor += x; … … 48 48 49 49 50 void Player::goY( int y)50 void Player::goY(float y) 51 51 { 52 52 yCor += y; 53 53 } 54 54 55 void Player::goZ( int z)55 void Player::goZ(float z) 56 56 { 57 57 zCor += z; … … 68 68 { 69 69 //cout << "Player::drawPlayer()" << endl; 70 glColor3f(1.0, 0.9, 0.4); 71 glRectf(-5.0 + yCor, -5.0 + xCor, 5.0 + yCor, 5.0 + xCor); 70 //glColor3f(0.0, 0.9, 0.7); 71 //glRectf(-0.5 + yCor, -0.5 + xCor, 0.5 + yCor, 2.0 + xCor); 72 73 glPushMatrix(); 74 glScalef(1.0, 3.0, 1.0); 75 glTranslatef(xCor, yCor, 3.0); 76 glutWireCube(1.0); 77 glPopMatrix(); 78 79 72 80 cout << "x: " << xCor << " y: " << yCor << endl; 73 81 } -
orxonox/trunk/core/player.h
r1872 r1879 14 14 ~Player (); 15 15 16 void setPosition( int x, int y, int z);17 void getPosition( int* x, int* y, int* z);18 void goX( int x);19 void goY( int y);20 void goZ( int x);16 void setPosition(float x, float y, float z); 17 void getPosition(float* x, float* y, float* z); 18 void goX(float x); 19 void goY(float y); 20 void goZ(float x); 21 21 void shoot(int n); 22 22 // void addIO(InputOutput *io); … … 25 25 private: 26 26 /* position of the space craft */ 27 int xCor;28 int yCor;29 int zCor;27 float xCor; 28 float yCor; 29 float zCor; 30 30 31 31 -
orxonox/trunk/core/world.cc
r1872 r1879 117 117 \brief Draws the World and all Objects contained 118 118 119 Calls the draw function of all: Objects, Players, Environement 119 Calls the draw function of all: Objects, Players, Environement. This is the core of all graphics here. 120 120 */ 121 121 void World::drawWorld(void) 122 122 { 123 /* first draw all players */ 123 124 playerList* tmpPlayer = lastPlayer; 124 125 Player* player = tmpPlayer->player; … … 128 129 tmpPlayer = tmpPlayer->next; 129 130 } 131 /* second draw all npcs */ 130 132 npcList* tmpNPC = lastNPC; 131 133 while( tmpNPC != null ) … … 134 136 tmpNPC = tmpNPC->next; 135 137 } 138 /* now draw the rest of the world: environement */ 139 glColor3f(0.0, 1.0, 0.0); 140 glBegin(GL_LINES); 141 glVertex3f(0.0, -10.0, 0.0); 142 glVertex3f(0.0, 200.0, 0.0); 143 144 glVertex3f(5.0, -10.0, 0.0); 145 glVertex3f(5.0, 200.0, 0.0); 146 147 glVertex3f(-5.0, -10.0, 0.0); 148 glVertex3f(-5.0, 200.0, 0.0); 149 150 glVertex3f(10.0, -10.0, 0.0); 151 glVertex3f(10.0, 200.0, 0.0); 152 153 glVertex3f(-10.0, -10.0, 0.0); 154 glVertex3f(-10.0, 200.0, 0.0); 155 156 glVertex3f(15.0, -10.0, 0.0); 157 glVertex3f(15.0, 200.0, 0.0); 158 159 glVertex3f(-15.0, -10.0, 0.0); 160 glVertex3f(-15.0, 200.0, 0.0); 161 162 glVertex3f(20.0, -10.0, 0.0); 163 glVertex3f(20.0, 200.0, 0.0); 164 165 glVertex3f(-20.0, -10.0, 0.0); 166 glVertex3f(-20.0, 200.0, 0.0); 167 168 glVertex3f(25.0, -10.0, 0.0); 169 glVertex3f(25.0, 200.0, 0.0); 170 171 glVertex3f(-25.0, -10.0, 0.0); 172 glVertex3f(-25.0, 200.0, 0.0); 173 glEnd(); 174 175 136 176 } 137 177
Note: See TracChangeset
for help on using the changeset viewer.