cocos2d引擎代码阅读心得(一)

cocos2d心得(一)

1.成员属性的初始化
@interface CCNode : NSObject
{
	BOOL isTransformDirty_1:1;
}
@end

2.skewX + skewY
	倾斜,简单理解:把矩形图片编程平行四边形图片
	似乎可以用这点做点立体效果
	skewX、skewY分别表示平行四边形上下边x方向相差的points数、左右边y方向相差的points数

3.成员属性和property
@interface CCNode : NSObject
{
	float vertexZ_;
}
@property (nonatomic, readwrite) float vertexZ;
@end
@implementation CCNode
@synthesize vertexZ = vertexZ_;
@end

4.property的设置
	全为nonatomic
	读写权限要么为readwrite,要么为readonly
	在读写权限为readwrite时,有时候增加assign或者retain

5.父子节点
	父节点为CCNode *;
	子节点为CCArray *;

6.遗留的问题:isTransformDirty_、isInverseDirty_、isTransformGLDirty_在cocos2d中是如何被使用的?CCGridBase有何用?

7.如何理解contentSize?
	没多大用处
	参考 http://www.cnblogs.com/ketmales/archive/2013/01/26/2877558.html

8.如何提供get方法
	1.@property
	2.直接提供方法-(int) getValue;
	3.提供方法-(void) upX:(float *)x upY:(float*)y upZ:(float*)z;

9.CCCamera的成员属性
	1.position of eye
	2.position of target
	3.direction of up
	4. dirty

10.weakref - weak reference
	第一次听到这个词,mark 一下
	// weakref to parent
	CCNode *parent_;
原文地址:https://www.cnblogs.com/ketmales/p/2877561.html