Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1640 for code


Ignore:
Timestamp:
Jul 21, 2008, 8:39:14 PM (16 years ago)
Author:
rgrieder
Message:

When starting with no arguments, the GUI is loaded, which consists merely of 2 buttons: start and exit (quite self explanatory). But it does work on my box (still no cmake support).

Location:
code/branches/gui/src/orxonox
Files:
6 edited

Legend:

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

    r1638 r1640  
    8585        , renderWindow_(0)
    8686        , levelSceneManager_(0)
    87         , levelViewport_(0)
     87        , viewport_(0)
    8888    {
    8989        RegisterObject(GraphicsEngine);
     
    308308        // The GUI uses its own one to be able to render on top of everything.
    309309        // That explains why the Z order here is only 1 and not 0 (top most)
    310         this->levelViewport_ = this->renderWindow_->addViewport(0, 1);
     310        this->viewport_ = this->renderWindow_->addViewport(0, 1);
    311311
    312312        return true;
  • code/branches/gui/src/orxonox/GraphicsEngine.h

    r1638 r1640  
    6868        Ogre::SceneManager* getLevelSceneManager() { return levelSceneManager_; }
    6969
    70         Ogre::Viewport* getLevelViewport() { return this->levelViewport_; }
     70        Ogre::Viewport* getViewport() { return this->viewport_; }
    7171
    7272        // several window properties
     
    107107        Ogre::RenderWindow* renderWindow_;          //!< the current render window
    108108        Ogre::SceneManager* levelSceneManager_;     //!< scene manager of the game
    109         Ogre::Viewport*     levelViewport_;         //!< default full size viewport for the level
     109        Ogre::Viewport*     viewport_;              //!< default full size viewport
    110110
    111111        // stats
  • code/branches/gui/src/orxonox/Orxonox.cc

    r1638 r1640  
    250250                ogre_->getWindowWidth(), ogre_->getWindowHeight(), true, true, true);
    251251          KeyBinder* keyBinder = new KeyBinder();
     252          keyBinder->loadBindings();
    252253          InputManager::createSimpleInputState("game", 20)->setHandler(keyBinder);
    253254
     
    277278        {
    278279          // show main menu
    279           //GraphicsEngine::getSingleton().createNewScene();
    280           GUIManager::getInstance().showGUI("MainMenu", true);
     280          GUIManager::getInstance().showGUI("MainMenu", 0);
     281          GraphicsEngine::getSingleton().getViewport()->setCamera(GUIManager::getInstance().getCamera());
    281282        }
    282283    }
     
    340341     
    341342      if (success)
     343      {
    342344        InputManager::requestEnterState("game");
     345        this->mode_ = mode;
     346      }
    343347
    344348      return success;
     
    450454    unsigned long frameCount = 0;
    451455   
    452     const unsigned long refreshTime = debugRefreshTime_ * 1000000.0f;
     456    const unsigned long refreshTime = 50000.0f;
     457    //const unsigned long refreshTime = debugRefreshTime_ * 1000000.0f;
    453458    unsigned long refreshStartTime = 0;
    454459    unsigned long tickTime = 0;
     
    458463    unsigned long timeBeforeTickOld = 0;
    459464    unsigned long timeAfterTick = 0;
    460 
    461     int sleepTime = 0;
    462465
    463466    // TODO: Update time in seconds every 7 seconds to avoid any overflow (7 secs is very tight)
     
    511514          GraphicsEngine::getSingleton().setAverageFramesPerSecond(avgFPS);
    512515
    513           if (avgFPS > 60.0)
    514             sleepTime++;
    515           else
    516             sleepTime--;
    517           if (sleepTime < 0)
    518               sleepTime = 0;
    519 
    520516          oldFrameCount = frameCount;
    521517          tickTime = 0;
    522518          refreshStartTime = timeAfterTick;
    523519        }
    524 
    525         // do some sleeping when the frameRate is over 60
    526         if (sleepTime > 0)
    527           msleep(sleepTime);
    528 
    529520
    530521        // don't forget to call _fireFrameStarted in ogre to make sure
  • code/branches/gui/src/orxonox/gui/GUIManager.cc

    r1638 r1640  
    5959
    6060    GUIManager::GUIManager()
    61         : emptySceneManager_(0)
    62         , backgroundSceneManager_(0)
    63         , emptyCamera_(0)
     61        //: emptySceneManager_(0)
     62        : backgroundSceneManager_(0)
     63        //, emptyCamera_(0)
    6464        , backgroundCamera_(0)
    65         , viewport_(0)
     65        //, viewport_(0)
    6666        , renderWindow_(0)
    6767        , guiRenderer_(0)
     
    9191
    9292                // Full screen viewport with Z order = 0 (top most). Don't yet feed a camera (so nothing gets rendered)
    93                 this->viewport_ = renderWindow_->addViewport(0, 3);
    94                 this->viewport_->setOverlaysEnabled(false);
    95                 this->viewport_->setShadowsEnabled(false);
    96                 this->viewport_->setSkiesEnabled(false);
    97                 this->viewport_->setClearEveryFrame(false);
     93                //this->viewport_ = renderWindow_->addViewport(0, 3);
     94                //this->viewport_->setOverlaysEnabled(false);
     95                //this->viewport_->setShadowsEnabled(false);
     96                //this->viewport_->setSkiesEnabled(false);
     97                //this->viewport_->setClearEveryFrame(false);
    9898
    9999                // Note: No SceneManager specified yet
     
    145145        // But in order to realise that, we also need a SceneManager with an empty scene,
    146146        // because the SceneManager is responsible for the render queue.
    147         this->emptySceneManager_ = Ogre::Root::getSingleton()
    148             .createSceneManager(Ogre::ST_GENERIC, "GUI/EmptySceneManager");
     147        //this->emptySceneManager_ = Ogre::Root::getSingleton()
     148        //    .createSceneManager(Ogre::ST_GENERIC, "GUI/EmptySceneManager");
    149149
    150150        // we also need a camera or we won't see anything at all.
    151151        // The camera settings don't matter at all for an empty scene since the GUI
    152152        // gets rendered on top of the screen rather than into the scene.
    153         this->emptyCamera_ = this->emptySceneManager_->createCamera("GUI/EmptyCamera");
     153        //this->emptyCamera_ = this->emptySceneManager_->createCamera("GUI/EmptyCamera");
    154154
    155155        // Create another SceneManager that enables to display some 3D
     
    171171    }
    172172
    173     void GUIManager::showGUI(const std::string& name, bool showBackground)
     173    void GUIManager::showGUI(const std::string& name, Ogre::SceneManager* sceneManager)// bool showBackground)
    174174    {
    175175        if (state_ != Uninitialised)
     
    181181            try
    182182            {
    183                 if (showBackground)
     183                if (!sceneManager)
    184184                {
    185185                    // currently, only an image is loaded. We could do 3D, see loadBackground.
    186                     this->viewport_->setClearEveryFrame(true);
     186                    //this->viewport_->setClearEveryFrame(true);
    187187                    this->guiRenderer_->setTargetSceneManager(this->backgroundSceneManager_);
    188                     this->viewport_->setCamera(this->backgroundCamera_);
     188                    //this->viewport_->setCamera(this->backgroundCamera_);
    189189
    190190                    lua_pushboolean(this->scriptModule_->getLuaState(), true);
     
    193193                else
    194194                {
    195                     this->viewport_->setClearEveryFrame(false);
    196                     this->guiRenderer_->setTargetSceneManager(this->emptySceneManager_);
    197                     this->viewport_->setCamera(this->emptyCamera_);
     195                    //this->viewport_->setClearEveryFrame(false);
     196                    this->guiRenderer_->setTargetSceneManager(sceneManager);
     197                    //this->viewport_->setCamera(this->emptyCamera_);
    198198
    199199                    lua_pushboolean(this->scriptModule_->getLuaState(), false);
     
    226226        if (this->state_ != OnDisplay)
    227227            return;
    228         this->viewport_->setCamera(0);
     228        //this->viewport_->setCamera(0);
     229        this->guiRenderer_->setTargetSceneManager(0);
    229230        this->state_ = Ready;
    230231        InputManager::requestLeaveState("gui");
  • code/branches/gui/src/orxonox/gui/GUIManager.h

    r1638 r1640  
    7070        bool initialise();
    7171        void tick(float dt);
    72         void showGUI(const std::string& name, bool showBackground); // tolua_export
     72        void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export
    7373        void _hideGUI(); // tolua_export
    7474
     75        Ogre::Camera* getCamera() { return this->backgroundCamera_; }
     76
    7577        static GUIManager& getInstance(); // tolua_export
    76         static void showGUI_s(const std::string& name, bool showBackground)
     78        static void showGUI_s(const std::string& name, Ogre::SceneManager* sceneManager)//bool showBackground)
    7779        {
    78             getInstance().showGUI(name, showBackground);
     80            getInstance().showGUI(name, sceneManager);
    7981        }
    8082
     
    104106        void loadScenes();
    105107
    106         Ogre::SceneManager*       emptySceneManager_;
     108        //Ogre::SceneManager*       emptySceneManager_;
    107109        Ogre::SceneManager*       backgroundSceneManager_;
    108         Ogre::Camera*             emptyCamera_;
     110        //Ogre::Camera*             emptyCamera_;
    109111        Ogre::Camera*             backgroundCamera_;
    110         Ogre::Viewport*           viewport_;
     112        //Ogre::Viewport*           viewport_;
    111113        Ogre::RenderWindow*       renderWindow_;
    112114        CEGUI::OgreCEGUIRenderer* guiRenderer_;
  • code/branches/gui/src/orxonox/objects/CameraHandler.cc

    r1638 r1640  
    4545  {
    4646    this->cam_ = GraphicsEngine::getSingleton().getLevelSceneManager()->createCamera("Cam");
    47     GraphicsEngine::getSingleton().getLevelViewport()->setCamera(this->cam_);
    48     GraphicsEngine::getSingleton().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2);
     47    GraphicsEngine::getSingleton().getViewport()->setCamera(this->cam_);
     48    //GraphicsEngine::getSingleton().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2);
    4949    /*this->activeCamera_ = *ObjectList<Camera>::begin();
    5050    this->activeCamera_->cam_ = this->cam_;*/
Note: See TracChangeset for help on using the changeset viewer.