Time for action — experimenting with the FrameListener implementation

Using the console printing we are going to inspect when the FrameListener is called.

  1. First let each function print a message to the console when it is called:
    bool frameStarted(const Ogre::FrameEvent& evt)
    {
    std::cout << «Frame started» << std::endl;
    return false;
    }
    bool frameEnded(const Ogre::FrameEvent& evt)
    {
    std::cout << «Frame ended» << std::endl;
    return false;
    }
    bool frameRenderingQueued(const Ogre::FrameEvent& evt)
    {
    std::cout << «Frame queued» << std::endl;
    return false;
    }
    
  2. Compile and run the application; in the console you should find the first string Frame started.

What just happened?

We added a "debug" output to each of the FrameListener functions to see which function is getting called. Running the application, we noticed that only the first debug message is printed. The reason is that the frameStarted function returns false, which is a signal for the root instance to close the application.

What just happened?

Now that we know what happens when frameStarted() returns false, let's see what happens when frameStarted() returns true.

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

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