Changeset 1414 for code/branches/network/src/orxonox
- Timestamp:
- May 24, 2008, 10:08:42 PM (17 years ago)
- Location:
- code/branches/network/src/orxonox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/orxonox/GraphicsEngine.h
r1293 r1414 72 72 int getWindowWidth() const; 73 73 int getWindowHeight() const; 74 float getAverageFPS() const 75 { if (renderWindow_) return this->renderWindow_->getAverageFPS(); else return 0.0f; } 74 76 75 77 void windowMoved (Ogre::RenderWindow* rw); -
code/branches/network/src/orxonox/Main.cc
r1293 r1414 36 36 #include <exception> 37 37 38 #include " OrxonoxPlatform.h"38 #include "util/OrxonoxPlatform.h" 39 39 #include "core/SignalHandler.h" 40 40 #include "Orxonox.h" -
code/branches/network/src/orxonox/Orxonox.cc
r1413 r1414 456 456 // Contains the times of recently fired events 457 457 // eventTimes[4] is the list for the times required for the fps counter 458 std::deque<unsigned long> eventTimes[ 4];458 std::deque<unsigned long> eventTimes[3]; 459 459 // Clear event times 460 for (int i = 0; i < 4; ++i)460 for (int i = 0; i < 3; ++i) 461 461 eventTimes[i].clear(); 462 // fill the fps time list with zeros463 for (int i = 0; i < 50; i++)464 eventTimes[3].push_back(0);465 462 466 463 // use the ogre timer class to measure time. … … 478 475 // get current time 479 476 unsigned long now = timer_->getMilliseconds(); 480 eventTimes[3].push_back(now);481 eventTimes[3].erase(eventTimes[3].begin());482 477 483 478 // create an event to pass to the frameStarted method in ogre … … 487 482 488 483 // show the current time in the HUD 489 // orxonoxHUD_->setTime((int)now, 0); 490 // orxonoxHUD_->setRocket2(ogreRoot.getCurrentFrameNumber()); 491 if (eventTimes[3].back() - eventTimes[3].front() != 0) 492 HUD::getSingleton().setFPS(50000.0f/(eventTimes[3].back() - eventTimes[3].front())); 493 494 // Iterate through all Tickables and call their tick(dt) function 484 // HUD::getSingleton().setTime(now); 485 486 // Call those objects that need the real time 495 487 for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) 496 488 it->tick((float)evt.timeSinceLastFrame * this->timefactor_); 497 // Iterate through all TickableReals and call their tick(dt) function489 // Call the scene objects 498 490 for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it) 499 491 it->tick((float)evt.timeSinceLastFrame); 492 // TODO: currently a hack. Somehow the console doesn't work with OrxonoxClass 500 493 orxonoxConsole_->tick((float)evt.timeSinceLastFrame); 501 494 … … 504 497 ogreRoot._fireFrameStarted(evt); 505 498 506 // server still renders at the moment507 //if (mode_ != SERVER)508 499 ogreRoot._updateAllRenderTargets(); // only render in non-server mode 509 500 … … 517 508 // again, just to be sure ogre works fine 518 509 ogreRoot._fireFrameEnded(evt); 519 //msleep(50);520 510 } 521 511 522 if (mode_==CLIENT)512 if (mode_==CLIENT) 523 513 network::Client::getSingleton()->closeConnection(); 524 else if (mode_==SERVER)514 else if (mode_==SERVER) 525 515 server_g->close(); 516 526 517 return true; 527 518 } -
code/branches/network/src/orxonox/OrxonoxPrereqs.h
r1410 r1414 35 35 #define _OrxonoxPrereqs_H__ 36 36 37 #include " OrxonoxPlatform.h"37 #include "util/OrxonoxPlatform.h" 38 38 39 39 //----------------------------------------------------------------------- -
code/branches/network/src/orxonox/OrxonoxStableHeaders.h
r1219 r1414 35 35 #define _OrxonoxStableHeaders_H__ 36 36 37 #include " OrxonoxPlatform.h"37 #include "util/OrxonoxPlatform.h" 38 38 39 39 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC … … 109 109 #include "network/Synchronisable.h" 110 110 111 #include "OrxonoxPlatform.h"112 111 #include "OrxonoxPrereqs.h" 113 112 #include "tools/Timer.h" -
code/branches/network/src/orxonox/hud/HUD.cc
r1411 r1414 38 38 #include "core/ConsoleCommand.h" 39 39 #include "objects/SpaceShip.h" 40 #include "GraphicsEngine.h" 40 41 #include "BarOverlayElement.h" 41 42 #include "RadarObject.h" … … 129 130 130 131 nav->update(); 131 }132 132 133 void HUD::setFPS(float fps){133 float fps = GraphicsEngine::getSingleton().getAverageFPS(); 134 134 fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps)); 135 135 } -
code/branches/network/src/orxonox/hud/HUD.h
r1411 r1414 58 58 public: 59 59 virtual void tick(float); 60 void setFPS(float fps);61 60 void addRadarObject(Vector3 pos); 62 61 RadarObject* getFirstRadarObject();
Note: See TracChangeset
for help on using the changeset viewer.