Changeset 9434 for code/branches/spaceNavigation/src/modules/overlays/hud
- Timestamp:
- Nov 5, 2012, 4:06:21 PM (12 years ago)
- Location:
- code/branches/spaceNavigation/src/modules/overlays/hud
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc
r9429 r9434 203 203 it->second.text_->setCaption(it->first->getRadarName()); 204 204 textLength = it->first->getRadarName().size() * it->second.text_->getCharHeight() * 0.3f; 205 } 206 207 // TODO : closest object is selected 208 if(listIt == this->sortedObjectList_.begin()) 209 { 210 it->second.selected_ = true; 211 } else { 212 it->second.selected_ = false; 205 213 } 206 214 … … 293 301 it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("tdc.png", it->first->getRadarObjectColour())); 294 302 it->second.panel_->setDimensions(this->navMarkerSize_ * this->getActualSize().x, this->navMarkerSize_ * this->getActualSize().y); 295 it->second.target_->setDimensions( aimMarkerSize_ * this->getActualSize().x, this->aimMarkerSize_ * this->getActualSize().y);303 it->second.target_->setDimensions(this->aimMarkerSize_ * this->getActualSize().x, this->aimMarkerSize_ * this->getActualSize().y); 296 304 it->second.wasOutOfView_ = false; 297 305 } … … 307 315 308 316 // Target marker 309 Vector3* targetPos = this->toAimPosition(it->first); 310 Vector3 screenPos = camTransform * *targetPos; 311 // Check if the target marker is in view too 312 if(screenPos.z > 1 || screenPos.x < -1.0 || screenPos.x > 1.0 313 || screenPos.y < -1.0 || screenPos.y > 1.0) 317 if(it->second.selected_) 314 318 { 319 Vector3* targetPos = this->toAimPosition(it->first); 320 Vector3 screenPos = camTransform * *targetPos; 321 // Check if the target marker is in view too 322 if(screenPos.z > 1 || screenPos.x < -1.0 || screenPos.x > 1.0 323 || screenPos.y < -1.0 || screenPos.y > 1.0) 324 { 325 it->second.target_->hide(); 326 } 327 else 328 { 329 it->second.target_->setLeft((screenPos.x + 1.0f - it->second.target_->getWidth()) * 0.5f); 330 it->second.target_->setTop((-screenPos.y + 1.0f - it->second.target_->getHeight()) * 0.5f); 331 it->second.target_->show(); 332 } 333 334 delete targetPos; 335 } 336 else // don't show marker for not selected enemies 315 337 it->second.target_->hide(); 316 }317 else318 {319 it->second.target_->setLeft((screenPos.x + 1.0f - it->second.target_->getWidth()) * 0.5f);320 it->second.target_->setTop((-screenPos.y + 1.0f - it->second.target_->getHeight()) * 0.5f);321 it->second.target_->show();322 }323 324 delete targetPos;325 338 } 326 339 … … 405 418 406 419 ObjectInfo tempStruct = 407 { panel, target, text, false /*, TODO: initialize wasOutOfView_ */};420 { panel, target, text, false, false, false}; 408 421 this->activeObjectList_[object] = tempStruct; 409 422 -
code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.h
r9429 r9434 79 79 bool outOfView_; 80 80 bool wasOutOfView_; 81 bool selected_; 81 82 }; 82 83
Note: See TracChangeset
for help on using the changeset viewer.