[Orxonox-commit 2142] r6858 - in code/branches/skybox2/src: libraries/core modules/designtools modules/overlays/hud

dafrick at orxonox.net dafrick at orxonox.net
Thu May 6 13:11:43 CEST 2010


Author: dafrick
Date: 2010-05-06 13:11:43 +0200 (Thu, 06 May 2010)
New Revision: 6858

Modified:
   code/branches/skybox2/src/libraries/core/Core.cc
   code/branches/skybox2/src/libraries/core/Core.h
   code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc
   code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h
   code/branches/skybox2/src/modules/overlays/hud/GametypeStatus.cc
   code/branches/skybox2/src/modules/overlays/hud/GametypeStatus.h
Log:
Made noCaption feature needed for skybox much nice. :D


Modified: code/branches/skybox2/src/libraries/core/Core.cc
===================================================================
--- code/branches/skybox2/src/libraries/core/Core.cc	2010-05-04 20:44:13 UTC (rev 6857)
+++ code/branches/skybox2/src/libraries/core/Core.cc	2010-05-06 11:11:43 UTC (rev 6858)
@@ -77,7 +77,6 @@
     Core* Core::singletonPtr_s  = 0;
 
     SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
-    SetCommandLineSwitch(noGametypeCaptions).information("Use this if you don't want to use Gametype captions.");
 
 #ifdef ORXONOX_PLATFORM_WINDOWS
     SetCommandLineArgument(limitToCPU, 1).information("Limits the program to one CPU/core (1, 2, 3, etc.). Default is the first core (faster than off)");
@@ -149,12 +148,6 @@
         ClassIdentifier<Core>::getIdentifier("Core")->initialiseObject(this, "Core", true);
         this->setConfigValues();
 
-        // no captions in gametype.
-        if(CommandLineParser::getValue("noGametypeCaptions").getBool())
-        {
-            ModifyConfigValue(bGametypeCaptions_, tset, false);
-        }
-
         // create persistent io console
         this->ioConsole_.reset(new IOConsole());
 
@@ -200,8 +193,6 @@
         SetConfigValue(bInitRandomNumberGenerator_, true)
             .description("If true, all random actions are different each time you start the game")
             .callback(this, &Core::initRandomNumberGenerator);
-        SetConfigValue(bGametypeCaptions_, true)
-            .description("Set to false if you don't want to use Gametype captions.");
     }
 
     //! Callback function if the language has changed.

Modified: code/branches/skybox2/src/libraries/core/Core.h
===================================================================
--- code/branches/skybox2/src/libraries/core/Core.h	2010-05-04 20:44:13 UTC (rev 6857)
+++ code/branches/skybox2/src/libraries/core/Core.h	2010-05-06 11:11:43 UTC (rev 6858)
@@ -66,9 +66,6 @@
 
             void setConfigValues();
 
-            inline bool hasGametypeCaptions(void)
-                { return this->bGametypeCaptions_; }
-
             //! Returns the configured language.
             const std::string& getLanguage()
                 { return this->language_; }
@@ -110,7 +107,6 @@
             int                           softDebugLevelLogFile_;      //!< The debug level for the log file (belongs to OutputHandler)
             std::string                   language_;                   //!< The language
             bool                          bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
-            bool                          bGametypeCaptions_;
 
             static Core*                  singletonPtr_s;
     };

Modified: code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc	2010-05-04 20:44:13 UTC (rev 6857)
+++ code/branches/skybox2/src/modules/designtools/SkyboxGenerator.cc	2010-05-06 11:11:43 UTC (rev 6858)
@@ -59,6 +59,7 @@
 
         this->setConfigValues();
         takeScreenshot_ = false;
+        this->captionsRemoved_ = false;
     }
 
     SkyboxGenerator::~SkyboxGenerator()
