Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6898


Ignore:
Timestamp:
May 13, 2010, 12:02:14 PM (15 years ago)
Author:
sfluecki
Message:

changes in 'src/modules/overlays/hud/HUDNavigation'.
HUDNavigation::changedOwner() now working for the case you get shot. all targetMarkers are now shown after you respawn. textOverlays still missing - why i dont know?.

Location:
code/branches/hudelements/src/modules/overlays/hud
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.cc

    r6897 r6898  
    6161    setNavMarkerSize(0.05f);
    6262
    63     respawnObjectSet_ = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 
    64 
    65     for (respawnObjectSetIt_ = respawnObjectSet_.begin(); respawnObjectSetIt_ != respawnObjectSet_.end();
    66             ++respawnObjectSetIt_)
    67     {
    68         if (!(*respawnObjectSetIt_)->isHumanShip_)  addObject(*respawnObjectSetIt_);
    69     }
     63
    7064   
    7165//         // create nav text
     
    182176        for (tempRadarViewable = activeObjectList_.begin(); tempRadarViewable!=activeObjectList_.end(); ++tempRadarViewable)
    183177        {
    184             COUT(0) << "check 174" << std::endl;
     178
    185179
    186180            //get Distance to HumanController and save it in the TextAreaOverlayElement.
     
    189183            float textLength = multi_cast<std::string>(dist).size() * tempRadarViewable->second.second->getCharHeight() * 0.3f;
    190184
    191             COUT(0) << "check 181" << std::endl;
     185
    192186
    193187            orxonox::Camera* cam = CameraManager::getInstance().getActiveCamera();
     
    198192            Vector3 pos = transform * tempRadarViewable->first->getRVWorldPosition();
    199193
    200             COUT(0) << "check 190" << std::endl;
     194
    201195
    202196            bool outOfView;
     
    224218                }
    225219
    226                 COUT(0) << "check 174" << std::endl;
     220
    227221
    228222                if (pos.x < pos.y)
     
    272266            else
    273267            {
    274                 COUT(0) << "check 264" << std::endl;
     268
    275269
    276270                // object is in view
     
    299293            }
    300294
    301             tempRadarViewable->second.first->show();
    302             tempRadarViewable->second.second->show();
     295             tempRadarViewable->second.first->show();
     296             tempRadarViewable->second.second->show();
    303297        }
    304298
     
    308302
    309303
    310 float HUDNavigation::getDist2Focus() const {
    311 
    312     Radar* radar = this->getOwner()->getScene()->getRadar();
    313     if (radar->getFocus() && HumanController::getLocalControllerEntityAsPawn())
    314         return (radar->getFocus()->getRVWorldPosition() - HumanController::getLocalControllerEntityAsPawn()->getWorldPosition()).length();
    315     else
    316         return 0;
    317 }
     304// float HUDNavigation::getDist2Focus() const {
     305//
     306//     Radar* radar = this->getOwner()->getScene()->getRadar();
     307//     if (radar->getFocus() && HumanController::getLocalControllerEntityAsPawn())
     308//         return (radar->getFocus()->getRVWorldPosition() - HumanController::getLocalControllerEntityAsPawn()->getWorldPosition()).length();
     309//     else
     310//         return 0;
     311// }
    318312
    319313/**
     
    361355    Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()
    362356                                         .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString()));
    363 
     357               
     358   
    364359    float xScale = this->getActualSize().x;
    365360    float yScale = this->getActualSize().y;
     
    375370//      background_->addChild(activeObjectList_[object].first);
    376371//      background_->addChild(activeObjectList_[object].second);
    377     COUT(0) << "check 357" << std::endl;
     372
    378373}
    379374
     
    392387}
    393388
    394 // void HUDRadar::changedOwner() {
    395 //     SUPER(HUDRadar, changedOwner);
    396 //
    397 //     this->owner_ = orxonox_cast<Pawn*>(this->getOwner());
    398 //     assert(this->radarObjects_.size()==0);
    399 //     this->gatherObjects();
    400 // }
     389void HUDNavigation::changedOwner() {
     390     
     391
     392 
     393    respawnObjectSet_ = this->getOwner()->getScene()->getRadar()->getRadarObjects();
     394    respawnObjectSetType::iterator respawnObjectSetIt_;
     395    for (respawnObjectSetIt_ = respawnObjectSet_.begin(); respawnObjectSetIt_ != respawnObjectSet_.end();
     396            ++respawnObjectSetIt_)
     397    {
     398        if (!(*respawnObjectSetIt_)->isHumanShip_)  HUDNavigation::addObject(*respawnObjectSetIt_);
     399    }
     400
     401}
     402
     403
    401404
    402405//      void updateActiveObjectList(map activeObjectList_){}
  • code/branches/hudelements/src/modules/overlays/hud/HUDNavigation.h

    r6897 r6898  
    5858    inline float getRadarSensitivity() const {return 1.0f;}
    5959    inline void radarTick(float dt) {}
    60 //     virtual void changedOwner();
     60    virtual void changedOwner();
    6161
    6262
     
    9595    void updateMarker();
    9696    void updateFocus();
    97     float getDist2Focus() const;
     97//     float getDist2Focus() const;
    9898    void getSingleton();
    9999
     
    113113    activeObjectListType activeObjectList_;
    114114    activeObjectListType::iterator tempRadarViewable;
    115    
     115       
    116116    typedef std::set<RadarViewable*> respawnObjectSetType;
    117117    respawnObjectSetType respawnObjectSet_;
    118     respawnObjectSetType::iterator respawnObjectSetIt_;
     118   
     119
    119120
    120121    std::string fontName_;
Note: See TracChangeset for help on using the changeset viewer.