showFPS

The showFPS family of functions allow you to have an fps counter drawn to the bottom left of the screen. This is drawn on top of your game, automatically, on every frame.

'FPS' stands for 'frames per second', and is the number of frames that your game is currently running at. This allows you to tell how fast, or slow, your game is running.

Calling this turns the counter on or off, and so does not need to be called on every frame.

showFPS( show = true, editorOnly = true )

Calling this with no parameters will permanently display the FPS counter, but only when running your game in the editor. This allows you to keep the call in your code, when you publish your game.

showFPS()

onEachFrame()
    // fps counter is displayed on top of my code
end

The first 'show' parameter gives you the option to show or hide the FPS counter, depending on if this is true (to show) or false (to hide). This defaults to true.

// press 'a' to show the FPS counter, and 'z' to hide it
onEachFrame()
    c = getControls()

    if c.isKeyDown( :a )
        showFPS( true )
    else if c.isKeyDown( :z )
        showFPS( false )
    end
end

The second parameter gives you the option to show this only in the editor, or in both the editor and when played in the game player.

showFPS( true, false )

onEachFrame()
    // fps counter is displayed in both editor and game player
end

See also

getFPS