Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 23, 2008, 3:37:29 PM (16 years ago)
Author:
rgrieder
Message:
  • changed the static interface of the InputManager to a member one with getInstance()
  • converted InputManager and InGameConsole to Ogre Singletons (c'tor and d'tor public, but assert in c'tor to prevent multiple instances at runtime)
  • added toluabind_orxonox files to tolua folder that contains a pimped version of tolua (I'll write a little cmake project soon to automate it; Currently that only works with msvc)
  • commented out Loader::unload() from Orxonox destructor because that deleted the ParticleSpawners, which were using a method of a sceneNode that belonged to a already destroyed SpaceShip. —> Results in a memory leak. Previously Loader::unload() was called for all BaseObjects (now calling unload(level_)). And since 'P' from ParticleSpawner comes before 'S' like SpaceShip, the order was correct.
  • Added factory feature for InputStates (can now be created by string if there is Factory entry for it)
  • Created factory entries for SimpleInputState and ExtendedInputState
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/Orxonox.cc

    r1641 r1642  
    104104   */
    105105  Orxonox::Orxonox()
    106     : ogre_(0)
    107     , startLevel_(0)
     106    : startLevel_(0)
    108107    , hud_(0)
    109     , radar_(0)
    110108    //, auMan_(0)
    111109    , timer_(0)
     
    114112    , mode_(GameMode::GM_Unspecified)
    115113    , debugRefreshTime_(0.0f)
     114    , ogre_(0)
     115    , inputManager_(0)
     116    , radar_(0)
    116117  {
    117118    RegisterRootObject(Orxonox);
    118119
    119     assert(singletonRef_s == 0);
     120    //assert(singletonRef_s == 0);
     121    OrxAssert(singletonRef_s == 0, "asdfasdfasdfasdfblahblah");
    120122    singletonRef_s = this;
    121123  }
     
    127129  {
    128130    // keep in mind: the order of deletion is very important!
    129     Loader::unload();
     131    if (this->timer_)
     132      delete this->timer_;
     133
     134    Loader::unload(startLevel_);
    130135    if (this->startLevel_)
    131136      delete this->startLevel_;
     
    138143      delete this->radar_;
    139144
    140     Loader::close();
    141145    //if (this->auMan_)
    142146    //  delete this->auMan_;
    143     InGameConsole::getInstance().destroy();
    144     if (this->timer_)
    145       delete this->timer_;
    146     InputManager::destroy();
     147
     148    if (this->console_)
     149      delete this->console_;
     150
     151    if (inputManager_)
     152      delete inputManager_;
    147153
    148154    if (this->ogre_)
     
    153159    if (server_g)
    154160      delete network::Server::getSingleton();
     161
     162    // this call will delete every BaseObject!
     163    // But currently this will call methods of objects that exist no more
     164    // The only 'memory leak' is the ParticleSpawer. They would be deleted here
     165    // and call a sceneNode method that has already been destroy by the corresponding space ship.
     166    //Loader::close();
    155167
    156168    singletonRef_s = 0;
     
    247259          // Calls the InputManager which sets up the input devices.
    248260          // The render window width and height are used to set up the mouse movement.
    249           InputManager::initialise(ogre_->getWindowHandle(),
     261          inputManager_ = new InputManager();
     262          inputManager_->initialise(ogre_->getWindowHandle(),
    250263                ogre_->getWindowWidth(), ogre_->getWindowHeight(), true, true, true);
    251264          KeyBinder* keyBinder = new KeyBinder();
    252265          keyBinder->loadBindings();
    253           InputManager::createSimpleInputState("game", 20)->setHandler(keyBinder);
     266          inputManager_->createSimpleInputState("game", 20)->setHandler(keyBinder);
    254267
    255268          // Load the InGameConsole
    256           InGameConsole::getInstance().initialise();
     269          console_ = new InGameConsole();
     270          console_->initialise();
    257271
    258272          // load the CEGUI interface
     
    342356      if (success)
    343357      {
    344         InputManager::requestEnterState("game");
     358        InputManager::getInstance().requestEnterState("game");
    345359        this->mode_ = mode;
    346360      }
Note: See TracChangeset for help on using the changeset viewer.