local font = renderCreateFont('Arial', 10, 0)
local fps = 0.0
function main()
while true do
wait(0)
local step = getTimeStepValue()
if step > 0 then
local current_fps = 50.0 / step
fps = fps == 0.0 and current_fps or fps * 0.9 + current_fps * 0.1
end
local text = string.format('FPS: %d', math.floor(fps + 0.5))
local screen_x, screen_y = getScreenResolution()
local text_width = renderGetFontDrawTextLength(font, text)
renderFontDrawText(
font,
text,
screen_x - text_width - 10,
10,
0xFFFFFFFF
)
end
end