Changeset 10524 for code/branches/core7/src/libraries/core/Game.cc
- Timestamp:
- Jun 4, 2015, 10:32:52 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/core/Game.cc
r10518 r10524 518 518 519 519 core_->loadGraphics(); 520 Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics );520 Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics, true); 521 521 522 522 // Construct all the GameStates that require graphics … … 539 539 } 540 540 541 void Game::unloadGraphics( )541 void Game::unloadGraphics(bool loadGraphicsManagerWithoutRenderer) 542 542 { 543 543 if (GameMode::showsGraphics()) … … 555 555 } 556 556 557 core_->unloadGraphics( );557 core_->unloadGraphics(loadGraphicsManagerWithoutRenderer); 558 558 } 559 559 } … … 576 576 577 577 // If state requires graphics, load it 578 Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics );578 Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics, true); 579 579 if (gameStateDeclarations_s[name].bGraphicsMode && !GameMode::showsGraphics()) 580 580 this->loadGraphics(); … … 612 612 } 613 613 // Check if graphics is still required 614 if (!bAbort_) 615 { 616 bool graphicsRequired = false; 617 for (unsigned i = 0; i < loadedStates_.size(); ++i) 618 graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode; 619 if (!graphicsRequired) 620 this->unloadGraphics(); 621 } 614 bool graphicsRequired = false; 615 for (unsigned i = 0; i < loadedStates_.size(); ++i) 616 graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode; 617 if (!graphicsRequired) 618 this->unloadGraphics(!this->bAbort_); // if abort is false, that means the game is still running while unloading graphics. in this case we load a graphics manager without renderer (to keep all necessary ogre instances alive) 622 619 this->bChangingState_ = false; 623 620 }
Note: See TracChangeset
for help on using the changeset viewer.