[Cocos2D-X] A Brief Description of internal functions in Cocos2D-X

Source: Internet
Author: User

Introduction to internal functions in Cocos2D-X

Although, Cocos2D-X has been on fire for a long time. However, there are still a lot of students just come into contact with Cocos2D-X, they are Cocos2D-X of some of the engine internal basic functions, not very familiar with, so today we will introduce these functions.

Virtual bool isVisible (); // whether it is visible
Virtual void setVisible (bool visible); // you can specify whether the image is visible.
Bool isRunning (); // whether the node is allowed
Bool isIgnoreAnchorPointForPosition (); // if it is true, the coordinate of the node anchor is (0, 0)
Void ignoreAnchorPointForPosition (bool isIgnoreAnchorPointForPosition); // you can specify whether to ignore the coordinate of the anchor.
Static CCNode * create (void); // creates a CCNode object, which has the function of automatically releasing objects.
The callback function when the virtual void onEnter (); // node enters the stage.
Virtual void onEnterTransitionDidFinish (); // callback function after the node is included in the stage
Virtual void onExit (); // callback function after the node leaves the stage
Virtual void onExitTransitionDidStart (); // callback function when the node leaves the stage
Virtual void registerScriptHandler (int nHandler); // registers the onEnter and onExit script processing functions. After onEnter runs, the script processing function automatically cancels registration.
Virtual void unregisterScriptHandler (void); // cancel the registration of the script processing function
Virtual void addChild (CCNode * child); // Add a subnode. The zcoordinate is 0. If the child node is appended to a running node, the onEnter and onEnterTransitionDidFinish functions will be called immediately.
Virtual void addChild (CCNode * child, int zOrder); // Add a subnode. The zcoordinate is zOrder. If it is attached to a running node, the same as above
Virtual void addChild (CCNode * child, int zOrder, int tag); // Add a subnode. The zcoordinate is zOrder, And the tag is the flag. If it is attached to a running node, the same as above.
Void removeFromParentAndCleanup (bool cleanup); // delete yourself from the parent node. If the cleanup parameter is true, delete all actions and callback functions. If the current node has no parent node, no operation is performed.
Virtual void removeChild (CCNode * child, bool cleanup); // delete a subnode. Delete running actions based on the cleanup Parameter
Void removeChildByTag (int tag, bool cleanup); // deletes a subnode Based on the tag value.
Virtual void removeAllChildrenWithCleanup (bool cleanup); // deletes all child nodes and deletes them according to the cleanup parameter */
CCNode * getChildByTag (int tag); // obtain the subnode Based on the tag value. The returned value is of the CCNode type.
Virtual void reorderChild (CCNode * child, int zOrder); // sort the subnodes by zOrder. The subnodes must have been attached to the current node.
Virtual void sortAllChildren (); // sorts the child nodes before being drawn, rather than when the child nodes are added or decreased each time. Do not manually call this method unless the subnode is deleted after being attached to the same frame.
Virtual void cleanup (void); // stop all running actions and timers
Virtual void draw (void); // You can reload this function to draw nodes.
Virtual void visit (void); // recursively access subnodes and draw them
CCAction * runAction (CCAction * action); // run the specified action
Void stopAllActions (void); // delete all actions from the running action list to stop all actions
Void stopAction (CCAction * action); // stop the specified action
Void stopActionByTag (int tag); // stop the action specified by the parameter tag
CCAction * getActionByTag (int tag); // obtain the action specified by the parameter tag
Unsigned int numberOfRunningActions (void); // Number of running actions, which is the number of running actions plus the number of actions scheduled by the timer. Combined actions, such as sequential actions, are calculated as an action.
Bool isScheduled (SEL_SCHEDULE selector); // checks whether the selector specified by the selector parameter is scheduled
Void scheduleUpdate (void); // scheduled update method. Its serial number is 0. Once scheduled, the update method is called every frame. The timer with a smaller serial number is scheduled first. Each node can have only one update method at a time.
Void scheduleUpdateWithPriority (int priority); // Scheduled update selector for custom priority. The update selector is called once every frame. The smaller the priority, the more advanced scheduling. Each node can have only one update selector at a time.
Void unscheduleUpdate (void); // cancel scheduled update
Void schedule (SEL_SCHEDULE selector); // scheduled a selector, called once per frame
Void schedule (SEL_SCHEDULE selector, float interval); // scheduled a custom selector. The interval parameter is a time interval in seconds. If interval is 0, the scheduleUpdate method is recommended when each frame is called ). If the selector has been scheduled, only the time interval is updated, but the timer is not repeated.
Void schedule (SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay); // The repeat action is executed more than once. If repeated, the repeat parameter is set to kCCRepeatForever. The delay parameter specifies the delay time before the action is executed.
Void scheduleOnce (SEL_SCHEDULE selector, float delay); // a timer that only runs once
Void unschedule (SEL_SCHEDULE selector); // cancels a timer selector.
Void unscheduleAllSelectors (void); // cancel all timers, including the update selector. Action not affected
Void resumeSchedulerAndActions (void); // restores all timer and action, called internally by onEnter
Void pauseSchedulerAndActions (void); // pause all timer and action, called internally by onExit

Now, we will introduce you here today. If you have any questions or want to learn, you can leave a message directly.

CocoStudio discussion and learning group:141444261

Cocos2D-X discussion Learning Group:244959010

 

This article from the "Zhang Pengfei" blog, please be sure to keep this source http://502317120.blog.51cto.com/4062300/1191871

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.