Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 17, 2008, 5:42:44 PM (17 years ago)
Author:
nicolasc
Message:

added chai's hud

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud/src/orxonox/Orxonox.cc

    r790 r823  
    4343#include <OgreConfigFile.h>
    4444#include <OgreOverlay.h>
     45#include <OgreOverlayContainer.h>
    4546#include <OgreOverlayManager.h>
    4647
     
    7374#include "core/Debug.h"
    7475#include "hud/HUD.h"
     76#include "hud/Bar.h"
    7577#include "objects/weapon/BulletManager.h"
    7678#include "GraphicsEngine.h"
     
    382384    loader_->loadLevel();
    383385
    384     Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
    385     HUD* orxonoxHud;
    386     orxonoxHud = new HUD();
    387     orxonoxHud->setEnergyValue(20);
    388     orxonoxHud->setEnergyDistr(20,20,60);
     386//    Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
     387 //   Ogre::OverlayContainer* cont = Ogre::OverlayManager::createOverlayElement("Orxonox/HUD1.2/MyShip", "Orxonox/HUD1.2/shieldLeftTop", false);
     388 //   Ogre::OverlayContainer* cont =  Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2/MapBackGround");
     389
     390//    hud::Bar* newBar = Ogre::OverlayManager::createOverlayElement("Element", "ElementName");
     391//new hud::Bar(1,true,Ogre::ColourValue::Black,"Orxonox/hi");
     392 //   cont->addChild(newBar-> element_);
     393//   hud::Bar* newBar = Ogre::OverlayManager::createOverlayElement("orxonox/bar", "orxonox/newbar", false);
     394
     395
     396    Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
     397
     398    Ogre::Overlay* hudOverlay = overlayManager.create("orxonoxsuperoverlay");
     399
     400    hud::Bar* newBar = static_cast<hud::Bar*>(overlayManager.createOverlayElement("Panel", "Bar"));
     401    newBar->setLeft(0);
     402    newBar->setTop(0);
     403    newBar->setWidth(10);
     404    newBar->setHeight(10);
     405    newBar->setMaterialName("Orxonox/Red");
     406    newBar->setMetricsMode(Ogre::GMM_PIXELS);
     407    newBar->setPercentage(0.8);
     408    newBar->show();
     409
     410
     411    Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*> (overlayManager.createOverlayElement("Panel", "PanelName"));
     412    panel->setLeft(10);
     413    panel->setTop(10);
     414    panel->setWidth(100);
     415    panel->setHeight(100);
     416    panel->setMetricsMode(Ogre::GMM_PIXELS);
     417    panel->show();
     418
     419    hudOverlay->add2D(panel);
     420    panel->addChild(newBar);
     421
     422 //   HUD* orxonoxHud;
     423 //   orxonoxHud = new HUD();
     424 //   orxonoxHud->setEnergyValue(20);
     425 //   orxonoxHud->setEnergyDistr(20,20,60);
    389426    hudOverlay->show();
     427
    390428
    391429        /*
Note: See TracChangeset for help on using the changeset viewer.