love.timer.step now returns the calculated dt directly.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-07-23 19:56:48 -03:00
parent ef5897b22c
commit 2eb9b3bdcd
5 changed files with 10 additions and 11 deletions
+3 -1
View File
@@ -61,7 +61,7 @@ Timer::Timer()
prevFpsUpdate = currTime = getTime();
}
void Timer::step()
double Timer::step()
{
// Frames rendered
frames++;
@@ -84,6 +84,8 @@ void Timer::step()
prevFpsUpdate = currTime;
frames = 0;
}
return dt;
}
void Timer::sleep(double seconds) const
+2 -2
View File
@@ -42,9 +42,9 @@ public:
/**
* Measures the time between this call and the previous call,
* and updates internal values accordinly.
* and updates internal values accordingly.
**/
void step();
double step();
/**
* Tries to sleep for the specified amount of time. The precision is
+3 -3
View File
@@ -30,10 +30,10 @@ namespace timer
#define instance() (Module::getInstance<Timer>(Module::M_TIMER))
int w_step(lua_State *)
int w_step(lua_State *L)
{
instance()->step();
return 0;
lua_pushnumber(L, instance()->step());
return 1;
}
int w_getDelta(lua_State *L)
+1 -2
View File
@@ -535,8 +535,7 @@ function love.run()
-- Update dt, as we'll be passing it to update
if love.timer then
love.timer.step()
dt = love.timer.getDelta()
dt = love.timer.step()
end
-- Call update and draw
+1 -3
View File
@@ -993,10 +993,8 @@ const unsigned char boot_lua[] =
0x69, 0x74, 0x20, 0x74, 0x6f, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x0a,
0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x72, 0x20, 0x74, 0x68,
0x65, 0x6e, 0x0a,
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x65, 0x70,
0x28, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x64, 0x74, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x72,
0x2e, 0x67, 0x65, 0x74, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x28, 0x29, 0x0a,
0x2e, 0x73, 0x74, 0x65, 0x70, 0x28, 0x29, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x09, 0x2d, 0x2d, 0x20, 0x43, 0x61, 0x6c, 0x6c, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x61,
0x6e, 0x64, 0x20, 0x64, 0x72, 0x61, 0x77, 0x0a,