Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2008, 1:05:53 PM (16 years ago)
Author:
FelixSchulthess
Message:

added distance display

File:
1 edited

Legend:

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

    r1352 r1356  
    3333#include <OgreSceneNode.h>
    3434#include <OgreEntity.h>
     35#include <OgreStringConverter.h>
    3536#include "core/Debug.h"
    3637#include "objects/SpaceShip.h"
     
    5556        orxonoxHUD = om->create("Orxonox/HUD");
    5657        container = static_cast<Ogre::OverlayContainer*>(om->createOverlayElement("Panel", "Orxonox/HUD/container"));
     58        // test
     59        test = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "test123"));
     60        test->show();
     61        test->setMetricsMode(Ogre::GMM_RELATIVE);
     62        test->setDimensions(0.8, 0.8);
     63        test->setPosition(0.02, 0.02);
     64        test->setFontName("Console");
     65        test->setCaption("init");
     66
    5767        // create energy bar
    5868        energyBar = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "energyBar"));
     
    7585        container->setHeight(1.0);
    7686        container->setMetricsMode(Ogre::GMM_RELATIVE);
     87        container->addChild(test);
    7788        energyBar->init(0.01, 0.94, 0.4, container);
    7889        energyBar->setValue(1);
    7990        speedoBar->init(0.01, 0.90, 0.4, container);
    8091        radar->init(0.5, 0.9, 0.2, container);
    81         radar->addObject(Vector3(1500.0, 0.0, 0.0));
     92        radar->addObject(Vector3(1500.0, 0.0, 100.0));
    8293        radar->addObject(Vector3(0.0, 4000.0, 0.0));
    83         radar->addObject(Vector3(0.0, 0.0, 6800.0));
     94        radar->addObject(Vector3(0.0, 0.0, 6800.0));
    8495        RadarOverlayElement::cycleFocus();
    8596    }
     
    8798    void HUD::tick(float dt)
    8899    {
     100        int d = radar->getDist2Focus()/10;
     101        test->setCaption("Distance: " + Ogre::StringConverter::toString(d));
     102
    89103        energyBar->resize();
    90104
Note: See TracChangeset for help on using the changeset viewer.