Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6880 for code/branches


Ignore:
Timestamp:
May 10, 2010, 3:58:08 PM (15 years ago)
Author:
rgrieder
Message:

HUDNavigation: Fixed a few bugs, add to background and fixed size issues.

File:
1 edited

Legend:

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

    r6875 r6880  
    251251                        // down
    252252                        float position = -pos.x / pos.y + 1.0f;
    253                         tempRadarViewable->second.first->setPosition((position - tempRadarViewable->second.first->getWidth()) * 0.5f, 1.0f - navMarker_->getHeight());
     253                        tempRadarViewable->second.first->setPosition((position - tempRadarViewable->second.first->getWidth()) * 0.5f, 1.0f - tempRadarViewable->second.first->getHeight());
    254254                        tempRadarViewable->second.first->setUV(0.0f, 0.5f, 0.5f, 1.0f);
    255255                        tempRadarViewable->second.second->setLeft((position - textLength) * 0.5f);
     
    296296            }
    297297                 
    298         tempRadarViewable->second.first->show();
    299         tempRadarViewable->second.second->show();
    300         COUT(0) << "ShowGUITest z300" << std::endl;
    301         }
     298    tempRadarViewable->second.first->show();
     299    tempRadarViewable->second.second->show();
     300    }
    302301
    303302    }
     
    360359                                         .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString()));
    361360
    362    
     361    float xScale = this->getActualSize().x;
     362    float yScale = this->getActualSize().y;
     363
     364    panel->setDimensions(navMarkerSize_ * xScale, navMarkerSize_ * yScale);
     365    text->setCharHeight(text->getCharHeight() * yScale);
    363366
    364367    activeObjectList_[object] = std::make_pair (panel, text) ;
     368
     369    this->background_->addChild(panel);
     370    this->background_->addChild(text);
    365371
    366372//      background_->addChild(activeObjectList_[object].first);
     
    369375}
    370376
    371 void HUDNavigation::removeObject(RadarViewable* viewable) {
    372     assert(activeObjectList_.find(viewable)!=activeObjectList_.end());
    373     activeObjectList_.erase(viewable);
     377void HUDNavigation::removeObject(RadarViewable* viewable)
     378{
     379    activeObjectListType::iterator it = activeObjectList_.find(viewable);
     380
     381    if (activeObjectList_.find(viewable) != activeObjectList_.end())
     382    {
     383        // Remove overlays from Ogre
     384        this->background_->removeChild(it->second.first->getName());
     385        this->background_->removeChild(it->second.second->getName());
     386
     387        activeObjectList_.erase(viewable);
     388    }
    374389}
    375390
Note: See TracChangeset for help on using the changeset viewer.