Director

Time line hooks

During the regular Director loop there's the scene rendering procedure. In certain situations, the developer may need to perform operations before and/or after the scene rendering process.

There exist two hook points, one before rendering which is called before the scene actors have their behaviors and transformations applied and the other after rendering, which is called after every scene actor has been displayed on screen.

The developer can set such hooks by setting a function onRenderStart and a function onRenderEnd. These both methods will receive a parameter with director's virtual time.

Take into account that this hook points will be called always regardless of the scene being shown.

For example, I'm using an onRenderStart hook to let Box2D run a physics simulation step with this code:

                director.onRenderStart= function(director_time) {
                    this.world.Step(1.0/60, 1,1);
                    this.world.ClearForces();
                };