aboutsummaryrefslogtreecommitdiff
path: root/src/libjin-lua/scripts/time/time.lua
blob: 4f4a37bccc098a1d741077f2ef4d835f81c3b174 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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