- Timestamp:
- Jun 22, 2008, 12:06:55 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/overlays/hud/HUDSpeedBar.cc
r1614 r1615 34 34 namespace orxonox 35 35 { 36 CreateFactory(HUDSpeedBar);36 CreateFactory(HUDSpeedBar); 37 37 38 using namespace Ogre; 38 HUDSpeedBar::HUDSpeedBar() 39 { 40 RegisterObject(HUDSpeedBar); 39 41 40 HUDSpeedBar::HUDSpeedBar() 41 { 42 RegisterObject(HUDSpeedBar); 42 } 43 43 44 } 45 46 HUDSpeedBar::~HUDSpeedBar() 47 { 48 if (this->isInitialized()) 44 HUDSpeedBar::~HUDSpeedBar() 49 45 { 50 46 } 51 }52 47 53 void HUDSpeedBar::tick(float dt) 54 { 55 SpaceShip* ship = SpaceShip::getLocalShip(); 56 if (ship) 48 void HUDSpeedBar::tick(float dt) 57 49 { 58 float v = ship->getVelocity().length(); 59 float vmax = ship->getMaxSpeed(); 60 this->setValue(v/vmax); 50 SpaceShip* ship = SpaceShip::getLocalShip(); 51 if (ship) 52 { 53 float v = ship->getVelocity().length(); 54 float vmax = ship->getMaxSpeed(); 55 this->setValue(v/vmax); 56 } 61 57 } 62 }63 58 }
Note: See TracChangeset
for help on using the changeset viewer.