diff options
Diffstat (limited to 'src/libjin-lua/scripts/time/time.lua')
-rw-r--r-- | src/libjin-lua/scripts/time/time.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libjin-lua/scripts/time/time.lua b/src/libjin-lua/scripts/time/time.lua new file mode 100644 index 0000000..61c6ab1 --- /dev/null +++ b/src/libjin-lua/scripts/time/time.lua @@ -0,0 +1,25 @@ + +jin.time = jin.time or {} + +local f = 0 +local fps = 0 +local t = 0 + +jin.time.getFPS = function() + return fps +end + +local step = jin.time.step + +jin.time.step = function() + step() + -- Update fps + t = t + jin.time.getDelta() + if t > 1 then + t = t - 1 + fps = f + 1 + f = 0 + else + f = f + 1 + end +end |