Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1356 for code/branches/hud3


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

added distance display

Location:
code/branches/hud3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud3/bin/levels/sample.oxw

    r1352 r1356  
    1414<Skybox src="Orxonox/StarSkyBox" />
    1515<SpaceShip camera="true" position="0,0,0" scale="10" yawpitchroll="0,0,0" mesh="assff.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" />
    16 <Model position="1500,0,0" scale="10" mesh="tomato.mesh" yawpitchroll="-40,30,0" rotationAxis="1,0,0" rotationRate="-30"/>
     16<Model position="1500,0,100" scale="10" mesh="tomato.mesh" yawpitchroll="-40,30,0" rotationAxis="1,0,0" rotationRate="-30"/>
    1717<Model position="0,4200,0" scale="10" mesh="tomato.mesh" yawpitchroll="-50,60,0" rotationAxis="1,0,0" rotationRate="-30"/>
    1818<Model position="0,0,6800" scale="10" mesh="tomato.mesh" yawpitchroll="-50,-30,0" rotationAxis="1,0,0" rotationRate="-30"/>
  • 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
  • code/branches/hud3/src/orxonox/hud/HUD.h

    r1335 r1356  
    3232#include <string.h>
    3333#include <OgreOverlayElement.h>
     34#include <OgreTextAreaOverlayElement.h>
    3435#include <OgrePrerequisites.h>
    3536
     
    4849            Ogre::Overlay* orxonoxHUD;
    4950            Ogre::OverlayContainer* container;
     51            Ogre::TextAreaOverlayElement* test;
    5052            BarOverlayElement* energyBar;
    5153            BarOverlayElement* speedoBar;
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.cc

    r1354 r1356  
    181181        }
    182182
     183        float RadarOverlayElement::getDist2Focus(){
     184            return((focus_->pos_-shipPos_).length());
     185        }
     186
    183187        float RadarOverlayElement::calcRadius(RadarObject* obj){
    184188            return(acos((currentDir_.dotProduct(obj->pos_ - shipPos_))/
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h

    r1353 r1356  
    7272            void addObject(Vector3 pos);
    7373            void listObjects();
     74            float getDist2Focus();
    7475            float calcRadius(RadarObject* obj);
    7576            float calcPhi(RadarObject* obj);
Note: See TracChangeset for help on using the changeset viewer.