Changeset 7283 in orxonox.OLD for trunk/src/story_entities/game_world.cc
- Timestamp:
- Apr 13, 2006, 7:15:37 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r7221 r7283 89 89 90 90 this->dataXML = NULL; 91 92 this->audioThread = NULL; 91 93 } 92 94 … … 100 102 { 101 103 PRINTF(4)("Deleted GameWorld\n"); 104 105 if (this->audioThread != NULL) 106 SDL_KillThread(this->audioThread); 102 107 } 103 108 … … 131 136 } 132 137 138 int GameWorld::createAudioThread(void* gameWorld) 139 { 140 GameWorld* gw = (GameWorld*)gameWorld; 141 printf("STARTIG AUDIO THREAD\n"); 142 while (gw->bRunning) 143 { 144 if(gw->dataTank->music != NULL) 145 gw->dataTank->music->playback(); 146 SDL_Delay(5); 147 } 148 printf("End the AudioThread\n"); 149 } 133 150 134 151 /** … … 199 216 bool GameWorld::start() 200 217 { 201 this->isPaused = false; 202 this->isRunning = true; 218 this->bPaused = false; 219 this->bRunning = true; 220 221 if (this->audioThread == NULL) 222 this->audioThread = SDL_CreateThread(GameWorld::createAudioThread, (void*)this); 203 223 204 224 this->run(); … … 212 232 { 213 233 PRINTF(3)("GameWorld::stop() - got stop signal\n"); 214 this->isRunning = false; 234 this->bRunning = false; 235 236 // SDL_KillThread(this->audioThread); 237 this->audioThread = NULL; 215 238 } 216 239 … … 221 244 bool GameWorld::pause() 222 245 { 223 this-> isPaused = true;246 this->bPaused = true; 224 247 } 225 248 … … 230 253 bool GameWorld::resume() 231 254 { 232 this-> isPaused = false;255 this->bPaused = false; 233 256 } 234 257 … … 243 266 void GameWorld::run() 244 267 { 245 /* start the music */246 if(this->dataTank->music != NULL)247 this->dataTank->music->playback();248 249 268 PRINTF(3)("GameWorld::mainLoop() - Entering main loop\n"); 250 269 … … 256 275 this->lastFrame = SDL_GetTicks (); 257 276 258 while( this-> isRunning) /* @todo implement pause */277 while( this->bRunning) /* @todo implement pause */ 259 278 { 260 279 /* process intput */ 261 280 this->handleInput (); 262 if( !this-> isRunning)281 if( !this->bRunning) 263 282 break; 264 283 … … 326 345 Uint32 currentFrame = SDL_GetTicks(); 327 346 328 if( !this-> isPaused)347 if( !this->bPaused) 329 348 { 330 349 // CALCULATE FRAMERATE
Note: See TracChangeset
for help on using the changeset viewer.