Switch love.timer.sleep to seconds

This commit is contained in:
Bart van Strien
2011-08-28 17:12:59 +02:00
parent 729cce93cd
commit 3d1fac07b2
5 changed files with 8 additions and 9 deletions
+3 -3
View File
@@ -79,10 +79,10 @@ namespace sdl
}
}
void Timer::sleep(int ms)
void Timer::sleep(float seconds)
{
if(ms > 0)
delay(ms);
if(seconds > 0)
delay((int) (seconds*1000));
}
float Timer::getDelta() const
+2 -2
View File
@@ -88,9 +88,9 @@ namespace sdl
/**
* Tries to sleep for the specified amount of time. The precision is
* usually 1ms.
* @param ms The number of milliseconds to sleep for.
* @param seconds The number of seconds to sleep for.
**/
void sleep(int ms);
void sleep(float seconds);
/**
* Gets the time between the last two frames, assuming step is called
+1 -2
View File
@@ -49,8 +49,7 @@ namespace sdl
int w_sleep(lua_State * L)
{
int ms = luaL_checkint(L, 1);
instance->sleep(ms);
instance->sleep((float) luaL_checknumber(L, 1));
return 0;
}
+1 -1
View File
@@ -350,7 +350,7 @@ function love.run()
end
end
if love.timer then love.timer.sleep(1) end
if love.timer then love.timer.sleep(0.001) end
if love.graphics then love.graphics.present() end
end
+1 -1
View File
@@ -586,7 +586,7 @@ const unsigned char boot_lua[] =
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,0x0a,
0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x72, 0x20, 0x74, 0x68,
0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x73, 0x6c, 0x65, 0x65,
0x70, 0x28, 0x31, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a,
0x70, 0x28, 0x30, 0x2e, 0x30, 0x30, 0x31, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73,
0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63,
0x73, 0x2e, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x28, 0x29, 0x20, 0x65, 0x6e, 0x64, 0x0a,0x0a,