Cocos2d-x-3.1 macro

Source: Internet
Author: User
Using these macros in code can reduce the number of times you press the keyboard and improve the writing efficiency. Nodes related to node Properties

Using these macros in code can reduce the number of times you press the keyboard and improve the writing efficiency. CC_PROPERTY_READONLY cc_property_readty_readonly_pass_by_ref CC_PROPERTY CC_PROPERTY_PASS_BY_REF CC_SYNTHESIZE_READONLY CC_SYNTHESIZE_READONLY_PASS_BY_REF C

Using these macros in code can reduce the number of times you press the keyboard and improve the writing efficiency.

Node attributes
CC_PROPERTY_READONLY
CC_PROPERTY_READONLY_PASS_BY_REF
CC_PROPERTY
CC_PROPERTY_PASS_BY_REF
CC_SYNTHESIZE_READONLY
CC_SYNTHESIZE_READONLY_PASS_BY_REF
CC_SYNTHESIZE
CC_SYNTHESIZE_PASS_BY_REF
CC_SYNTHESIZE_RETAIN

For specific definitions, see CCPlatformMacros. h. These are mainly used to simulate keywords such as @ property, readonly, retain, @ synthesize in objective-C.

Related to namespaces
NS_CC_BEGIN
NS_CC_END
USING_NS_CC
For specific definitions, see CCPlatformMacros. h. Related to the node creation method (node, create)
CREATE_FUNC
NODE_FUNC
For specific definitions, see CCPlatformMacros. h. Related to memory management
CC_SAFE_DELETE
CC_SAFE_DELETE_ARRAY
CC_SAFE_FREE
CC_SAFE_RELEASE
CC_SAFE_RELEASE_NULL
CC_SAFE_RETAIN

Logs

CCLOG
CCLOGERROR
CCLOGINFO
CCLOGWARN
For specific definitions, see CCPlatformMacros. h. Assertions
CC_BREAK_IF
CC_ASSERT
CCAssert

CC_BREAK_IF is defined in CCPlatformMacros. h and is used for condition judgment in the loop.

CC_BREAK_IF is frequently used in do {} while (0. The function of using statement blocks is quite large. According to GOOGLE's programming specifications, in order to reduce the code hierarchy, the condition judgment should be performed first. If it does not meet the requirements, the subsequent code will be skipped. There are two methods to skip. One is return and the other is break. In the previous method, all subsequent Code cannot be executed; in the latter method, it must be placed in a loop or swich statement block. If do {} while (0) is used, the problem that the Code following the first method cannot be executed can be solved.

CCAssert is defined in ccMacros. h, which encapsulates CC_ASSERT. Related to mathematics

CCRANDOM_MINUS1_1
CCRANDOM_0_1
CC_DEGREES_TO_RADIANS
CC_RADIANS_TO_DEGREES
For specific definitions, see ccMacros. h. Converts random numbers to radians and degrees.

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.