Changeset 1872 in orxonox.OLD for orxonox/trunk/core/orxonox.cc
- Timestamp:
- May 6, 2004, 10:50:39 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/orxonox.cc
r1859 r1872 24 24 */ 25 25 26 27 28 29 30 31 26 /* class definition header */ 32 27 #include "orxonox.h" 33 #include "data_tank.h" 34 35 /* standard headers */ 36 #include <iostream> 37 #include <cstdio> 38 39 /* openGL Headers */ 40 #include <GL/glut.h> 28 41 29 42 30 using namespace std; … … 44 32 45 33 46 Orxonox::Orxonox () {} 34 Orxonox::Orxonox () 35 { 36 pause = false; 37 } 47 38 48 39 … … 53 44 /* this is a singleton class to prevent dublicates */ 54 45 Orxonox* Orxonox::singleton_ref = 0; 46 World* Orxonox::world = 0; 47 InputOutput* Orxonox::io = 0; 48 bool Orxonox::pause = false; 49 50 55 51 Orxonox* Orxonox::getInstance (void) 56 52 { … … 59 55 return singleton_ref; 60 56 } 61 62 57 63 58 … … 69 64 glutInitWindowPosition(100, 100); 70 65 glutCreateWindow("orxOnox"); 66 glShadeModel(GL_FLAT); 71 67 /* window event dispatchers */ 72 68 glutDisplayFunc(display); 73 69 glutReshapeFunc(reshape); 74 70 glutKeyboardFunc(keyboard); 71 } 72 73 74 int Orxonox::menuInit (void) 75 { 76 glClearColor(0.0, 0.0, 0.0, 0.0); 77 } 78 79 80 int Orxonox::gameInit (void) 81 { 82 glClearColor(0.0, 0.0, 0.0, 0.0); 83 world = new World; 84 Player* localPlayer = new Player; 85 io = new InputOutput(world, localPlayer); 86 (*world).addPlayer(localPlayer); 87 // (*localPlayer).addIO(io); 88 75 89 glutSpecialFunc(specFunc); 76 } 77 78 79 80 int Orxonox::menuInit (void) 81 { 82 glClearColor(0.0, 0.0, 0.0, 0.0); 83 } 84 85 86 87 int Orxonox::gameInit (void) 88 { 89 90 91 //for testing purps only 92 //testTheShit(); 90 93 } 91 94 … … 94 97 { 95 98 switch(key) { 99 100 case 'p': 101 if (pause) 102 { 103 cout << "unset pause" << endl; 104 glutIdleFunc(continousRedraw); 105 pause = false; 106 } 107 else 108 { 109 cout << "set pause" << endl; 110 glutIdleFunc(NULL); 111 pause = true; 112 } 113 break; 96 114 case 27: 97 115 exit(0); … … 101 119 102 120 121 /** 122 \brief special keys function. called by glut 123 124 Here are all special key function defined. 125 */ 103 126 void Orxonox::specFunc(int key, int x, int y) 104 127 { … … 106 129 case GLUT_KEY_UP: 107 130 cout << "key_up" << endl; 131 (*io).goUp(); 108 132 break; 109 133 case GLUT_KEY_DOWN: 110 134 cout << "key_down" << endl; 135 (*io).goDown(); 111 136 break; 112 137 case GLUT_KEY_RIGHT: 113 138 cout << "key_right" << endl; 139 (*io).goRight(); 114 140 break; 115 141 case GLUT_KEY_LEFT: 116 142 cout << "key_left" << endl; 143 (*io).goLeft(); 117 144 break; 118 145 } … … 120 147 121 148 122 void Orxonox::display (void)149 void Orxonox::display() 123 150 { 124 151 glClear(GL_COLOR_BUFFER_BIT); 152 (*world).drawWorld(); 125 153 glutSwapBuffers(); 126 154 } 127 155 156 157 void Orxonox::continousRedraw() 158 { 159 glutPostRedisplay(); 160 } 128 161 129 162 … … 139 172 140 173 174 void Orxonox::testTheShit() 175 { 176 Player* pl = new Player; 177 (*pl).setPosition(1, 1, 1); 178 (*world).addPlayer(pl); 179 180 //NPC* nl = new NPC; 181 //(*world).addNPC(nl); 182 //(*world).addNPC(nl); 183 //(*world).addNPC(nl); 184 //(*world).addNPC(nl); 185 //(*world).addNPC(nl); 186 //(*world).addNPC(nl); 187 //(*world).testThaTest(); 188 } 189 141 190 142 191 int main (int argc, char** argv) … … 144 193 Orxonox *orx = Orxonox::getInstance(); 145 194 (*orx).globalInit(argc, argv); 146 (*orx).menuInit(); 147 148 World* wd = new World; 149 Player* pl = new Player; 150 (*wd).addPlayer(pl); 151 (*wd).addPlayer(pl); 152 (*wd).addPlayer(pl); 153 (*wd).addPlayer(pl); 154 155 NPC* nl = new NPC; 156 (*wd).addNPC(nl); 157 (*wd).addNPC(nl); 158 (*wd).addNPC(nl); 159 (*wd).addNPC(nl); 160 (*wd).addNPC(nl); 161 (*wd).addNPC(nl); 162 (*wd).testThaTest(); 195 //(*orx).menuInit(); pb: directly jump to the game, no menu 196 (*orx).gameInit(); 163 197 164 198 glutMainLoop();
Note: See TracChangeset
for help on using the changeset viewer.