@@ -75,12 +76,20 @@
     {
         if( takeScreenshot_ == true )
         {
+            if(!this->captionsRemoved_)
+            {
+                CommandExecutor::execute("setGametypeStatus false");
+                this->captionsRemoved_ = true;
+                return;
+            }
+            
             ControllableEntity* ce = HumanController::getLocalControllerSingleton()->getControllableEntity();
             Camera* camera = ce->getCamera();
             assert(ce);
         
             Ogre::RenderWindow* w = GraphicsManager::getInstance().getRenderWindow();
 
+
             switch (iterateOverDirections_) 
             {
             case 0 :
@@ -130,10 +139,15 @@
             case 7 :
                 camera->getOgreCamera()->setAspectRatio(aspectRatio_);
                 camera->getOgreCamera()->setFOVy(fovy_);
+                iterateOverDirections_++;
+            case 8 :
                 iterateOverDirections_ =0;
                 takeScreenshot_ = false;
                 CommandExecutor::execute("pause");
+                CommandExecutor::execute("setGametypeStatus true");
+                this->captionsRemoved_ = false;
             }
+
         }
     }
 	

Modified: code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h
===================================================================
--- code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h	2010-05-04 20:44:13 UTC (rev 6857)
+++ code/branches/skybox2/src/modules/designtools/SkyboxGenerator.h	2010-05-06 11:11:43 UTC (rev 6858)
@@ -53,5 +53,6 @@
             int iterateOverDirections_;
             float aspectRatio_;
             Ogre::Radian fovy_;
+            bool captionsRemoved_;
     };
 }

Modified: code/branches/skybox2/src/modules/overlays/hud/GametypeStatus.cc
===================================================================
--- code/branches/skybox2/src/modules/overlays/hud/GametypeStatus.cc	2010-05-04 20:44:13 UTC (rev 6857)
+++ code/branches/skybox2/src/modules/overlays/hud/GametypeStatus.cc	2010-05-06 11:11:43 UTC (rev 6858)
@@ -29,7 +29,7 @@
 #include "GametypeStatus.h"
 
 #include "util/Convert.h"
-#include "core/Core.h"
+#include "core/ConsoleCommand.h"
 #include "core/CoreIncludes.h"
 #include "infos/GametypeInfo.h"
 #include "infos/PlayerInfo.h"
@@ -38,8 +38,11 @@
 
 namespace orxonox
 {
-    CreateFactory(GametypeStatus);
+    CreateFactory(GametypeStatus);  
 
+    /*static*/ bool GametypeStatus::noCaption_s = false; 
+    SetConsoleCommand(GametypeStatus, setGametypeStatus, true);
+
     GametypeStatus::GametypeStatus(BaseObject* creator) : OverlayText(creator)
     {
         RegisterObject(GametypeStatus);
@@ -60,8 +63,11 @@
             const GametypeInfo* gtinfo = this->owner_->getGametypeInfo();
             ControllableEntity* ce = this->owner_->getControllableEntity();
 
-            if(!Core::getInstance().hasGametypeCaptions()) // No captions are displayed.
+            if(GametypeStatus::noCaption_s) // No captions are displayed.
+            {
+                this->setCaption("");
                 return;
+            }
 
             if (!gtinfo->hasStarted() && !gtinfo->isStartCountdownRunning())
             {
@@ -91,4 +97,16 @@
 
         this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
     }
+
+    /**
+    @brief
+        Sets whether the gametype status is displayed.
+    @param bValue
+        If true captions are displayed, if false, not.
+    */
+    /*static*/ void GametypeStatus::setGametypeStatus(bool bValue)
+    {
+        GametypeStatus::noCaption_s = !bValue;
+    }
+    
 }

Modified: code/branches/skybox2/src/modules/overlays/hud/GametypeStatus.h
===================================================================
--- code/branches/skybox2/src/modules/overlays/hud/GametypeStatus.h	2010-05-04 20:44:13 UTC (rev 6857)
+++ code/branches/skybox2/src/modules/overlays/hud/GametypeStatus.h	2010-05-06 11:11:43 UTC (rev 6858)
@@ -45,8 +45,12 @@
             virtual void tick(float dt);
             virtual void changedOwner();
 
+            static void setGametypeStatus(bool bValue); //!< Toggles whether the gametype status is displayed.
+
         private:
             PlayerInfo* owner_;
+            static bool noCaption_s;
+            
     };
 }
 #endif /* _GametypeStatus_H__ */




More information about the Orxonox-commit mailing list