Time for action — detailing the OnRender method

We won't change the OnRender method in the game class. We will only change the background color and set the text of the FPS indicator to see how fast our game renders everything:

  1. Add the optional parameters to the CLS statement, which defines a nice orange color background.
    Method OnRender:Int()
    Cls (255,155,0)
    
  2. Then, set the text property of our txtFPS object with the current FPS value.
    txtFPS.SetText("FPS: "+eng.GetFPS())
    eng.Render()
    Return 0
    End
    

What just happened?

The OnRender method is done. We determine the current FPS value inside it, as Monkey is skipping rendering frames if OnUpdate is taking to long. Only here will you get the true FPS value in its traditional meaning.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.178.237