XPLMFlightLoop f

From X-Plane SDK
Jump to: navigation, search

XPLMFlightLoop_f

typedef float (* XPLMFlightLoop_f)(
                                   float                inElapsedSinceLastCall,    
                                   float                inElapsedTimeSinceLastFlightLoop,    
                                   int                  inCounter,    
                                   void *               inRefcon);    

This is your flight loop callback. Each time the flight loop is iterated through, you receive this call at the end. You receive a time since you were last called and a time since the last loop, as well as a loop counter. The 'phase' parameter is deprecated and should be ignored.

Your return value controls when you will next be called. Return 0 to stop receiving callbacks. Pass a positive number to specify how many seconds until the next callback. (You will be called at or after this time, not before.) Pass a negative number to specify how many loops must go by until you are called. For example, -1.0 means call me the very next loop. Try to run your flight loop as infrequently as is practical, and suspend it (using return value 0) when you do not need it; lots of flight loop callbacks that do nothing lowers x-plane's frame rate.

Your callback will NOT be unregistered if you return 0; it will merely be inactive.

The reference constant you passed to your loop is passed back to you.