mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Switch love.timer.sleep to seconds
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user