Big Box Cocos2dx-JS learning 01 the n-class = "the Comment"> // tick the before glClear: Issue # 533
if (!this._paused) { this._scheduler.update(this._deltaTime); cc.eventManager.dispatchEvent(this._eventAfterUpdate); }
// executed first task scheduler, and then trigger cc.director.EVENT_AFTER_UPDATE event, check the interactive events, available on the distribution process / * to Avoid Flickr, nextScene the MUST BE here Wallpaper: the before and the After tick Draw. XXX: Which bug . It IS the this One Seems not that IT CAN BE Reproduced with v0.9 * / IF ( the this ._nextScene) { the this .setNextScene (); } // If there is a scene change, then switching // render the current sCENE // Draw SCENE The IF ( the this ._runningScene) { IF (renderer.childrenOrderDirty) { cc.renderer.clearRenderCommands (); cc.renderer.assignedZ = 0 ; the this ._runningScene._renderCmd._curLevel = 0
The Node Draw Notifications // IF ( the this ._notificationNode) the this ._notificationNode.visit (); // traverse the nodes, the nodes update the space transformation matrix, sends commands to the renderer cc.eventManager.dispatchEvent ( the this ._eventAfterVisit); CC. = g_NumberOfDraws 0 ;
renderer.rendering (cc._renderContext); the this ._totalFrames ++; // sort plotted cc.eventManager.dispatchEvent ( the this ._eventAfterDraw); cc.eventManager.frameUpdateListeners (); // update frame rate the this ._calculateMPF (); },
About Drawing Management
About memory management (reference counting)
scheduler
cc.Node related API
1 2 3 4
node.scheduleUpdate() node.update = function (dt) { }
Default Scheduler: Use scheduleUpdate, must override the update function, dt is the time interval
Custom scheduler:
1
node.schedule(callback,inteval,repeate,delay,key)
Callback function (to be), the time interval (default 0), the number of repetitions (default cc.REPEAT_FOREVER), delay time (default 0), the unique identifier
Uninstall Scheduler:
unschedule和unscheduleAllCallbacks
Scene Management
Use stack structure
In a related life cycle function exits, it should be this._super () function on the last call, follow the "last out"
A->B
SceneA before the start SceneB onEixtTransitionDidStart method of execution ctor, so do not do large overhead work in the ctor
Genius
Each sprite generally associated with a texture (Texture2D objects)