O'Reilly logo

Monkey Game Development by Michael Hartlef

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — detailing the OnRender method

To determine an FPS value in fantomEngine, a call to its GetFPS method will return the current FPS value, as follows:

  1. Store the output of the GetFPS call in the fps field of the game class.
    Method OnRender:Int()
    fps = eng.GetFPS()
    
  2. Now tell the engine to render its objects.
    eng.Render()
    Return 0
    End
    

What just happened?

Inside the OnRender method, we determine the current frames per second value that indicates how many times the game is able to display the content. We will later create a method to update the corresponding text object called txtFPS. We also told the engine to render all objects in one batch.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required