Changeset 8920 for code/branches/hud/src
- Timestamp:
- Nov 2, 2011, 4:11:58 PM (13 years ago)
- Location:
- code/branches/hud/src/modules/overlays/hud
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/modules/overlays/hud/HUDNavigation.cc
r8906 r8920 25 25 * Reto Grieder 26 26 * Oliver Scheuss 27 * Matthias Spalinger 27 28 * 28 29 */ … … 77 78 setTextSize ( 0.05f ); 78 79 setNavMarkerSize ( 0.05f ); 80 this->showDistance = false; 79 81 } 80 82 … … 141 143 } 142 144 143 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 } 144 158 145 159 void HUDNavigation::tick ( float dt ) … … 173 187 // Get Distance to HumanController and save it in the TextAreaOverlayElement. 174 188 int dist = listIt->second; 175 176 //it->second.text_->setCaption ( multi_cast<std::string> ( dist ) ); //display distance next to cursor 177 //float textLength = multi_cast<std::string> ( dist ).size() * it->second.text_->getCharHeight() * 0.3f; 178 179 it->second.text_->setCaption(it->first->getRVName()); //display name next to cursor 180 float textLength = it->first->getRVName().size() * it->second.text_->getCharHeight() * 0.3f; 189 float textLength = 0.0f; 190 191 //display distance next to cursor 192 if (showDistance){ 193 it->second.text_->setCaption ( multi_cast<std::string> ( dist ) ); 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 } 181 202 182 203 // Transform to screen coordinates … … 206 227 it->second.wasOutOfView_ = true; 207 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)); 208 235 209 236 // Switch between top, bottom, left and right position of the arrow at the screen border … … 262 289 //it->second.panel_->setMaterialName ( "Orxonox/NavTDC" ); 263 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 ); 264 292 it->second.wasOutOfView_ = false; 265 293 } -
code/branches/hud/src/modules/overlays/hud/HUDNavigation.h
r7401 r8920 24 24 * Co-authors: 25 25 * Reto Grieder 26 * Matthias Spalinger 26 27 * 27 28 */ … … 97 98 sortedList sortedObjectList_; 98 99 100 float getArrowSizeX(int dist); 101 float getArrowSizeY(int dist); 99 102 100 103 float navMarkerSize_; 101 104 std::string fontName_; 102 105 float textSize_; 106 bool showDistance; 103 107 104 108 unsigned int markerLimit_;; //TODO: is it possible to set this over the console and/or the IG-Setting
Note: See TracChangeset
for help on using the changeset viewer.