[Orxonox-commit 5208] r9872 - in code/branches/levelMichael: data/levels src/modules/overlays/hud

jo at orxonox.net jo at orxonox.net
Thu Dec 5 20:46:18 CET 2013


Author: jo
Date: 2013-12-05 20:46:18 +0100 (Thu, 05 Dec 2013)
New Revision: 9872

Modified:
   code/branches/levelMichael/data/levels/Spacefight.oxw
   code/branches/levelMichael/src/modules/overlays/hud/CountDown.cc
   code/branches/levelMichael/src/modules/overlays/hud/CountDown.h
Log:
Making the countdown speed configurable.

Modified: code/branches/levelMichael/data/levels/Spacefight.oxw
===================================================================
--- code/branches/levelMichael/data/levels/Spacefight.oxw	2013-12-04 23:17:04 UTC (rev 9871)
+++ code/branches/levelMichael/data/levels/Spacefight.oxw	2013-12-05 19:46:18 UTC (rev 9872)
@@ -63,14 +63,15 @@
  <Script code="showGUI NotificationLayer false true" needsGraphics="true" />
  <OverlayGroup name="spacefightHUD" scale = "1, 1">
  <CountDown
-     position  = "0.49, 0.05"
-     pickpoint = "0.0, 0.0"
-     font      = "ShareTechMono"
-     textsize  = 0.06
-     colour    = "1.0, 1.0, 1.0, 1.0"
-     align     = "right"                  
-     counter   = "10.0"
-     active    = "false"
+     position    = "0.49, 0.05"
+     pickpoint   = "0.0, 0.0"
+     font        = "ShareTechMono"
+     textsize    = 0.06
+     colour      = "1.0, 1.0, 1.0, 1.0"
+     align       = "right"                  
+     counter     = "10.0"
+     speedfactor = "2.0"
+     active      = "false"
   >
       <events>
           <activity>

Modified: code/branches/levelMichael/src/modules/overlays/hud/CountDown.cc
===================================================================
--- code/branches/levelMichael/src/modules/overlays/hud/CountDown.cc	2013-12-04 23:17:04 UTC (rev 9871)
+++ code/branches/levelMichael/src/modules/overlays/hud/CountDown.cc	2013-12-05 19:46:18 UTC (rev 9872)
@@ -34,14 +34,15 @@
         @code
         <OverlayGroup name="spacefightHUD" scale = "1, 1">
           <CountDown
-              position  = "0.49, 0.05"
-              pickpoint = "0.0, 0.0"
-              font      = "ShareTechMono"
-              textsize  = 0.06
-              colour    = "1.0, 1.0, 1.0, 1.0"
-              align     = "right"                  
-              counter   = "10.0"
-              active    = "false"
+              position    = "0.49, 0.05"
+              pickpoint   = "0.0, 0.0"
+              font        = "ShareTechMono"
+              textsize    = 0.06
+              colour      = "1.0, 1.0, 1.0, 1.0"
+              align       = "right"                  
+              counter     = "10.0"
+              speedfactor = "1.0"
+              active      = "false"
            >
             <events>
               <activity>
@@ -81,6 +82,7 @@
     {
         SUPER(CountDown, XMLPort, xmlelement, mode);
         XMLPortParam(CountDown, "counter", setCounter, getCounter, xmlelement, mode).defaultValues(10);
+        XMLPortParam(CountDown, "speedfactor", setSpeed, getSpeed, xmlelement, mode).defaultValues(1);
     }
     
     void CountDown::tick(float dt)
@@ -96,7 +98,7 @@
             }
             else
             {
-                this->counter_ -= dt;
+                this->counter_ -= dt*speed_;
                 this->setCaption(multi_cast<std::string>((int)this->counter_)); //TODO: evtl. initialize with +0.5f
             }
         }

Modified: code/branches/levelMichael/src/modules/overlays/hud/CountDown.h
===================================================================
--- code/branches/levelMichael/src/modules/overlays/hud/CountDown.h	2013-12-04 23:17:04 UTC (rev 9871)
+++ code/branches/levelMichael/src/modules/overlays/hud/CountDown.h	2013-12-05 19:46:18 UTC (rev 9872)
@@ -51,11 +51,17 @@
                 { this->counter_ = value + 0.99f; }
             inline float getCounter() const
                 { return this->counter_; }
+            inline void setSpeed(float value)
+                { this->speed_ = value; }
+            inline float getSpeed() const
+                { return this->speed_; }
+                
         protected:
 
         private:
             PlayerInfo* owner_;
             float counter_;
+            float speed_;
             bool hasStopped_;
     };
 }




More information about the Orxonox-commit mailing list