Changeset 1330
- Timestamp:
- May 19, 2008, 10:58:51 PM (17 years ago)
- Location:
- code/branches/hud3/src/orxonox/hud
- Files:
-
- 4 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud3/src/orxonox/hud/HUD.cc
r1329 r1330 42 42 namespace orxonox 43 43 { 44 using namespace Ogre;44 using namespace Ogre; 45 45 46 HUD::HUD(int zoom){47 om = &Ogre::OverlayManager::getSingleton();46 HUD::HUD(int zoom){ 47 om = &Ogre::OverlayManager::getSingleton(); 48 48 49 BarOverlayElementFactory *barOverlayElementFactory = new BarOverlayElementFactory();50 om->addOverlayElementFactory(barOverlayElementFactory);49 BarOverlayElementFactory *barOverlayElementFactory = new BarOverlayElementFactory(); 50 om->addOverlayElementFactory(barOverlayElementFactory); 51 51 52 RadarOverlayElementFactory *radarOverlayElementFactory = new RadarOverlayElementFactory();53 om->addOverlayElementFactory(radarOverlayElementFactory);52 RadarOverlayElementFactory *radarOverlayElementFactory = new RadarOverlayElementFactory(); 53 om->addOverlayElementFactory(radarOverlayElementFactory); 54 54 55 orxonoxHUD = om->create("Orxonox/HUD");55 orxonoxHUD = om->create("Orxonox/HUD"); 56 56 57 container = static_cast<Ogre::OverlayContainer*>(om->createOverlayElement("Panel", "Orxonox/HUD/container"));57 container = static_cast<Ogre::OverlayContainer*>(om->createOverlayElement("Panel", "Orxonox/HUD/container")); 58 58 59 energyCounter = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "energyCounter"));60 energyCounter->show();59 energyCounter = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "energyCounter")); 60 energyCounter->show(); 61 61 62 speedo = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "speedo"));63 speedo->show();62 speedo = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "speedo")); 63 speedo->show(); 64 64 65 radar = static_cast<RadarOverlayElement*>(om->createOverlayElement("Radar", "radar"));66 radar->show();65 radar = static_cast<RadarOverlayElement*>(om->createOverlayElement("Radar", "radar")); 66 radar->show(); 67 67 68 container->show();69 orxonoxHUD->add2D(container);70 orxonoxHUD->show();71 container->setLeft(0.0);72 container->setTop(0.0);73 container->setWidth(1.0);74 container->setHeight(1.0);75 container->setMetricsMode(Ogre::GMM_RELATIVE);68 container->show(); 69 orxonoxHUD->add2D(container); 70 orxonoxHUD->show(); 71 container->setLeft(0.0); 72 container->setTop(0.0); 73 container->setWidth(1.0); 74 container->setHeight(1.0); 75 container->setMetricsMode(Ogre::GMM_RELATIVE); 76 76 77 energyCounter->init(0.01, 0.95, 0.4, 0.04, container);78 energyCounter->setValue(1);77 energyCounter->init(0.01, 0.95, 0.4, 0.04, container); 78 energyCounter->setValue(1); 79 79 80 speedo->init(0.01, 0.90, 0.4, 0.04, container);80 speedo->init(0.01, 0.90, 0.4, 0.04, container); 81 81 82 radar->init(0.5, 0.9, 0.2, container);83 }82 radar->init(0.5, 0.9, 0.2, container); 83 } 84 84 85 void HUD::tick(float dt)86 {87 energyCounter->resize();85 void HUD::tick(float dt) 86 { 87 energyCounter->resize(); 88 88 89 float v = SpaceShip::instance_s->getVelocity().length();90 float vmax = SpaceShip::instance_s->getMaxSpeed();91 speedo->setValue(v/vmax);92 speedo->resize();89 float v = SpaceShip::instance_s->getVelocity().length(); 90 float vmax = SpaceShip::instance_s->getMaxSpeed(); 91 speedo->setValue(v/vmax); 92 speedo->resize(); 93 93 94 radar->resize();95 radar->update();96 }94 radar->resize(); 95 radar->update(); 96 } 97 97 98 HUD::~HUD(void){99 }98 HUD::~HUD(void){ 99 } 100 100 } 101 101
Note: See TracChangeset
for help on using the changeset viewer.