Difference between revisions of "love.timer.getFPS"

(Clarification.)
Line 11: Line 11:
 
=== Returns ===
 
=== Returns ===
 
{{param|number|fps|The current FPS.}}
 
{{param|number|fps|The current FPS.}}
 +
== Examples ==
 +
Display text at the top left of the screen showing the current FPS.
 +
<source lang="lua">
 +
function love.draw()
 +
  love.graphics.print("Current FPS: "..tostring(love.timer.getFPS()), 10, 10)
 +
end
 +
</source>
 
== See Also ==
 
== See Also ==
 
* [[parent::love.timer]]
 
* [[parent::love.timer]]

Revision as of 16:03, 31 May 2012

Returns the current frames per second.

Displaying the FPS with love.graphics.print or love.graphics.setCaption can have an impact on this value. Keep this in mind while benchmarking your game.

Function

Synopsis

fps = love.timer.getFPS( )

Arguments

None.

Returns

number fps
The current FPS.

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