Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 27, 2008, 5:15:08 PM (16 years ago)
Author:
rgrieder
Message:
  • added debug output to the InputHandler
  • fixed singleton issues
  • cleaned up Main.cc (replaced WinMain by main)
File:
1 edited

Legend:

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

    r930 r934  
    4646//#include <exception>
    4747#include <deque>
    48 #define _CRTDBG_MAP_ALLOC
    49 #include <stdlib.h>
    50 #include <crtdbg.h>
    5148
    5249//***** ORXONOX ****
     
    8077{
    8178  /**
     79    @brief Reference to the only instance of the class.
     80  */
     81  Orxonox *Orxonox::singletonRef_s = 0;
     82
     83  /**
    8284   * create a new instance of Orxonox
    8385   */
     
    8587  {
    8688    this->ogre_ = new GraphicsEngine();
     89    this->timer_ = 0;
    8790    this->dataPath_ = "";
    8891    this->auMan_ = 0;
     
    105108      delete this->orxonoxHUD_;
    106109    Loader::close();
    107     // do not destroy the InputHandler since this is a singleton too
    108     // and might have been deleted already (after return 0; in main())
     110    InputHandler::destroy();
    109111    if (this->auMan_)
    110112      delete this->auMan_;
     
    142144  Orxonox* Orxonox::getSingleton()
    143145  {
    144     static Orxonox theOnlyInstance;
    145     return &theOnlyInstance;
     146    if (!singletonRef_s)
     147      singletonRef_s = new Orxonox();
     148    return singletonRef_s;
     149    //static Orxonox theOnlyInstance;
     150    //return &theOnlyInstance;
     151  }
     152
     153  /**
     154    @brief Destroys the Orxonox singleton.
     155  */
     156  void Orxonox::destroy()
     157  {
     158    if (singletonRef_s)
     159      delete singletonRef_s;
     160    singletonRef_s = 0;
    146161  }
    147162
     
    313328  {
    314329    inputHandler_ = InputHandler::getSingleton();
    315     inputHandler_->initialise(ogre_->getWindowHandle(),
    316           ogre_->getWindowWidth(), ogre_->getWindowHeight());
     330    if (!inputHandler_->initialise(ogre_->getWindowHandle(),
     331          ogre_->getWindowWidth(), ogre_->getWindowHeight()))
     332      abortImmediate();
    317333  }
    318334
Note: See TracChangeset for help on using the changeset viewer.