Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 1, 2009, 11:44:53 AM (15 years ago)
Author:
rgrieder
Message:

Moved the singleton creation/destruction mess to the Core class by using just two possible Scopes:

  • ScopeID::Root for singletons that may always persists
  • ScopeID::Graphics for singletons that only work when graphics was loaded
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/Core.cc

    r5838 r5850  
    264264        // create a shell
    265265        this->shell_.reset(new Shell());
     266
     267        // Create singletons that always exist (in other libraries)
     268        this->rootScope_.reset(new Scope<ScopeID::Root>());
    266269    }
    267270
     
    289292            inputManager_->getMousePosition(), graphicsManager_->isFullScreen()));
    290293
     294        // Create singletons associated with graphics (in other libraries)
     295        graphicsScope_.reset(new Scope<ScopeID::Graphics>());
     296
    291297        unloader.Dismiss();
    292298
     
    296302    void Core::unloadGraphics()
    297303    {
    298         this->guiManager_.reset();;
    299         this->inputManager_.reset();;
     304        this->graphicsScope_.reset();
     305        this->guiManager_.reset();
     306        this->inputManager_.reset();
    300307        this->graphicsManager_.reset();
    301308
     
    420427    void Core::preUpdate(const Clock& time)
    421428    {
     429        // singletons from other libraries
     430        Scope<ScopeID::Root>::update(time);
    422431        if (this->bGraphicsLoaded_)
    423432        {
     
    426435            // process gui events
    427436            this->guiManager_->update(time);
     437            // graphics singletons from other libraries
     438            Scope<ScopeID::Graphics>::update(time);
    428439        }
    429440        // process thread commands
Note: See TracChangeset for help on using the changeset viewer.