[Orxonox-commit 114] r2808 - in branches/gui/src/orxonox: gamestates gui
bknecht at orxonox.net
bknecht at orxonox.net
Sat Mar 21 01:07:54 CET 2009
Author: bknecht
Date: 2009-03-21 00:07:53 +0000 (Sat, 21 Mar 2009)
New Revision: 2808
Modified:
branches/gui/src/orxonox/gamestates/GSGUI.cc
branches/gui/src/orxonox/gamestates/GSStandalone.cc
branches/gui/src/orxonox/gamestates/GSStandalone.h
branches/gui/src/orxonox/gui/GUIManager.cc
branches/gui/src/orxonox/gui/GUIManager.h
Log:
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 ;-)
Modified: branches/gui/src/orxonox/gamestates/GSGUI.cc
===================================================================
--- branches/gui/src/orxonox/gamestates/GSGUI.cc 2009-03-19 17:11:00 UTC (rev 2807)
+++ branches/gui/src/orxonox/gamestates/GSGUI.cc 2009-03-21 00:07:53 UTC (rev 2808)
@@ -52,7 +52,7 @@
guiManager_ = GUIManager::getInstancePtr();
// show main menu
- guiManager_->loadScene("MainMenu");
+ //guiManager_->loadScene("MainMenu");
guiManager_->showGUI("MainMenu", 0);
GraphicsManager::getInstance().getViewport()->setCamera(guiManager_->getCamera());
}
Modified: branches/gui/src/orxonox/gamestates/GSStandalone.cc
===================================================================
--- branches/gui/src/orxonox/gamestates/GSStandalone.cc 2009-03-19 17:11:00 UTC (rev 2807)
+++ branches/gui/src/orxonox/gamestates/GSStandalone.cc 2009-03-21 00:07:53 UTC (rev 2808)
@@ -38,10 +38,6 @@
namespace orxonox
{
- SetConsoleCommand(GSStandalone, showGUI, true).setAsInputCommand();
-
- bool GSStandalone::guiShowing_s = false;
-
GSStandalone::GSStandalone()
: GameState<GSGraphics>("standalone")
{
@@ -51,10 +47,6 @@
{
}
- void GSStandalone::showGUI()
- {
- GSStandalone::guiShowing_s = true;
- }
void GSStandalone::enter()
{
@@ -65,6 +57,9 @@
guiManager_ = GUIManager::getInstancePtr();
// not sure if necessary
// guiManager_->loadScene("IngameMenu");
+
+ Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
+ guiManager_->showGUI("IngameMenu", viewport->getCamera()->getSceneManager());
}
void GSStandalone::leave()
@@ -76,16 +71,12 @@
void GSStandalone::ticked(const Clock& time)
{
- if (guiShowing_s)
- {
- Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
- guiManager_->showGUI("IngameMenu", viewport->getCamera()->getSceneManager());
- }
- else
- {
- if (guiManager_)
- guiManager_->hideGUI();
- }
+ Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
+ //COUT(0) << "** " << viewport->getCamera()->getSceneManager() << std::endl;
+ //guiManager_->testFct();
+ //Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport();
+ guiManager_->showGUI("IngameMenu", viewport->getCamera()->getSceneManager());
+
// tick CEGUI
guiManager_->update(time);
Modified: branches/gui/src/orxonox/gamestates/GSStandalone.h
===================================================================
--- branches/gui/src/orxonox/gamestates/GSStandalone.h 2009-03-19 17:11:00 UTC (rev 2807)
+++ branches/gui/src/orxonox/gamestates/GSStandalone.h 2009-03-21 00:07:53 UTC (rev 2808)
@@ -40,7 +40,6 @@
public:
GSStandalone();
~GSStandalone();
- static void showGUI();
private:
void enter();
@@ -48,7 +47,6 @@
void ticked(const Clock& time);
GUIManager* guiManager_;
- static bool guiShowing_s;
};
}
Modified: branches/gui/src/orxonox/gui/GUIManager.cc
===================================================================
--- branches/gui/src/orxonox/gui/GUIManager.cc 2009-03-19 17:11:00 UTC (rev 2807)
+++ branches/gui/src/orxonox/gui/GUIManager.cc 2009-03-21 00:07:53 UTC (rev 2808)
@@ -62,7 +62,7 @@
namespace orxonox
{
- SetConsoleCommandShortcut(GUIManager, showGUI_s).keybindMode(KeybindMode::OnPress);
+ SetConsoleCommandShortcut(GUIManager, toggleGUI).keybindMode(KeybindMode::OnPress);
GUIManager* GUIManager::singletonRef_s = 0;
@@ -142,7 +142,7 @@
//this->viewport_->setClearEveryFrame(false);
// Note: No SceneManager specified yet
- this->guiRenderer_ = new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_MAIN, true, 3000);
+ this->guiRenderer_ = new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_OVERLAY, true, 3000);
this->resourceProvider_ = guiRenderer_->createResourceProvider();
this->resourceProvider_->setDefaultResourceGroup("GUI");
@@ -171,7 +171,7 @@
state->setJoyStickHandler(&InputManager::EMPTY_HANDLER);
// load the background scene
- //loadScenes();
+ loadScenes();
//CEGUI::KeyEventArgs e;
//e.codepoint
}
@@ -203,7 +203,7 @@
tolua_Core_open(this->scriptModule_->getLuaState());
tolua_Orxonox_open(this->scriptModule_->getLuaState());
*/
- this->scriptModule_->executeScriptFile("ingameGUI.lua", "GUI");
+ this->scriptModule_->executeScriptFile("loadGUI.lua", "GUI");
}
catch (CEGUI::Exception& ex)
{
@@ -260,6 +260,12 @@
}
}
+ void GUIManager::toggleGUI()
+ {
+ //COUT(0) << "********* TOGGLE TOGGLE **********" << std::endl;
+ getInstance().scriptModule_->executeScriptGlobal("toggleGUI");
+ }
+
void GUIManager::showGUI(const std::string& name, Ogre::SceneManager* sceneManager)// bool showBackground)
{
if (state_ != Uninitialised)
@@ -270,7 +276,7 @@
COUT(3) << "Loading GUI " << name << std::endl;
try
{
-// COUT (0) << "************* sceneManager: " << sceneManager << std::endl;
+ // COUT (0) << "************* sceneManager: " << sceneManager << std::endl;
if (!sceneManager)
{
// currently, only an image is loaded. We could do 3D, see loadBackground.
@@ -285,6 +291,7 @@
{
//this->viewport_->setClearEveryFrame(false);
this->guiRenderer_->setTargetSceneManager(sceneManager);
+ currentSceneManager_ = sceneManager;
//this->viewport_->setCamera(this->emptyCamera_);
lua_pushboolean(this->scriptModule_->getLuaState(), false);
@@ -312,6 +319,17 @@
}
}
+ void GUIManager::testFct()
+ {
+ //COUT(0) << "**** " << currentSceneManager_ << std::endl;
+ this->showGUI("IngameMenu", currentSceneManager_);
+ }
+
+ void GUIManager::testOutput(const std::string& str)
+ {
+ COUT(0) << "***" << str << "***" << std::endl;
+ }
+
void GUIManager::hideGUI()
{
if (this->state_ != OnDisplay)
Modified: branches/gui/src/orxonox/gui/GUIManager.h
===================================================================
--- branches/gui/src/orxonox/gui/GUIManager.h 2009-03-19 17:11:00 UTC (rev 2807)
+++ branches/gui/src/orxonox/gui/GUIManager.h 2009-03-21 00:07:53 UTC (rev 2808)
@@ -78,7 +78,10 @@
}
void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export
void hideGUI(); // tolua_export
+ void testOutput(const std::string& str); // tolua_export
+ static void toggleGUI();
+
Ogre::Camera* getCamera() { return this->backgroundCamera_; }
static void showGUI_s(const std::string& name, Ogre::SceneManager* sceneManager)//bool showBackground)
@@ -86,6 +89,9 @@
getInstance().showGUI(name, sceneManager);
}
+ // please remove
+ void testFct();
+
static GUIManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
static GUIManager* getInstancePtr() { return singletonRef_s; }
@@ -127,6 +133,7 @@
CEGUI::System* guiSystem_;
CEGUI::Imageset* backgroundImage_;
lua_State* luaState_;
+ Ogre::SceneManager* currentSceneManager_;
State state_;
More information about the Orxonox-commit
mailing list