Changeset 1451 for code/branches/network/src/orxonox
- Timestamp:
- May 28, 2008, 2:39:46 PM (16 years ago)
- Location:
- code/branches/network/src/orxonox/hud
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/orxonox/hud/HUD.cc
r1450 r1451 48 48 { 49 49 SetConsoleCommandShortcut(HUD, cycleNavigationFocus).setAccessLevel(AccessLevel::User); 50 SetConsoleCommandShortcut(HUD, toggleFPS).setAccessLevel(AccessLevel::User); 51 SetConsoleCommandShortcut(HUD, toggleRenderTime).setAccessLevel(AccessLevel::User); 50 52 51 53 using namespace Ogre; … … 56 58 firstRadarObject = NULL; 57 59 lastRadarObject = NULL; 60 showFPS = true; 61 showRenderTime = true; 58 62 59 63 // create Factories … … 147 151 nav->update(); 148 152 149 float fps = GraphicsEngine::getSingleton().getAverageFPS(); 150 fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps)); 153 setFPS(); 151 154 } 152 155 153 156 void HUD::setRenderTimeRatio(float ratio) 154 157 { 155 rTRText->setCaption("Render time ratio: " + Ogre::StringConverter::toString(ratio)); 158 if(showRenderTime){ 159 rTRText->setCaption("Render time ratio: " + Ogre::StringConverter::toString(ratio)); 160 } 161 else{ 162 rTRText->setCaption(""); 163 return; 164 } 165 } 166 167 void HUD::setFPS(){ 168 if(showFPS){ 169 float fps = GraphicsEngine::getSingleton().getAverageFPS(); 170 fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps)); 171 } 172 else{ 173 fpsText->setCaption(""); 174 return; 175 } 156 176 } 157 177 … … 184 204 HUD::getSingleton().nav->cycleFocus(); 185 205 } 206 207 /*static*/ void HUD::toggleFPS(){ 208 if(HUD::getSingleton().showFPS) HUD::getSingleton().showFPS = false; 209 else HUD::getSingleton().showFPS = true; 210 } 211 212 /*static*/ void HUD::toggleRenderTime(){ 213 if(HUD::getSingleton().showRenderTime) HUD::getSingleton().showRenderTime = false; 214 else HUD::getSingleton().showRenderTime = true; 215 } 186 216 } 187 217 -
code/branches/network/src/orxonox/hud/HUD.h
r1450 r1451 59 59 Navigation* nav; 60 60 61 bool showFPS; 62 bool showRenderTime; 63 61 64 public: 62 65 virtual void tick(float); … … 64 67 RadarObject* getFirstRadarObject(); 65 68 void setRenderTimeRatio(float ratio); 69 void setFPS(); 66 70 67 71 static HUD* instance_s; … … 69 73 static void setEnergy(float value); 70 74 static void cycleNavigationFocus(); 75 static void toggleFPS(); 76 static void toggleRenderTime(); 71 77 }; 72 78 }
Note: See TracChangeset
for help on using the changeset viewer.