diff options
author | chai <chaifix@163.com> | 2018-12-23 01:06:46 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-23 01:06:46 +0800 |
commit | 5b8b5c95589e615afda3f0d67db612b64297c2a0 (patch) | |
tree | 976de20f8a317c1dfb07ed1914ff8bebc4242005 /src/libjin-lua/scripts/time/time.lua | |
parent | 6afaad9b9490d4b70a0bea4a8289cc637194abc7 (diff) |
*shader and time
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 |