Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-01 16:02:51 +0000
committerStijn Buys <ingar@osirion.org>2008-05-01 16:02:51 +0000
commit4e5343ce9aa83a5c0b04bf744dd287fb56ff39fc (patch)
tree2f5944d3426529a973e78137f8ce5a9a29a7c54f /src/client/client.cc
parentf5266b403c50cb2b6d712e6d8f41b62ad2433efb (diff)
various silly fixes
Diffstat (limited to 'src/client/client.cc')
-rw-r--r--src/client/client.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index 2079c71..c607c64 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -4,6 +4,12 @@
the terms and conditions of the GNU General Public License version 2
*/
+#include <SDL/SDL.h>
+
+#include <iostream>
+#include <cmath>
+#include <iomanip>
+
#include "client/chat.h"
#include "client/client.h"
#include "client/video.h"
@@ -13,13 +19,6 @@
#include "client/view.h"
#include "core/core.h"
-// SDL headers
-#include <SDL/SDL.h>
-
-// C++ headers
-#include <iostream>
-#include <cmath>
-
namespace client
{
@@ -128,26 +127,27 @@ void Client::run()
Uint32 client_framerate = (Uint32)(1000/120);
Uint32 elapsed = 0;
-
+
while (true) {
- if (cl_framerate->value())
- client_framerate = (Uint32) (1000.0f / cl_framerate->value());
-
Uint32 chrono = SDL_GetTicks();
core::Application::frame((float)elapsed / 1000.0f);
video::frame((float)elapsed / 1000.0f);
input::frame((float)elapsed / 1000.0f);
- // sleep
Uint32 current = SDL_GetTicks();
-
elapsed = current - chrono;
- if (elapsed < client_framerate) {
- SDL_Delay(client_framerate - elapsed);
- elapsed = client_framerate;
- }
+ if (cl_framerate->value()) {
+ client_framerate = (Uint32) (1000.0f / cl_framerate->value());
+ if (client_framerate && (elapsed < client_framerate)) {
+ SDL_Delay(client_framerate - elapsed);
+ elapsed = client_framerate;
+ }
+ };
+
+ //con_debug << "tick " << std::setw(8) << chrono << " " << std::setw(8) << current << " " << elapsed;
+
}
}