Changeset 1896 in orxonox.OLD for orxonox/trunk
- Timestamp:
- May 20, 2004, 1:01:57 AM (21 years ago)
- Location:
- orxonox/trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/README
r1856 r1896 20 20 1) Alien is a great film 21 21 2) Guiness is the most delicious beer 22 3) If you think there is anything missing: you can be shure it's an arcade game 22 23 23 24 to be continoued... -
orxonox/trunk/ToDo
r1853 r1896 1 2 3 4 orxonox: 5 -------- 6 7 - perspective change: smooth glide back in zero mode (pb) 1 8 2 9 -
orxonox/trunk/core/Makefile
r1883 r1896 41 41 world.o \ 42 42 input_output.o \ 43 environment.o 43 environment.o \ 44 shoot_laser.o 44 45 45 46 TARGET = orxonox -
orxonox/trunk/core/environment.cc
r1883 r1896 35 35 36 36 } 37 }38 39 for (int x = 0; x < 10; x++)40 {41 for (int y = 0; y < 10; y++)42 {43 cout << " " << mountainTest[x][y] << " ";44 45 }46 cout << endl;47 37 } 48 38 } -
orxonox/trunk/core/environment.h
r1883 r1896 3 3 #include <stdlib.h> 4 4 5 #ifndef PROTO_CLASS_H6 #define PROTO_CLASS_H5 #ifndef ENVIRONEMENT_H 6 #define ENVIRONEMENT_H 7 7 8 8 -
orxonox/trunk/core/input_output.cc
r1879 r1896 43 43 void InputOutput::goUp() 44 44 { 45 //cout << "InoutOutput::goUp" << endl; 45 46 (*player).goY(STEP_FRONT); 46 47 } -
orxonox/trunk/core/input_output.h
r1879 r1896 10 10 11 11 #define STEP_SIDE 0.4 12 #define STEP_FRONT 0. 212 #define STEP_FRONT 0.4 13 13 14 14 class InputOutput { -
orxonox/trunk/core/npc.cc
r1858 r1896 21 21 #include <iostream> 22 22 23 23 24 using namespace std; 24 25 25 26 26 27 NPC::NPC () {} 27 28 29 28 30 29 NPC::~NPC () {} … … 43 42 } 44 43 44 void NPC::setCollisionRadius(int r) 45 { 46 collisionRadius = r; 47 } 48 49 float NPC::getCollisionRadius() 50 { 51 return collisionRadius; 52 } 53 54 45 55 46 56 void NPC::drawNPC(void) -
orxonox/trunk/core/npc.h
r1858 r1896 13 13 void setPosition(int x, int y, int z); 14 14 void getPosition(int* x, int* y, int* z); 15 void setCollisionRadius(int r); 16 float getCollisionRadius(); 15 17 16 18 private: … … 18 20 19 21 int npcType; 22 23 /* collision control */ 24 int collisionRadius; 20 25 21 26 int xCor; -
orxonox/trunk/core/orxonox.cc
r1883 r1896 26 26 /* class definition header */ 27 27 #include "orxonox.h" 28 #include "environment.h"29 28 30 29 … … 50 49 World* Orxonox::world = 0; 51 50 InputOutput* Orxonox::io = 0; 51 Player* Orxonox::localPlayer = 0; 52 52 bool Orxonox::pause = false; 53 53 bool Orxonox::upWeGo = false; … … 55 55 bool Orxonox::rightWeGo = false; 56 56 bool Orxonox::leftWeGo = false; 57 bool Orxonox::shoot1 = false; 57 58 int Orxonox::alpha = 0; 58 59 int Orxonox::beta = 0; … … 82 83 glutReshapeFunc(reshape); 83 84 glutKeyboardFunc(keyboard); 85 glutKeyboardUpFunc(upKeyboard); 84 86 } 85 87 … … 96 98 world = new World; 97 99 (*world).initEnvironement(); 98 Player*localPlayer = new Player;100 localPlayer = new Player; 99 101 io = new InputOutput(world, localPlayer); 100 102 (*world).addPlayer(localPlayer); 101 103 Environment *env = new Environment; 102 104 (*world).addEnv(env); 103 104 105 105 106 glutSpecialFunc(specFunc); 106 107 glutSpecialUpFunc(releaseKey); 107 108 108 //for testing purps only109 //testTheShit();110 109 glutIdleFunc(continousRedraw); 110 //cout << "Orxonox::gameInit" << endl; 111 111 } 112 112 … … 131 131 132 132 /* game controls */ 133 134 133 case 'p': 135 134 if (pause) … … 146 145 } 147 146 break; 147 case 32: 148 shoot1 = true; 149 break; 148 150 case 27: 149 151 case 'q': … … 154 156 155 157 158 void Orxonox::upKeyboard(unsigned char key, int x, int y) 159 { 160 switch(key) { 161 case 32: 162 shoot1 = false; 163 break; 164 } 165 } 166 167 156 168 void Orxonox::quitGame() 157 169 { 158 //glutIgnoreKeyRepeat(0); /* for win32 */ 159 //glutSetKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); /*do not remove or you will have 160 // no repeating keys anymore...*/ 161 cout << "finished garbage colletion, quitting..." << endl; 170 //cout << "finished garbage colletion, quitting..." << endl; 162 171 exit(0); 163 172 } … … 191 200 { 192 201 switch(key) { 193 194 202 /* spacecraft controls */ 195 196 203 case GLUT_KEY_UP: 197 204 upWeGo = true; … … 226 233 { 227 234 /* check for input to pass it over */ 228 if ( !pause && (rightWeGo || leftWeGo || upWeGo || downWeGo )) {235 if ( !pause && (rightWeGo || leftWeGo || upWeGo || downWeGo || shoot1)) { 229 236 if (upWeGo) 230 237 (*io).goUp(); … … 235 242 if (leftWeGo) 236 243 (*io).goLeft(); 244 if (shoot1) 245 (*io).shoot(); 237 246 } 238 247 /* request repaint */ 239 240 //cout << "contiousRedraw" << endl;241 248 glutPostRedisplay(); 249 //cout << "Orxonox::continousRedraw" << endl; 242 250 } 243 251 … … 248 256 glMatrixMode(GL_PROJECTION); 249 257 glLoadIdentity(); 250 //glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); pb: //simple and working251 258 glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 200.0); 252 //glFrustum(-10.0, 10.0, -5.0, 10.0, 0.0, 100.0);253 259 glMatrixMode(GL_MODELVIEW); 254 260 glLoadIdentity(); //pb why a second time? -
orxonox/trunk/core/orxonox.h
r1879 r1896 12 12 #include <GL/glut.h> 13 13 14 15 #include "environment.h" 14 16 #include "world.h" 15 17 #include "input_output.h" 16 18 #include "data_tank.h" 17 19 #include "stdincl.h" 18 20 #include "player.h" 19 21 20 22 … … 27 29 static World* world; 28 30 static InputOutput* io; 31 static Player* localPlayer; 29 32 static bool pause; 30 33 static bool upWeGo; … … 32 35 static bool rightWeGo; 33 36 static bool leftWeGo; 37 static bool shoot1; 34 38 35 39 static int alpha; … … 50 54 static void reshape (int w, int h); 51 55 static void keyboard(unsigned char key, int x, int y); 56 static void upKeyboard(unsigned char key, int x, int y); 52 57 static void releaseKey(int key, int x, int y); 53 58 static void specFunc(int key, int x, int y); -
orxonox/trunk/core/player.cc
r1883 r1896 20 20 #include <iostream> 21 21 22 22 23 using namespace std; 23 24 … … 25 26 Player::Player () { 26 27 xCor = yCor = zCor = 0; 28 shootLaser = new ShootLaser; 27 29 } 28 30 29 30 31 Player::~Player () {} 31 Player::~Player () 32 { 33 //delete shootLaser; 34 } 32 35 33 36 … … 37 40 } 38 41 39 void Player::getPosition(float* x, float* y, float* z) 42 43 void Player::getPosition(float* x, float* y, float* z) 40 44 { 41 45 *x = xCor; *y = yCor; *z = zCor; … … 44 48 void Player::goX(float x) 45 49 { 50 //cout << "Player::goX" << endl; 46 51 xCor += x; 47 52 } … … 58 63 } 59 64 60 void Player::shoot(int n) { 65 void Player::shoot(int n) 66 { 67 shootLaser->addShoot(xCor, yCor, zCor); 68 //cout << "Player::shoot" << endl; 61 69 } 62 70 … … 67 75 void Player::drawPlayer(void) 68 76 { 69 //cout << "Player::drawPlayer()" << endl;70 //glColor3f(0.0, 0.9, 0.7);71 //glRectf(-0.5 + yCor, -0.5 + xCor, 0.5 + yCor, 2.0 + xCor);72 73 77 glPushMatrix(); 78 glTranslatef(xCor, yCor, 3.0); 74 79 glScalef(1.0, 3.0, 1.0); 75 glTranslatef(xCor, yCor, 3.0);76 80 glutWireCube(1.0); 77 81 glPopMatrix(); 82 /* draw all the shoots additionaly */ 83 shootLaser->drawShoot(); 84 //cout << "Player::drawPlayer" << endl; 85 } 78 86 79 87 80 //cout << "x: " << xCor << " y: " << yCor << endl; 81 } 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 -
orxonox/trunk/core/player.h
r1879 r1896 6 6 #include <GL/glut.h> 7 7 8 //#include "input_output.h" 8 #include "shoot_laser.h" 9 //#include "world.h" 9 10 10 11 class Player { … … 24 25 25 26 private: 26 /* position of the space 27 /* position of the spacecraft */ 27 28 float xCor; 28 29 float yCor; … … 30 31 31 32 32 33 /* this player wanna shoot? so include a ref to ShootLaser */ 34 ShootLaser* shootLaser; 33 35 }; 34 36 -
orxonox/trunk/core/world.cc
r1883 r1896 33 33 lastNPC = null; 34 34 lastEnv = null; 35 lastShoot = null; 35 36 } 36 37 … … 128 129 129 130 /** 130 \brief Remove Non-Player-Character 131 \brief Add environmental object 132 \param player A reference to the new env object 133 134 Add a new Environment to the world. Env has to be initialised before. 135 */ 136 bool World::addShoot(ShootLaser* shoot) 137 { 138 shootList* listMember = new shootList; 139 listMember->shoot = shoot; 140 if ( lastShoot != null ) 141 { 142 listMember->number = lastShoot->number + 1; 143 listMember->next = lastShoot; 144 } 145 else 146 { 147 listMember->number = 0; 148 listMember->next = null; 149 } 150 lastShoot = listMember; 151 } 152 153 154 /** 155 \brief Remove Non-Player Character 131 156 \param player A reference to the new npc object 132 157 … … 162 187 } 163 188 /* now draw the rest of the world: environement */ 164 /* second draw all npcs */165 189 envList* tmpEnv = lastEnv; 166 190 while( tmpEnv != null ) … … 169 193 tmpEnv = tmpEnv->next; 170 194 } 171 172 /* 173 glColor3f(0.0, 1.0, 0.0); 174 glBegin(GL_LINES); 175 for (int x = 0; x <= 35; x += 5) 176 { 177 glVertex3f((float)x, -10.0, 0.0); 178 glVertex3f((float)x, 200.0, 0.0); 179 180 glVertex3f(-(float)x, -10.0, 0.0); 181 glVertex3f(-(float)x, 200.0, 0.0); 182 } 183 for (int x = -10; x<= 200; x += 5) 184 { 185 glVertex3f(-50.0, (float)x, 0.0); 186 glVertex3f(50.0, (float)x, 0.0); 187 } 188 glEnd(); 189 */ 190 195 /* now draw all the shoots (many) */ 196 shootList* tmpShoot = lastShoot; 197 while( tmpShoot != null ) 198 { 199 (*tmpShoot->shoot).drawShoot(); 200 tmpShoot = tmpShoot->next; 201 } 191 202 192 203 glColor3f(0.0, 1.0, 0.0); -
orxonox/trunk/core/world.h
r1883 r1896 10 10 #include "player.h" 11 11 #include "environment.h" 12 #include "shoot_laser.h" 12 13 #include "stdincl.h" 13 14 … … 47 48 envList* lastEnv; 48 49 50 /* a list of all shoot-amental objects */ 51 struct shootList { 52 shootList* next; 53 ShootLaser* shoot; 54 int number; 55 }; 56 shootList* lastShoot; 57 58 49 59 bool addPlayer(Player* player); 50 60 bool removePlayer(Player* player); 51 61 Player* getLocalPlayer(); 52 53 62 bool addNPC(NPC* npc); 54 63 bool removeNPC(NPC* npc); 55 56 64 bool addEnv(Environment* env); 65 bool addShoot(ShootLaser* shoot); 57 66 58 67 void drawWorld(void); -
orxonox/trunk/gui/Makefile
r1864 r1896 74 74 clean: 75 75 rm -rf *.o *~ 76 rm $(TARGET)76 rm -f $(TARGET) 77 77 78 78 ####compile
Note: See TracChangeset
for help on using the changeset viewer.