Changeset 1314 for code/branches/hud3/src/orxonox/hud/HUD.cc
- Timestamp:
- May 17, 2008, 3:05:27 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud3/src/orxonox/hud/HUD.cc
r1310 r1314 48 48 49 49 HUD::HUD(int zoom){ 50 51 Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton(); 50 om = &Ogre::OverlayManager::getSingleton(); 52 51 53 52 BarOverlayElementFactory *barOverlayElementFactory = new BarOverlayElementFactory(); 54 o verlayManager.addOverlayElementFactory(barOverlayElementFactory);53 om->addOverlayElementFactory(barOverlayElementFactory); 55 54 56 55 SmartBarOverlayElementFactory *smartBarOverlayElementFactory = new SmartBarOverlayElementFactory(); 57 o verlayManager.addOverlayElementFactory(smartBarOverlayElementFactory);56 om->addOverlayElementFactory(smartBarOverlayElementFactory); 58 57 59 58 RadarOverlayElementFactory *radarOverlayElementFactory = new RadarOverlayElementFactory(); 60 o verlayManager.addOverlayElementFactory(radarOverlayElementFactory);59 om->addOverlayElementFactory(radarOverlayElementFactory); 61 60 62 Ogre::Overlay* orxonoxOverlay = overlayManager.create("Orxonox/HUD");61 orxonoxHUD = om->create("Orxonox/HUD"); 63 62 64 Ogre::OverlayContainer* energyCounterPanel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "Orxonox/HUD/energyCounterPanel"));63 container = static_cast<Ogre::OverlayContainer*>(om->createOverlayElement("Panel", "Orxonox/HUD/container")); 65 64 66 energyCounter = static_cast<SmartBarOverlayElement*>(o verlayManager.createOverlayElement("SmartBar", "energyCounter"));67 //energyCounter->show();65 energyCounter = static_cast<SmartBarOverlayElement*>(om->createOverlayElement("SmartBar", "energyCounter")); 66 energyCounter->show(); 68 67 68 speedo = static_cast<SmartBarOverlayElement*>(om->createOverlayElement("SmartBar", "speedo")); 69 speedo->show(); 69 70 70 radar = static_cast<RadarOverlayElement*>(o verlayManager.createOverlayElement("Radar", "radar"));71 radar = static_cast<RadarOverlayElement*>(om->createOverlayElement("Radar", "radar")); 71 72 radar->show(); 72 73 … … 108 109 test->show(); 109 110 test->setMetricsMode(Ogre::GMM_PIXELS); 110 energyCounterPanel->addChild(test);111 container->addChild(test); 111 112 112 113 COUT(0)<<alpha<<" "<<beta<<" "<<right<<std::endl; 113 114 */ 114 115 115 energyCounterPanel->addChild(energyCounter); 116 energyCounterPanel->addChild(radar); 117 energyCounterPanel->show(); 116 container->addChild(energyCounter); 117 container->addChild(speedo); 118 container->addChild(radar); 119 container->show(); 118 120 119 orxonox Overlay->add2D(energyCounterPanel);120 orxonox Overlay->show();121 orxonoxHUD->add2D(container); 122 orxonoxHUD->show(); 121 123 122 124 … … 133 135 */ 134 136 135 energyCounterPanel->setLeft(0.0);136 energyCounterPanel->setTop(0.0);137 energyCounterPanel->setWidth(1.0);138 energyCounterPanel->setHeight(1.0);139 energyCounterPanel->setMetricsMode(Ogre::GMM_RELATIVE);137 container->setLeft(0.0); 138 container->setTop(0.0); 139 container->setWidth(1.0); 140 container->setHeight(1.0); 141 container->setMetricsMode(Ogre::GMM_RELATIVE); 140 142 141 energyCounter->initSmartBarOverlayElement( 10,10,200,20,BarOverlayElement::LEFT);142 energyCounter->reset( 80);143 energyCounter->initSmartBarOverlayElement(0.01, 0.01, 0.2, 0.02, BarOverlayElement::LEFT); 144 energyCounter->reset(100); 143 145 144 radar->initRadarOverlayElement(0.5, 0.8, 0.2, energyCounterPanel); 146 speedo->initSmartBarOverlayElement(0.01, 0.04, 0.2, 0.02, BarOverlayElement::LEFT); 147 speedo->reset(80); 148 149 radar->initRadarOverlayElement(0.5, 0.9, 0.2, container); 145 150 146 151 … … 149 154 void HUD::tick(float dt) 150 155 { 156 float v = SpaceShip::instance_s->getVelocity().length(); 157 float vmax = SpaceShip::instance_s->getMaxSpeed(); 158 speedo->reset(100*v/vmax); 159 COUT(3) << 100*v/vmax << std::endl; 151 160 radar->update(); 152 161 /*if (this->ogreNode_)
Note: See TracChangeset
for help on using the changeset viewer.