Revision: 2417
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2417&view=rev
Author:   rorthomas
Date:     2012-01-31 22:48:54 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
smoother FPS limit
removed old code

Modified Paths:
--------------
    trunk/source/main/framework/AppStateManager.cpp
    trunk/source/main/gameplay/RoRFrameListener.cpp

Modified: trunk/source/main/framework/AppStateManager.cpp
===================================================================
--- trunk/source/main/framework/AppStateManager.cpp     2012-01-31 22:14:44 UTC 
(rev 2416)
+++ trunk/source/main/framework/AppStateManager.cpp     2012-01-31 22:48:54 UTC 
(rev 2417)
@@ -7,6 +7,8 @@
 
 #include <OgreLogManager.h>
 
+#include "Settings.h"
+
 using namespace Ogre;
 
 //|||||||||||||||||||||||||||||||||||||||||||||||
@@ -103,11 +105,14 @@
 
        unsigned long timeSinceLastFrame = 1;
        unsigned long startTime          = 0;
-       unsigned long maxFPS             = 10;
        unsigned long minTimePerFrame    = 0;
+       unsigned long maxFPS = ISETTING("Max FPS", 0);
 
-       // TODO: Init 'maxFPS' through a frame limiter slider in the 
configurator
+       
+       // useful or not?
+       Ogre::Root::getSingleton().setFrameSmoothingPeriod(4);
 
+
        if (maxFPS)
        {
                minTimePerFrame = 1000 / maxFPS;
@@ -115,7 +120,7 @@
 
        while(!m_bShutdown)
        {
-               startTime = 
OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
+               startTime = 
OgreFramework::getSingletonPtr()->m_pTimer->getMilliseconds();
 
                // no more actual rendering?
                if(m_bNoRendering)
@@ -128,6 +133,8 @@
 #endif // WIN32
                }
 
+               update(timeSinceLastFrame);
+
                if (maxFPS && timeSinceLastFrame < minTimePerFrame)
                {
                        // Sleep twice as long as we were too fast.
@@ -138,9 +145,8 @@
 #endif // WIN32
                }
 
-               update(timeSinceLastFrame);
 
-               timeSinceLastFrame = 
OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU() - startTime;
+               timeSinceLastFrame = 
OgreFramework::getSingletonPtr()->m_pTimer->getMilliseconds() - startTime;
        }
        LOG("Main loop quit");
 }

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-01-31 22:14:44 UTC 
(rev 2416)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-01-31 22:48:54 UTC 
(rev 2417)
@@ -6289,18 +6289,6 @@
        // TODO: IMPROVE STATS
        if(ow && mStatsOn) ow->updateStats();
 
-#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-               /*
-               // this *could* improve the event handling under windows ...
-               MSG msg;
-               if (PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE )>0)
-               {
-                       TranslateMessage( &msg );
-                       DispatchMessage( &msg );
-               }
-               */
-#endif
-
        //              moveCamera();
 
        // workaround to be able to show a single waiting sign before working 
on the files

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to