Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2008, 5:22:33 PM (16 years ago)
Author:
FelixSchulthess
Message:

made HUD singleton

File:
1 edited

Legend:

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

    r1375 r1387  
    4343namespace orxonox
    4444{
     45    ConsoleCommandShortcut(HUD, cycleRadarFocus, AccessLevel::User);
     46
    4547    using namespace Ogre;
    4648
    47     HUD::HUD(int zoom){
     49    HUD::HUD(){
    4850        om = &Ogre::OverlayManager::getSingleton();
    4951
     
    103105        radar->addObject(Vector3(0.0, 4000.0, 0.0));
    104106        radar->addObject(Vector3(0.0, 0.0, 6800.0));
    105         RadarOverlayElement::cycleFocus();
     107    }
     108
     109    HUD::~HUD(){
     110        //todo: clean up objects
    106111    }
    107112
     
    123128    }
    124129
    125     void HUD::setFPS(float fps){
    126         fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps));
     130    /*static*/HUD& HUD::getSingleton(){
     131        static HUD theInstance;
     132        return theInstance;
    127133    }
    128134
    129     HUD::~HUD(void){
     135    /*static*/void HUD::setFPS(float fps){
     136        HUD::getSingleton().fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps));
     137    }
     138
     139    /*static*/void HUD::cycleRadarFocus(){
     140        HUD::getSingleton().radar->cycleFocus();
    130141    }
    131142}
Note: See TracChangeset for help on using the changeset viewer.