[Orxonox-commit 4322] r8993 - code/branches/presentation2011/src/modules/overlays/hud
jo at orxonox.net
jo at orxonox.net
Sat Dec 17 00:35:33 CET 2011
Author: jo
Date: 2011-12-17 00:35:33 +0100 (Sat, 17 Dec 2011)
New Revision: 8993
Modified:
code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.cc
code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.h
Log:
Repairing the radar.
Modified: code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.cc 2011-12-16 19:36:41 UTC (rev 8992)
+++ code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.cc 2011-12-16 23:35:33 UTC (rev 8993)
@@ -75,9 +75,10 @@
this->setConfigValues();
// Set default values
- setFont ( "Monofur" );
- setTextSize ( 0.05f );
- setNavMarkerSize ( 0.05f );
+ this->setFont ( "Monofur" );
+ this->setTextSize ( 0.05f );
+ this->setNavMarkerSize ( 0.05f );
+ this->setDetectionLimit( 10000.0f );
}
HUDNavigation::~HUDNavigation()
@@ -99,6 +100,7 @@
XMLPortParam ( HUDNavigation, "font", setFont, getFont, xmlelement, mode );
XMLPortParam ( HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode );
XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode );
+ XMLPortParam ( HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode );
}
void HUDNavigation::setFont ( const std::string& font )
@@ -174,13 +176,15 @@
sortedObjectList_.sort ( compareDistance );
unsigned int markerCount_ = 0;
+ bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
// for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt )
{
ObjectMap::iterator it = activeObjectList_.find ( listIt->first );
-
- if ( markerCount_ < markerLimit_ )
+ closeEnough_ = listIt->second < detectionLimit_ ;
+ // display radarviewables on HUD if the marker limit and max-distance is not exceeded
+ if ( markerCount_ < markerLimit_ && (closeEnough_ || detectionLimit_ < 0) )
{
@@ -306,7 +310,7 @@
it->second.panel_->show();
it->second.text_->show();
}
- else
+ else // do not display on HUD
{
it->second.panel_->hide();
it->second.text_->hide();
Modified: code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.h
===================================================================
--- code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.h 2011-12-16 19:36:41 UTC (rev 8992)
+++ code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.h 2011-12-16 23:35:33 UTC (rev 8993)
@@ -84,11 +84,14 @@
// XMLPort accessors
void setNavMarkerSize ( float size )
- { navMarkerSize_ = size; this->sizeChanged(); }
+ { navMarkerSize_ = size; this->sizeChanged(); }
float getNavMarkerSize() const
- { return navMarkerSize_; }
+ { return navMarkerSize_; }
+ void setDetectionLimit( float limit )
+ { this->detectionLimit_ = limit; }
+ float getDetectionLimit() const
+ { return this->detectionLimit_; }
-
void setTextSize ( float size );
float getTextSize() const;
@@ -109,9 +112,9 @@
float textSize_;
bool showDistance;
- unsigned int markerLimit_;;
+ unsigned int markerLimit_;
+ float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value.
-
};
}
More information about the Orxonox-commit
mailing list