[Orxonox-commit 6243] r10900 - in code/branches/hoverHS15: data/overlays src/modules/hover

meierman at orxonox.net meierman at orxonox.net
Mon Nov 30 16:38:28 CET 2015


Author: meierman
Date: 2015-11-30 16:38:28 +0100 (Mon, 30 Nov 2015)
New Revision: 10900

Modified:
   code/branches/hoverHS15/data/overlays/HoverHUD.oxo
   code/branches/hoverHS15/src/modules/hover/FlagHUD.cc
   code/branches/hoverHS15/src/modules/hover/FlagHUD.h
   code/branches/hoverHS15/src/modules/hover/Hover.cc
   code/branches/hoverHS15/src/modules/hover/Hover.h
   code/branches/hoverHS15/src/modules/hover/TimeHUD.cc
Log:
Judihui it works

Modified: code/branches/hoverHS15/data/overlays/HoverHUD.oxo
===================================================================
--- code/branches/hoverHS15/data/overlays/HoverHUD.oxo	2015-11-30 15:05:08 UTC (rev 10899)
+++ code/branches/hoverHS15/data/overlays/HoverHUD.oxo	2015-11-30 15:38:28 UTC (rev 10900)
@@ -7,7 +7,7 @@
 <Template name="spaceshiphoverhud">
   <OverlayGroup name = "spaceshiphoverhud" scale = "1, 1">
     <TimeHUD
-     name       = "Timer"
+     name       = "TimerHUD"
      position  = "0.95, 0.02"
      pickpoint = "0.0, 0.0"
      font      = "ShareTechMono"
@@ -17,6 +17,7 @@
     />
 
     <FlagHUD
+     name      = "FlagHUD"
      position  = "0.05, 0.02"
      size      = "0.18, 0.05"
     />

Modified: code/branches/hoverHS15/src/modules/hover/FlagHUD.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/FlagHUD.cc	2015-11-30 15:05:08 UTC (rev 10899)
+++ code/branches/hoverHS15/src/modules/hover/FlagHUD.cc	2015-11-30 15:38:28 UTC (rev 10900)
@@ -51,6 +51,10 @@
     }
 
     void FlagHUD::setFlagCount(int flagCount) {
+        if(flagCount == 0){
+            this->panel_->hide();
+            return;
+        }
         this->panel_->setDimensions(
             this->panel_->_getRelativeWidth() / ((float) flagCount_) * ((float) flagCount),
             this->panel_->_getRelativeHeight()
@@ -60,15 +64,13 @@
         this->flagCount_ = flagCount;
     }
 
-    /*void FlagHUD::tick(float dt)
+    void FlagHUD::tick(float dt)
     {
         SUPER(FlagHUD, tick, dt);
 
-        if (this->hoverGame)
-        {
-            setFlagCount(2);
-        }
-    }*/
+            setFlagCount(this->hoverGame->getFlags());
+        
+    }
 
     void FlagHUD::changedOwner()
     {

Modified: code/branches/hoverHS15/src/modules/hover/FlagHUD.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/FlagHUD.h	2015-11-30 15:05:08 UTC (rev 10899)
+++ code/branches/hoverHS15/src/modules/hover/FlagHUD.h	2015-11-30 15:38:28 UTC (rev 10900)
@@ -37,13 +37,13 @@
 
 namespace orxonox
 {
-    class _OverlaysExport FlagHUD : public OrxonoxOverlay //, public Tickable
+    class _OverlaysExport FlagHUD : public OrxonoxOverlay , public Tickable
     {
     public:
         FlagHUD(Context* context);
         virtual ~FlagHUD();
 
-    	//virtual void tick(float dt);
+    	virtual void tick(float dt);
         virtual void changedOwner();
 
         virtual void setFlagCount(int flagCount);

Modified: code/branches/hoverHS15/src/modules/hover/Hover.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.cc	2015-11-30 15:05:08 UTC (rev 10899)
+++ code/branches/hoverHS15/src/modules/hover/Hover.cc	2015-11-30 15:38:28 UTC (rev 10900)
@@ -115,6 +115,7 @@
 
         if(firstTick)
         {
+
             std::fill( g_Maze, g_Maze + NumCells * NumCells, 0 );
             g_PtX=0;
             g_PtY=0;
@@ -142,6 +143,8 @@
 
             for ( int i = 0; i < 5; i++ )
                 flagVector.push_back(new HoverFlag(origin_->getContext(), rand()%10, rand()%10));
+
+            Flags_ = flagVector.size();
             
             //new HoverFlag(origin_->getContext()); //Rechts in Y Richtung
             //new HoverWall(origin_->getContext(), 5, 6, 0); //Ueber in x richtung
@@ -153,13 +156,19 @@
                 flagVector.erase (flagVector.begin()+i);
             }
         }
+        Flags_ = flagVector.size();
 
 
 
     }
 
-    
+     int Hover::getFlags()
+    {
 
+        // Call start for the parent class.
+        return Flags_;
+    }   
+
     void Hover::start()
     {
 

Modified: code/branches/hoverHS15/src/modules/hover/Hover.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.h	2015-11-30 15:05:08 UTC (rev 10899)
+++ code/branches/hoverHS15/src/modules/hover/Hover.h	2015-11-30 15:38:28 UTC (rev 10900)
@@ -87,15 +87,15 @@
             void setOrigin(HoverOrigin* origin)
                        { this->origin_ = origin; }
 
-
+            int getFlags();
             WeakPtr<HoverOrigin> origin_;
 
         private:
             int CellIdx();
             int RandomInt();
             int RandomInt4();
+            int Flags_;
 
-
             bool IsDirValid( eDirection Dir );
             eDirection GetDirection();
             void GenerateMaze();

Modified: code/branches/hoverHS15/src/modules/hover/TimeHUD.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/TimeHUD.cc	2015-11-30 15:05:08 UTC (rev 10899)
+++ code/branches/hoverHS15/src/modules/hover/TimeHUD.cc	2015-11-30 15:38:28 UTC (rev 10900)
@@ -42,6 +42,7 @@
         this->_time = 0.0f;
         this->_running = false;
         this->hoverGame = 0;
+        setRunning(true);
     }
 
     void TimeHUD::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -81,6 +82,8 @@
         {
             this->setCaption(getTimeString(this->_time));
         }
+        if(this->hoverGame->getFlags() == 0)
+            setRunning(false);
         
     }
 




More information about the Orxonox-commit mailing list