Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 27, 2009, 1:57:28 PM (15 years ago)
Author:
rgrieder
Message:

Moved some GameState code from activate/deactivate to the c'tor and d'tor. This should allow for faster GS switching.
But be careful: Only load in the c'tor what you're sure is available. For instance GSLevel doesn't require graphics, it's just an option. So loading graphical stuff in in the c'tor would be fatal because at this time it is not yet clear whether there will even be graphics (GameMode::showsGraphics() will yield false!).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource/src/orxonox/gamestates/GSMainMenu.cc

    r3355 r3357  
    4949        , inputState_(0)
    5050    {
    51     }
    52 
    53     GSMainMenu::~GSMainMenu()
    54     {
    55     }
    56 
    57     void GSMainMenu::activate()
    58     {
    5951        inputState_ = InputManager::getInstance().createInputState("mainMenu");
    6052        inputState_->setHandler(GUIManager::getInstancePtr());
     
    6557        // and a Camera
    6658        this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera");
     59    }
    6760
     61    GSMainMenu::~GSMainMenu()
     62    {
     63        InputManager::getInstance().destroyState("mainMenu");
     64
     65        this->scene_->getSceneManager()->destroyCamera(this->camera_);
     66        delete this->scene_;
     67    }
     68
     69    void GSMainMenu::activate()
     70    {
    6871        // show main menu
    6972        GUIManager::getInstance().showGUI("mainmenu_4");
     
    107110
    108111        InputManager::getInstance().leaveState("mainMenu");
    109         InputManager::getInstance().destroyState("mainMenu");
    110112
    111113        GUIManager::getInstance().setCamera(0);
    112114        GraphicsManager::getInstance().setCamera(0);
    113         this->scene_->getSceneManager()->destroyCamera(this->camera_);
    114         delete this->scene_;
    115115
    116116/*
Note: See TracChangeset for help on using the changeset viewer.