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
36 config_fps.inverse_list = {}
38 local fps_obj = {total_fps=0,frame_count=0,last_check=0,last_frame_time=0,time_delta=0,fall_streak=0,drop=0}
42 while index <= #config_fps.list
do
43 config_fps.inverse_list[config_fps.list[index]] = index
48 local index = config_fps.inverse_list[
game.fps_max]
49 game.milis =
event.uptime()
50 game.fps = fps_obj.total_fps
51 game.dt = fps_obj.time_delta
53 if index <
#config_fps.list then
54 game.fps_max = config_fps.list[index + 1]
57 return config_fps.time[index]
61 fps_controler = fps_controler
local function fps_counter(fps_limit, fps_tracker, current_time)
local function install(std, game, application, config_fps)