1local function
fps_counter(fps_limit, fps_tracker, current_time)
2 if current_time >= fps_tracker.last_check + 1000 then
3 fps_tracker.last_check = current_time
4 fps_tracker.total_fps = fps_tracker.frame_count
5 fps_tracker.frame_count = 0
7 if fps_tracker.drop_count == 0 then
11 if fps_tracker.total_fps + fps_tracker.drop_count > fps_limit then
12 fps_tracker.fall_streak = 0
16 fps_tracker.fall_streak = fps_tracker.fall_streak + 1
18 if fps_tracker.fall_streak >= fps_tracker.allowed_falls then
19 fps_tracker.fall_streak = 0
24 fps_tracker.frame_count = fps_tracker.frame_count + 1
25 fps_tracker.time_delta = current_time - fps_tracker.last_frame_time
26 fps_tracker.last_frame_time = current_time
35 config_fps.inverse_list = {}
37 local fps_obj = {total_fps=0,frame_count=0,last_check=0,last_frame_time=0,time_delta=0,fall_streak=0,drop=0}
41 while index <= #config_fps.list
do
42 config_fps.inverse_list[config_fps.list[index]] = index
47 local index = config_fps.inverse_list[
game.fps_max]
48 game.milis =
event.uptime()
49 game.fps = fps_obj.total_fps
50 game.dt = fps_obj.time_delta
52 if index <
#config_fps.list then
53 game.fps_max = config_fps.list[index + 1]
56 return config_fps.time[index]
60 fps_controler = fps_controler
local function install(std, game, application)
local function fps_counter(fps_limit, fps_tracker, current_time)