Changeset 7304 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Apr 16, 2006, 8:27:32 PM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r7297 r7304 89 89 90 90 this->dataXML = NULL; 91 92 this->audioThread = NULL;93 91 } 94 92 … … 134 132 } 135 133 136 int GameWorld::createAudioThread(void* gameWorld)137 {138 GameWorld* gw = (GameWorld*)gameWorld;139 printf("STARTIG AUDIO THREAD\n");140 if(gw->dataTank && gw->dataTank->music != NULL)141 gw->dataTank->music->playback();142 143 while (gw->bRunning)144 {145 if(gw->dataTank && gw->dataTank->music != NULL)146 gw->dataTank->music->update();147 SDL_Delay(1);148 }149 printf("End the AudioThread\n");150 }151 134 152 135 /** … … 204 187 PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n"); 205 188 206 if (this->audioThread != NULL)207 {208 this->bRunning = false;209 SDL_WaitThread(this->audioThread, NULL);210 this->audioThread = NULL;211 }212 213 189 this->dataTank->unloadData(); 214 190 … … 227 203 this->bRunning = true; 228 204 229 if (this->audioThread == NULL)230 this->audioThread = SDL_CreateThread(GameWorld::createAudioThread, (void*)this);231 232 205 this->run(); 233 206 } … … 241 214 PRINTF(3)("GameWorld::stop() - got stop signal\n"); 242 215 this->bRunning = false; 243 244 if (this->audioThread != NULL)245 {246 this->bRunning = false;247 SDL_WaitThread(this->audioThread, NULL);248 this->audioThread = NULL;249 }250 251 this->audioThread = NULL;252 216 } 253 217 … … 288 252 this->dtS = 0.0f; 289 253 this->lastFrame = SDL_GetTicks (); 254 255 if (this->dataTank->music != NULL) 256 this->dataTank->music->play(); 290 257 291 258 while( this->bRunning) /* @todo implement pause */ -
trunk/src/story_entities/game_world.h
r7283 r7304 10 10 #include "story_entity.h" 11 11 #include "game_world_data.h" 12 13 #include <SDL_thread.h>14 12 15 13 class Shell; … … 56 54 static void toggleBVVisibility(); 57 55 58 static int createAudioThread(void* GameWorld);59 60 61 56 inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; } 62 57 … … 80 75 81 76 protected: 82 SDL_Thread* audioThread;83 77 GameWorldData* dataTank; //!< reference to the GameWorld Data Tank 84 78 TiXmlElement* dataXML; //!< The XML-Element this World has been loaded with.
Note: See TracChangeset
for help on using the changeset viewer.