[Orxonox-commit 4760] r9429 - in code/branches/spaceNavigation: data/overlays src/modules/overlays/hud

mottetb at orxonox.net mottetb at orxonox.net
Mon Nov 5 14:30:38 CET 2012


Author: mottetb
Date: 2012-11-05 14:30:37 +0100 (Mon, 05 Nov 2012)
New Revision: 9429

Modified:
   code/branches/spaceNavigation/data/overlays/HUD.oxo
   code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc
   code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h
Log:
aimMarkerSize Problem


Modified: code/branches/spaceNavigation/data/overlays/HUD.oxo
===================================================================
--- code/branches/spaceNavigation/data/overlays/HUD.oxo	2012-11-05 13:15:34 UTC (rev 9428)
+++ code/branches/spaceNavigation/data/overlays/HUD.oxo	2012-11-05 13:30:37 UTC (rev 9429)
@@ -51,7 +51,7 @@
    rotation   = 0
    value      = 0
   >
-    <BarColour position = 0.7 colour = "0.2,0.7,0.2" />
+    <BarColounar position = 0.7 colour = "0.2,0.7,0.2" />
     <BarColour position = 0.4 colour = "0.7,0.5,0.2" />
     <BarColour position = 0.1 colour = "0.7,0.2,0.2" />
   </HUDSpeedBar-->
@@ -62,7 +62,7 @@
    font          = "Monofur"
    textSize      = 0.05
    navMarkerSize = 0.03
-   aimMarkerSize = 0.04
+   aimMarkerSize = 0.02
   />
 
   <HUDRadar

Modified: code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc	2012-11-05 13:15:34 UTC (rev 9428)
+++ code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc	2012-11-05 13:30:37 UTC (rev 9429)
@@ -71,12 +71,14 @@
         this->setFont("Monofur");
         this->setTextSize(0.05f);
         this->setNavMarkerSize(0.05f);
+        this->setAimMarkerSize(0.02f);
+
         this->setDetectionLimit(10000.0f);
         this->currentMunitionSpeed_ = 2500.0f;
 
-        Pawn* ship = orxonox_cast<Pawn*>(this->getOwner());
+        /*Pawn* ship = orxonox_cast<Pawn*>(this->getOwner());
         if(ship != NULL)
-            this->ship_ = ship;
+            this->ship_ = ship;*/
     }
 
     HUDNavigation::~HUDNavigation()
@@ -103,6 +105,7 @@
         XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode);
         XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode);
         XMLPortParam(HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode);
+        XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlelement, mode);
     }
 
     void HUDNavigation::setFont(const std::string& font)
@@ -289,6 +292,7 @@
                         //it->second.panel_->setMaterialName("Orxonox/NavTDC");
                         it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("tdc.png", it->first->getRadarObjectColour()));
                         it->second.panel_->setDimensions(this->navMarkerSize_ * this->getActualSize().x, this->navMarkerSize_ * this->getActualSize().y);
+                        it->second.target_->setDimensions(aimMarkerSize_ * this->getActualSize().x, this->aimMarkerSize_ * this->getActualSize().y);
                         it->second.wasOutOfView_ = false;
                     }
 
@@ -297,7 +301,11 @@
                     it->second.panel_->setLeft((pos.x + 1.0f - it->second.panel_->getWidth()) * 0.5f);
                     it->second.panel_->setTop((-pos.y + 1.0f - it->second.panel_->getHeight()) * 0.5f);
 
-                    // TODO : Target marker
+                    // Position text
+                    it->second.text_->setLeft((pos.x + 1.0f + it->second.panel_->getWidth()) * 0.5f);
+                    it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f);
+
+                    // Target marker
                     Vector3* targetPos = this->toAimPosition(it->first);
                     Vector3 screenPos = camTransform * *targetPos;
                     // Check if the target marker is in view too
@@ -308,17 +316,12 @@
                     }
                     else
                     {
-                        it->second.target_->show();
                         it->second.target_->setLeft((screenPos.x + 1.0f - it->second.target_->getWidth()) * 0.5f);
                         it->second.target_->setTop((-screenPos.y + 1.0f - it->second.target_->getHeight()) * 0.5f);
+                        it->second.target_->show();
                     }
 
-                    orxout() << targetPos->x << endl;
                     delete targetPos;
-
-                    // Position text
-                    it->second.text_->setLeft((pos.x + 1.0f + it->second.panel_->getWidth()) * 0.5f);
-                    it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f);
                 }
 
                 // Make sure the overlays are shown
@@ -330,7 +333,7 @@
             {
                 it->second.panel_->hide();
                 it->second.text_->hide();
-                it->second.target_->hide(); // TODO :
+                it->second.target_->hide();
             }
         }
     }
@@ -353,8 +356,7 @@
             if (it->second.text_ != NULL)
                 it->second.text_->setCharHeight(it->second.text_->getCharHeight() * yScale);
             if (it->second.target_ != NULL)
-                it->second.target_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);
-            // TODO : targetMarkerSize_ ???
+                it->second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);
         }
     }
 
@@ -387,8 +389,8 @@
         // Create target marker
         Ogre::PanelOverlayElement* target = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
                 .createOverlayElement("Panel", "HUDNavigation_targetMarker_" + getUniqueNumberString()));
-        target->setMaterialName(TextureGenerator::getMaterialName("target.png" /* TODO : create the target picture */, object->getRadarObjectColour()));
-        target->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);
+        target->setMaterialName(TextureGenerator::getMaterialName("target.png", object->getRadarObjectColour()));
+        target->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);
 
         // Create text
         Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()

Modified: code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h
===================================================================
--- code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h	2012-11-05 13:15:34 UTC (rev 9428)
+++ code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h	2012-11-05 13:30:37 UTC (rev 9429)
@@ -90,6 +90,13 @@
             }
             inline float getNavMarkerSize() const
                 { return navMarkerSize_; }
+            inline void setAimMarkerSize(float size)
+            {
+                aimMarkerSize_ = size;
+                this->sizeChanged();
+            }
+            inline float getAimMarkerSize() const
+                { return aimMarkerSize_; }
             inline void setDetectionLimit(float limit)
                 { this->detectionLimit_ = limit; }
             inline float getDetectionLimit() const
@@ -110,6 +117,7 @@
             std::list<std::pair<RadarViewable*, unsigned int> > sortedObjectList_;
 
             float navMarkerSize_;
+            float aimMarkerSize_;
             std::string fontName_;
             float textSize_;
             bool showDistance_;




More information about the Orxonox-commit mailing list