diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-09-21 01:43:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-09-21 01:43:42 -0300 |
commit | 11a5ed508b1cbde61a4d9dd4f469e86e74667623 (patch) | |
tree | e4bc1926057d788aeeef3633930bb958eb976d3a /main | |
parent | c5b905fca82f1437486f2168270c5caa0b4bf104 (diff) |
Fixed too many little issues, check the issues closed today.
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/main/main.cpp b/main/main.cpp index 5b1782815e..2d286759d9 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -153,6 +153,7 @@ void Main::print_help(const char* p_binary) { OS::get_singleton()->print("\t-d,-debug : Debug (local stdout debugger).\n"); OS::get_singleton()->print("\t-rdebug ADDRESS : Remote debug (<ip>:<port> host address).\n"); OS::get_singleton()->print("\t-fdelay [msec]: Simulate high CPU load (delay each frame by [msec]).\n"); + OS::get_singleton()->print("\t-timescale [msec]: Simulate high CPU load (delay each frame by [msec]).\n"); OS::get_singleton()->print("\t-bp : breakpoint list as source::line comma separated pairs, no spaces (%%20,%%2C,etc instead).\n"); OS::get_singleton()->print("\t-v : Verbose stdout mode\n"); OS::get_singleton()->print("\t-lang [locale]: Use a specific locale\n"); @@ -420,6 +421,17 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas } + } else if (I->get()=="-timescale") { // resolution + + if (I->next()) { + + OS::get_singleton()->set_time_scale(I->next()->get().to_double()); + N=I->next()->next(); + } else { + goto error; + + } + } else if (I->get() == "-pack") { @@ -1292,6 +1304,8 @@ bool Main::iteration() { time_accum+=step; + float time_scale = OS::get_singleton()->get_time_scale(); + bool exit=false; @@ -1307,15 +1321,15 @@ bool Main::iteration() { Physics2DServer::get_singleton()->sync(); Physics2DServer::get_singleton()->flush_queries(); - if (OS::get_singleton()->get_main_loop()->iteration( frame_slice )) { + if (OS::get_singleton()->get_main_loop()->iteration( frame_slice*time_scale )) { exit=true; break; } message_queue->flush(); - PhysicsServer::get_singleton()->step(frame_slice); - Physics2DServer::get_singleton()->step(frame_slice); + PhysicsServer::get_singleton()->step(frame_slice*time_scale); + Physics2DServer::get_singleton()->step(frame_slice*time_scale); time_accum-=frame_slice; message_queue->flush(); @@ -1328,13 +1342,13 @@ bool Main::iteration() { uint64_t idle_begin = OS::get_singleton()->get_ticks_usec(); - OS::get_singleton()->get_main_loop()->idle( step ); + OS::get_singleton()->get_main_loop()->idle( step*time_scale ); message_queue->flush(); if (SpatialSoundServer::get_singleton()) - SpatialSoundServer::get_singleton()->update( step ); + SpatialSoundServer::get_singleton()->update( step*time_scale ); if (SpatialSound2DServer::get_singleton()) - SpatialSound2DServer::get_singleton()->update( step ); + SpatialSound2DServer::get_singleton()->update( step*time_scale ); if (OS::get_singleton()->can_draw()) { |