Sergey_Walter Posted August 18, 2013 Share Posted August 18, 2013 Не могу найти норм функцию для определения фпс, никто не встречал? Нашёл что типо того local iFPS = 0 local iFrames = 0 local iStartTick = getTickCount() function GetFPS( ) return iFPS end addEventHandler('onClientResourceStart', g_ResRoot, function() g_Players = getElementsByType('player') fadeCamera(false,0.0) -- create GUI local screenWidth, screenHeight = guiGetScreenSize() g_dxGUI = { ranknum = dxText:create('', screenWidth - 60, screenHeight - 95, false, 'bankgothic', 2, 'right'), ranksuffix = dxText:create('', screenWidth - 40, screenHeight - 86, false, 'bankgothic', 1), checkpoint = dxText:create('', screenWidth - 15, screenHeight - 54, false, 'bankgothic', 0.8, 'right'), timepassed = dxText:create('0:00:00', screenWidth - 10, screenHeight - 25, false, 'bankgothic', 0.7, 'right'), mapdisplay = dxText:create('SPECTATORS: null', 2, screenHeight - dxGetFontHeight(2.3, 'bankgothic')/2, false, 'bankgothic', 0.55, 'left'), fpsdisplay = dxText:create('FPS: 0', 2, screenHeight - dxGetFontHeight(1.5, 'bankgothic')/2, false, 'bankgothic', 0.55, 'left'), mapdisplay = dxText:create('MAP: none', 2, screenHeight - dxGetFontHeight(0.7, 'bankgothic')/2, false, 'bankgothic', 0.55, 'left') } g_dxGUI.fpsdisplay:text(GetFPS()) addEventHandler( 'onClientRender', root, function() iFrames = iFrames + 1 if getTickCount() - iStartTick >= 1000 then iFPS = iFrames iFrames = 0 iStartTick = getTickCount() end g_dxGUI.fpsdisplay:text(GetFPS()) end ) попроще нет ничего? Link to comment
Kernell Posted August 18, 2013 Share Posted August 18, 2013 Куда проще-то? Последнее событие какраз и считает FPS, остальной кусок кода можно выкинуть - это отображение FPS на экране. local iFPS = 0 local iFrames = 0 local iStartTick = getTickCount() function GetFPS( ) return iFPS end addEventHandler( 'onClientRender', root, function() iFrames = iFrames + 1 if getTickCount() - iStartTick >= 1000 then iFPS = iFrames iFrames = 0 iStartTick = getTickCount() end end ) Link to comment
Sergey_Walter Posted August 18, 2013 Author Share Posted August 18, 2013 Та я думал м.б в мта есть уже встроенная функция типа getFps.. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now