2010/03/10 19:27

[Cocos2d] Cocos2d로 만들어보자 : CCNode 특히, iPhone 프로그래밍

CCNode

Cocos2d 에서의 main element로 모든 클래스의 최상위 클래스이다.
(물론.... CCNode 는 NSObject를 상속 받는다.)

이 녀석이 어떤 녀석인지는
Cocos2d 소스내 CCNode.h 에 제작자가 써놓은 주석을 보는게 가장 좋을듯 하다.


/** CCNode is the main element. Anything thats gets drawn or contains things that get drawn is a CCNode.

 The most popular CCNodes are: CCScene, CCLayer, CCSprite, CCMenu.

 

 The main features of a CCNode are:

 - They can contain other CCnode nodes (addChild, getChildByTag, removeChild, etc)

 - They can schedule periodic callback (schedule, unschedule, etc)

 - They can execute actions (runAction, stopAction, etc)

 

 Some CCNode nodes provide extra functionality for them or their children.

 

 Subclassing a CCNode usually means (one/all) of:

 - overriding init to initialize resources and schedule callbacks

 - create callbacks to handle the advancement of time

 - overriding draw to render the node

 

 Features of CCNode:

 - position

 - scale (x, y)

 - rotation (in degrees)

 - Camera ( using spherical coordinates )

 - GridBase (to do mesh transformations)

 - anchor point

 - size

 - visible

 - z-order

 - openGL z position

 

 Default values:

  - rotation: 0

  - position: (x=0,y=0)

  - scale: (x=1,y=1)

  - contentSize: (x=0,y=0)

  - anchorPoint: (x=0,y=0)

 

 Limitations:

 - A CCNode is a "void" object. It doesn't have a texture

 

 Order in transformations with grid disabled

 - 1) The node will be translated (position)

 - 2) The node will be rotated (rotation)

 - 3) The node will be scaled (scale)

 - 4) The node will be moved according to the camera values (camera)

 

 Order in transformations with grid enabled

 - 1) The node will be translated (position)

 - 2) The node will be rotated (rotation)

 - 3) The node will be scaled (scale)

 - 4) The grid will capture the screen

 - 5) The node will be moved according to the camera values (camera)

 - 6) The grid will render the captured screen

 

 Camera:

 - Each node has a camera. By default it points to the center of the CCNode.

 */


(나도 뭔가 하나 깨작깨작 만들면서 여전히 파악 진행중... 아하하...하...하.....)



{{ 띄엄띄엄 작성중 ... to be continued ... à très bientôt }}

트랙백

이 글과 관련된 글 쓰기 (트랙백 보내기)
TrackbackURL : http://evelyne.egloos.com/tb/3140731 [도움말]

덧글

댓글 입력 영역


[위자드팩토리] 훗