Changeset 8988 for code/branches/presentation2011/src/modules
- Timestamp:
- Dec 14, 2011, 4:45:22 PM (13 years ago)
- Location:
- code/branches/presentation2011
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2011
- Property svn:mergeinfo changed
/code/branches/hud (added) merged: 8883,8896-8897,8906,8920,8929,8955,8966,8969,8986
- Property svn:mergeinfo changed
-
code/branches/presentation2011/src/modules/overlays/hud/CMakeLists.txt
r8706 r8988 7 7 HUDHealthBar.cc 8 8 HUDTimer.cc 9 HUDEnemyHealthBar.cc 9 10 ChatOverlay.cc 10 11 AnnounceMessage.cc -
code/branches/presentation2011/src/modules/overlays/hud/HUDHealthBar.h
r7401 r8988 110 110 { return this->textoverlay_->getSpaceWidth(); } 111 111 112 inline void setOverlayText(SmartPtr<OverlayText> textoverlay) 113 { this->textoverlay_ = textoverlay; } 114 inline SmartPtr<OverlayText> getOverlayText() const 115 {return this->textoverlay_; } 116 112 117 private: 113 118 WeakPtr<Pawn> owner_; -
code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.cc
r8891 r8988 25 25 * Reto Grieder 26 26 * Oliver Scheuss 27 * Matthias Spalinger 27 28 * 28 29 */ … … 63 64 { 64 65 SetConfigValue(markerLimit_, 3); 65 66 SetConfigValue(showDistance, false); 66 67 } 67 68 … … 78 79 setTextSize ( 0.05f ); 79 80 setNavMarkerSize ( 0.05f ); 80 setDetectionLimit( 10000.0f );81 81 } 82 82 … … 97 97 SUPER ( HUDNavigation, XMLPort, xmlelement, mode ); 98 98 99 XMLPortParam ( HUDNavigation, "font", setFont, getFont, xmlelement, mode ); 100 XMLPortParam ( HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode ); 101 XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode ); 102 XMLPortParam ( HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode ); 99 XMLPortParam ( HUDNavigation, "font", setFont, getFont, xmlelement, mode ); 100 XMLPortParam ( HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode ); 101 XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode ); 103 102 } 104 103 … … 144 143 } 145 144 146 145 float HUDNavigation::getArrowSizeX(int dist) 146 { 147 if (dist < 600) 148 dist = 600; 149 return this->getActualSize().x * 900 * navMarkerSize_ / dist; 150 } 151 152 float HUDNavigation::getArrowSizeY(int dist) 153 { 154 if (dist < 600) 155 dist = 600; 156 return this->getActualSize().y * 900 * navMarkerSize_ / dist; 157 } 147 158 148 159 void HUDNavigation::tick ( float dt ) … … 164 175 165 176 unsigned int markerCount_ = 0; 166 bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player 177 167 178 // for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it) 168 179 for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt ) 169 180 { 170 181 ObjectMap::iterator it = activeObjectList_.find ( listIt->first ); 171 closeEnough_ = listIt->second < detectionLimit_ ; 172 if ( markerCount_ < markerLimit_ && (closeEnough_ || detectionLimit_ < 0) ) // display on HUD if the statement is true182 183 if ( markerCount_ < markerLimit_ ) 173 184 { 174 185 … … 176 187 // Get Distance to HumanController and save it in the TextAreaOverlayElement. 177 188 int dist = listIt->second; 189 float textLength = 0.0f; 190 191 //display distance next to cursor 192 if (showDistance){ 178 193 it->second.text_->setCaption ( multi_cast<std::string> ( dist ) ); 179 float textLength = multi_cast<std::string> ( dist ).size() * it->second.text_->getCharHeight() * 0.3f; 194 textLength = multi_cast<std::string> ( dist ).size() * it->second.text_->getCharHeight() * 0.3f; 195 } 196 197 //display name next to cursor 198 else{ 199 it->second.text_->setCaption(it->first->getRVName()); 200 textLength = it->first->getRVName().size() * it->second.text_->getCharHeight() * 0.3f; 201 } 180 202 181 203 // Transform to screen coordinates … … 194 216 else 195 217 outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0; 196 // Get Distance to HumanController and save it in the TextAreaOverlayElement.197 it->second.text_->setCaption ( multi_cast<std::string> ( dist ) );198 218 199 219 if ( outOfView ) … … 207 227 it->second.wasOutOfView_ = true; 208 228 } 229 230 //float xDistScale = this->getActualSize().x * 1000.0f * navMarkerSize_ / dist; 231 //float yDistScale = this->getActualSize().y * 1000.0f * navMarkerSize_ / dist; 232 233 // Adjust Arrowsize according to distance 234 it->second.panel_->setDimensions(getArrowSizeX(dist),getArrowSizeY(dist)); 209 235 210 236 // Switch between top, bottom, left and right position of the arrow at the screen border … … 263 289 //it->second.panel_->setMaterialName ( "Orxonox/NavTDC" ); 264 290 it->second.panel_->setMaterialName( TextureGenerator::getMaterialName( "tdc.png", it->first->getRadarObjectColour()) ); 291 it->second.panel_->setDimensions ( navMarkerSize_ * this->getActualSize().x, navMarkerSize_ * this->getActualSize().y ); 265 292 it->second.wasOutOfView_ = false; 266 293 } … … 280 307 it->second.text_->show(); 281 308 } 282 else // do not display on HUD309 else 283 310 { 284 311 it->second.panel_->hide(); … … 312 339 void HUDNavigation::addObject ( RadarViewable* object ) 313 340 { 314 if( showObject(object) ==false )341 if( showObject(object)==false ) 315 342 return; 316 343 … … 399 426 return false; 400 427 assert( rv->getWorldEntity() ); 401 if ( rv->getWorldEntity()->isVisible() == false || rv->getRadarVisibility() ==false )428 if ( rv->getWorldEntity()->isVisible()==false || rv->getRadarVisibility()==false ) 402 429 return false; 403 430 return true; -
code/branches/presentation2011/src/modules/overlays/hud/HUDNavigation.h
r8891 r8988 24 24 * Co-authors: 25 25 * Reto Grieder 26 * Matthias Spalinger 26 27 * 27 28 */ … … 54 55 virtual void tick ( float dt ); 55 56 57 // RadarListener interface 56 58 virtual void addObject ( RadarViewable* object ); 57 59 virtual void removeObject ( RadarViewable* viewable ); … … 66 68 inline float getRadarSensitivity() const 67 69 { return 1.0f; } 70 71 unsigned int getMarkerLimit() { return this->markerLimit_; } 68 72 69 73 private: … … 85 89 { return navMarkerSize_; } 86 90 87 void setDetectionLimit( float limit )88 { this->detectionLimit_ = limit; }89 float getDetectionLimit() const90 { return this->detectionLimit_; }91 91 92 92 void setTextSize ( float size ); … … 102 102 sortedList sortedObjectList_; 103 103 104 float getArrowSizeX(int dist); 105 float getArrowSizeY(int dist); 104 106 105 107 float navMarkerSize_; 106 108 std::string fontName_; 107 109 float textSize_; 110 bool showDistance; 108 111 109 unsigned int markerLimit_; //TODO: is it possible to set this over the console and/or the IG-Setting110 float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. 111 //!< In order to bypass this behaviour, set a negative detectionLimit_. Then the detection range is "infinite". 112 unsigned int markerLimit_;; 113 114 112 115 }; 113 116 }
Note: See TracChangeset
for help on using the changeset viewer.