Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2808 for code/branches


Ignore:
Timestamp:
Mar 21, 2009, 1:07:53 AM (16 years ago)
Author:
bknecht
Message:

You can now toggle visibility ingame. Strangely the SceneManager changes after the initial enter()-function of GSStandalone. That's why - for the moment - the SceneManager is set every tick to be able to keep track of the current SceneManager.

Also there are some strange functions defined not having a real purpose aside from debug (the implementation is not clean at all, but rather full of shortcuts and functional). At least it compiles and runs ;-)

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

Legend:

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

    r2801 r2808  
    5353
    5454        // show main menu
    55         guiManager_->loadScene("MainMenu");
     55        //guiManager_->loadScene("MainMenu");
    5656        guiManager_->showGUI("MainMenu", 0);
    5757        GraphicsManager::getInstance().getViewport()->setCamera(guiManager_->getCamera());
  • code/branches/gui/src/orxonox/gamestates/GSStandalone.cc

    r2801 r2808  
    3939namespace orxonox
    4040{
    41     SetConsoleCommand(GSStandalone, showGUI, true).setAsInputCommand();
    42 
    43     bool GSStandalone::guiShowing_s = false;
    44 
    4541    GSStandalone::GSStandalone()
    4642        : GameState<GSGraphics>("standalone")
     
    5248    }
    5349
    54     void GSStandalone::showGUI()
    55     {
    56         GSStandalone::guiShowing_s = true;
    57     }
    5850
    5951    void GSStandalone::enter()
     
    6658        // not sure if necessary
    6759        // guiManager_->loadScene("IngameMenu");
     60
     61        Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
     62        guiManager_->showGUI("IngameMenu", viewport->getCamera()->getSceneManager());
    6863    }
    6964
     
    7772    void GSStandalone::ticked(const Clock& time)
    7873    {
    79         if (guiShowing_s)
    80         {
    81             Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
    82             guiManager_->showGUI("IngameMenu", viewport->getCamera()->getSceneManager());
    83         }
    84         else
    85         {
    86             if (guiManager_)
    87                 guiManager_->hideGUI();
    88         }
     74        Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
     75        //COUT(0) << "** " << viewport->getCamera()->getSceneManager() << std::endl;
     76        //guiManager_->testFct();
     77        //Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
     78        guiManager_->showGUI("IngameMenu", viewport->getCamera()->getSceneManager());
     79
    8980        // tick CEGUI
    9081        guiManager_->update(time);
  • code/branches/gui/src/orxonox/gamestates/GSStandalone.h

    r2790 r2808  
    4141        GSStandalone();
    4242        ~GSStandalone();
    43         static void showGUI();
    4443
    4544    private:
     
    4948
    5049        GUIManager*     guiManager_;
    51         static bool     guiShowing_s;
    5250    };
    5351}
  • code/branches/gui/src/orxonox/gui/GUIManager.cc

    r2801 r2808  
    6363namespace orxonox
    6464{
    65     SetConsoleCommandShortcut(GUIManager, showGUI_s).keybindMode(KeybindMode::OnPress);
     65    SetConsoleCommandShortcut(GUIManager, toggleGUI).keybindMode(KeybindMode::OnPress);
    6666
    6767    GUIManager* GUIManager::singletonRef_s = 0;
     
    143143
    144144                // Note: No SceneManager specified yet
    145                 this->guiRenderer_ = new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_MAIN, true, 3000);
     145                this->guiRenderer_ = new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_OVERLAY, true, 3000);
    146146                this->resourceProvider_ = guiRenderer_->createResourceProvider();
    147147                this->resourceProvider_->setDefaultResourceGroup("GUI");
     
    172172
    173173                // load the background scene
    174                 //loadScenes();
     174                loadScenes();
    175175                //CEGUI::KeyEventArgs e;
    176176                //e.codepoint
     
    204204                tolua_Orxonox_open(this->scriptModule_->getLuaState());
    205205                */
    206                 this->scriptModule_->executeScriptFile("ingameGUI.lua", "GUI");
     206                this->scriptModule_->executeScriptFile("loadGUI.lua", "GUI");
    207207            }
    208208            catch (CEGUI::Exception& ex)
     
    261261    }
    262262
     263    void GUIManager::toggleGUI()
     264    {
     265        //COUT(0) << "********* TOGGLE TOGGLE **********" << std::endl;
     266        getInstance().scriptModule_->executeScriptGlobal("toggleGUI");
     267    }
     268
    263269    void GUIManager::showGUI(const std::string& name, Ogre::SceneManager* sceneManager)// bool showBackground)
    264270    {
     
    271277            try
    272278            {
    273 //                COUT (0) << "************* sceneManager: " << sceneManager << std::endl;
     279                // COUT (0) << "************* sceneManager: " << sceneManager << std::endl;
    274280                if (!sceneManager)
    275281                {
     
    286292                    //this->viewport_->setClearEveryFrame(false);
    287293                    this->guiRenderer_->setTargetSceneManager(sceneManager);
     294                    currentSceneManager_ = sceneManager;
    288295                    //this->viewport_->setCamera(this->emptyCamera_);
    289296
     
    311318            COUT(2) << "Warning: GUI Manager not yet initialised, cannot load a GUI" << std::endl;
    312319        }
     320    }
     321
     322    void GUIManager::testFct()
     323    {
     324        //COUT(0) << "**** " << currentSceneManager_ << std::endl;
     325        this->showGUI("IngameMenu", currentSceneManager_);
     326    }
     327
     328    void GUIManager::testOutput(const std::string& str)
     329    {
     330        COUT(0) << "***" << str << "***" << std::endl;
    313331    }
    314332
  • code/branches/gui/src/orxonox/gui/GUIManager.h

    r2800 r2808  
    7979        void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export
    8080        void hideGUI(); // tolua_export
     81        void testOutput(const std::string& str); // tolua_export
     82
     83        static void toggleGUI();
    8184
    8285        Ogre::Camera* getCamera() { return this->backgroundCamera_; }
     
    8689            getInstance().showGUI(name, sceneManager);
    8790        }
     91
     92        // please remove
     93        void testFct();
    8894
    8995        static GUIManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
     
    128134        CEGUI::Imageset*          backgroundImage_;
    129135        lua_State*                luaState_;
     136        Ogre::SceneManager*         currentSceneManager_;
    130137
    131138        State state_;
Note: See TracChangeset for help on using the changeset viewer.