Difference between revisions of "love.timer.getFPS"
m (fixed grammar and minor rephrasing to lead into a technical term better...) |
m (even more minor modifications to wording.) |
||
Line 11: | Line 11: | ||
{{param|number|fps|The current FPS.}} | {{param|number|fps|The current FPS.}} | ||
=== Notes === | === Notes === | ||
− | The returned value is | + | The returned value is the number of frames rendered during the last second, rounded to the nearest integer value.<br> |
+ | It is one divided by what [[love.timer.getAverageDelta]] returns, otherwise known as the reciprocal, or multiplicative inverse of it.<br> | ||
+ | To get instantaneous frame rate values, use <code>1.0 / love.timer.getDelta()</code>, or <code>1.0 / dt</code> if in [[love.update]], with <code>dt</code> given as the parameter. | ||
== Examples == | == Examples == | ||
Display text at the top left of the screen showing the current FPS. | Display text at the top left of the screen showing the current FPS. |
Revision as of 17:27, 9 May 2020
Returns the current number of frames per second.
Contents
Function
Synopsis
fps = love.timer.getFPS( )
Arguments
None.
Returns
number fps
- The current FPS.
Notes
The returned value is the number of frames rendered during the last second, rounded to the nearest integer value.
It is one divided by what love.timer.getAverageDelta returns, otherwise known as the reciprocal, or multiplicative inverse of it.
To get instantaneous frame rate values, use 1.0 / love.timer.getDelta()
, or 1.0 / dt
if in love.update, with dt
given as the parameter.
Examples
Display text at the top left of the screen showing the current FPS.
function love.draw()
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info