cocos2d-x游戏开发(九)重要的基类CCNode

欢迎转载:http://blog.csdn.net/fylz1125/article/details/8522523


这个CCNode是个很重要的基类,没有理由不把它搞一搞。

首先看下类结构图:


它几乎是所有类的基类,官方注释如下:


CCNode是主要元素。任何一个能被绘制或者包含能被绘制的东西都是一个CCNode。

最常用的CCNode有:CCScene,cclayer,CCSprite,Ccmenu.

一个CCNode的主要特性包括

1.他们能够容纳别的CCNode节点,别如能addChild,getChildByTag,removeChild 。

2.他们能定期的调度回调函数,比如能schedule,unschedule等。

3.他们能执行动作,比如runAciton,stopAction等。

一些节点能给自己或他们的子几点提供一些额外额功能


继承一个CCNode节点通常意味着如下几条:

1.重写init()函数来初始化资源和回调

2.创建回调函数来处理时间片

3.重写draw来绘制节点

另外,一个CCNode是一个看不见对象,他没有纹理。每个节点都有一个Camera,认指向节点的中心点。

看下这个类

  1. classCC_DLLCCNode:publicCCObject
  2. {
  3. protected:
  4. //rotationangle
  5. floatm_fRotationX,m_fRotationY;
  6. //scalingfactors缩放因子
  7. floatm_fScaleX,m_fScaleY;
  8. //openglrealZvertex
  9. floatm_fVertexZ;
  10. //positionofthenode
  11. CCPointm_obPosition;
  12. //skewangles
  13. floatm_fSkewX,m_fSkewY;
  14. //anchorpointinpoints锚点(points形式)
  15. CCPointm_obAnchorPointInPoints;
  16. //anchorpointnormalized(notinpoints)锚点(比例形式)
  17. CCPointm_obAnchorPoint;
  18. //untransformedsizeofthenode
  19. CCSizem_obContentSize;
  20. //transform
  21. CCAffineTransformm_sTransform,m_sInverse;
  22. //aCamera
  23. CCCamera*m_pCamera;
  24. //aGrid
  25. CCGridBase*m_pGrid;
  26. //z-ordervalue
  27. intm_nZOrder;
  28. //arrayofchildren
  29. CCArray*m_pChildren;//关键数组,存子节点
  30. //weakreftoparent
  31. CCNode*m_pParent;//父节点
  32. //atag.anynumberyouwanttoassigntothenode
  33. intm_nTag;//tag标记
  34. //userdatafield
  35. void*m_pUserData;
  36. CCObject*m_pUserObject;
  37. //Shader
  38. CCGLProgram*m_pShaderProgram;//着色器
  39. //Serversidestate
  40. ccGLServerStatem_eGLServerState;
  41. //usedtopreservesequencewhilesortingchildrenwiththesamezOrder
  42. unsignedintm_uOrderOfArrival;
  43. //schedulerusedtoscheduletimersandupdates
  44. CCScheduler*m_pScheduler;//调度器,调度定时器执行一些函数
  45. //ActionManagerusedtohandlealltheactions
  46. CCActionManager*m_pActionManager;//动作管理器,处理所有动作
  47. //Isrunning
  48. boolm_bRunning;//状态标志
  49. boolm_bTransformDirty;
  50. boolm_bInverseDirty;
  51. //isvisible
  52. boolm_bVisible;//是否可见
  53. //Iftrue,theAnchorPointwillbe(0,0)whenyoupositiontheCCNode.
  54. //UsedbycclayerandCCScene
  55. boolm_bIgnoreAnchorPointForPosition;
  56. boolm_bReorderChildDirty;
  57. //Propertiesforscript
  58. //scripthandler
  59. intm_nScriptHandler;
  60. intm_nUpdateScriptHandler;
  61. //scripttype,luaorjavascript
  62. ccScriptTypem_eScriptType;
  63. public:
  64. //getter&setter
  65. /**Thezorderofthenoderelativetoit's"brothers":childrenofthesameparent*/
  66. virtualintgetZOrder();//取得z坐标,相对于同一父节点
  67. virtualvoidsetZOrder(intnZOrder);
  68. /**TherealopenGLZvertex.
  69. DifferencesbetweenopenGLZvertexandcocos2dZorder:
  70. -OpenGLZmodifiestheZvertex,andnottheZorderintherelationbetweenparent-children
  71. -OpenGLZmightrequiretoset2Dprojection
  72. -cocos2dZorderworksOKifallthenodesusesthesameopenGLZvertex.eg:vertexZ=0
  73. @warning:Useitatyourownrisksinceitmightbreakthecocos2dparent-childrenzorder
  74. @sincev0.8
  75. */
  76. virtualfloatgetVertexZ();
  77. virtualvoidsetVertexZ(floatfVertexZ);
  78. /**Thescalefactorofthenode.1.0isthedefaultscalefactor.ItonlymodifiestheXscalefactor.*/
  79. floatgetScaleX();
  80. virtualvoidsetScaleX(floatfScaleX);
  81. /**Thescalefactorofthenode.1.0isthedefaultscalefactor.Itonlymodifiestheyscalefactor.*/
  82. floatgetScaleY();
  83. virtualvoidsetScaleY(floatfScaleY);
  84. /**Position(x,y)ofthenodeinopenGLcoordinates.(0,0)istheleft-bottomcorner.*/
  85. virtualCCPointgetPosition();
  86. virtualvoidsetPosition(constCCPoint&position);
  87. /**TheXskewangleofthenodeindegrees.
  88. ThisangledescribesthesheardistortionintheXdirection.
  89. Thus,itistheanglebetweentheyaxisandtheleftedgeoftheshape
  90. ThedefaultskewXangleis0.PositivevaluesdistortthenodeinaCWdirection.
  91. floatgetSkewX();
  92. virtualvoidsetSkewX(floatfSkewX);
  93. /**Theyskewangleofthenodeindegrees.
  94. Thisangledescribesthesheardistortionintheydirection.
  95. ottomedgeoftheshape
  96. ThedefaultskewYangleis0.Positivevaluesdistortthenodeinaccwdirection.
  97. floatgetSkewY();
  98. virtualvoidsetSkewY(floatfSkewY);
  99. virtualCCArray*getChildren();
  100. /**ACCCameraobjectthatletsyoumovethenodeusingagluLookAt
  101. */
  102. virtualCCCamera*getCamera();
  103. /**ACCGridobjectthatisusedwhenapplyingeffects*/
  104. virtualCCGridBase*getGrid();
  105. virtualvoidsetGrid(CCGridBase*pGrid);
  106. /**Atagusedtoidentifythenodeeasily*/
  107. intgetTag();
  108. virtualvoidsetTag(intnTag);
  109. /**Acustomuserdatapointer*/
  110. virtualvoid*getUserData();
  111. virtualvoidsetUserData(void*pUserData);
  112. /**SimilartouserData,butinsteadofholdingavoid*itholdsanid*/
  113. virtualCCObject*getUserObject();
  114. virtualvoidsetUserObject(CCObject*pUserObject);//retain
  115. /**ShaderProgram
  116. @sincev2.0
  117. virtualCCGLProgram*getShaderProgram();
  118. virtualvoidsetShaderProgram(CCGLProgram*pShaderProgram);
  119. /**usedinternallyforzOrdersorting,don'tchangethismanually*/
  120. virtualunsignedintgetorderOfArrival();
  121. virtualvoidsetorderOfArrival(unsignedintuOrderOfArrival);
  122. /**GLserversidestate
  123. virtualccGLServerStategetGLServerState();
  124. virtualvoidsetGLServerState(ccGLServerStateglServerState);
  125. /**CCActionManagerusedbyalltheactions.
  126. IMPORTANT:IfyousetanewCCActionManager,thenprevIoUslycreatedactionsaregoingtoberemoved.
  127. @sincev2.0
  128. virtualCCActionManager*getActionManager();
  129. virtualvoidsetActionManager(CCActionManager*pActionManager);
  130. /**CCSchedulerusedtoscheduleall"updates"andtimers.
  131. IMPORTANT:IfyousetanewCCScheduler,thenprevIoUslycreatedtimers/updatearegoingtoberemoved.
  132. virtualCCScheduler*getScheduler();
  133. virtualvoidsetScheduler(CCScheduler*pScheduler);
  134. /**Aweakreferencetotheparent*/
  135. virtualCCNode*getParent();
  136. virtualvoidsetParent(CCNode*pParent);
  137. /**anchorPointisthepoinTaroundwhichalltransformationsandpositioningmanipulationstakeplace.
  138. It'slikeapininthenodewhereitis"attached"toitsparent.
  139. TheanchorPointisnormalized,likeapercentage.(0,0)meansthebottom-leftcornerand(1,1)meansthetop-rightcorner.
  140. Butyoucanusevalueshigherthan(1,1)andlowerthan(0,0)too.
  141. ThedefaultanchorPointis(0.5,0.5),soitstartsinthecenterofthenode.
  142. virtualCCPointgetAnchorPoint();
  143. virtualvoidsetAnchorPoint(constCCPoint&anchorPoint);
  144. /**TheanchorPointinabsolutepixels.
  145. Sincev0.8youcanonlyreadit.Ifyouwishtomodifyit,useanchorPointinstead
  146. virtualCCPointgetAnchorPointInPoints();
  147. /**Theuntransformedsizeofthenode.
  148. ThecontentSizeremainsthesamenomatterthenodeisscaledorrotated.
  149. Allnodeshasasize.LayerandScenehasthesamesizeofthescreen.
  150. @sincev0.8
  151. virtualCCSizegetContentSize();
  152. virtualvoidsetContentSize(constCCSize&contentSize);
  153. boolisVisible();
  154. virtualvoidsetVisible(boolvisible);
  155. /**Getthescalefactorofthenode.
  156. @warning:Assertwhenm_fScaleX!=m_fScaleY.
  157. floatgetScale();
  158. /**Thescalefactorofthenode.1.0isthedefaultscalefactor.ItmodifiestheXandYscaleatthesametime.*/
  159. virtualvoidsetScale(floatscale);
  160. /**Therotation(angle)ofthenodeindegrees.0isthedefaultrotationangle.PositivevaluesrotatenodeCW.*/
  161. floatgetRotation();
  162. virtualvoidsetRotation(floatfRotation);
  163. /**Therotation(angle)ofthenodeindegrees.0isthedefaultrotationangle.PositivevaluesrotatenodeCW.ItonlymodifiestheXrotationperformingahorizontalrotationalskew.*/
  164. floatgetRotationX();
  165. virtualvoidsetRotationX(floatfRotaionX);
  166. /**Therotation(angle)ofthenodeindegrees.0isthedefaultrotationangle.PositivevaluesrotatenodeCW.Itonlymodifiestheyrotationperformingaverticalrotationalskew.*/
  167. floatgetRotationY();
  168. virtualvoidsetRotationY(floatfRotationY);
  169. /**whetherornotthenodeisrunning*/
  170. boolisRunning();
  171. boolisIgnoreAnchorPointForPosition();
  172. virtualvoidignoreAnchorPointForPosition(boolisIgnoreAnchorPointForPosition);
  173. /**Getchildrencount*/
  174. unsignedintgetChildrenCount(void);
  175. void_setZOrder(intz);
  176. /**GetscripthandlerforonEnter/onExitevent.*/
  177. inlineintgetScriptHandler(){returnm_nScriptHandler;};
  178. /**get/setPositionforLua(passnumberfasterthanCCPointobject)
  179. luacode:
  180. localpos=node:getPositionLua()--returnCCPointobjectfromC++
  181. localx,y=node:getPosition()--returnx,yvaluesfromC++
  182. localx=node:getPositionX()
  183. localy=node:getPositionY()
  184. node:setPosition(x,y)--passx,yvaluestoC++
  185. node:setPositionX(x)
  186. node:setPositionY(y)
  187. constCCPoint&getPositionLua(void);
  188. voidgetPosition(float*x,float*y);
  189. floatgetPositionX(void);
  190. floatgetPositionY(void);
  191. voidsetPositionX(floatx);
  192. voidsetPositionY(floaty);
  193. voidsetPosition(floatx,87); font-weight:bold; background-color:inherit">floaty);
  194. public:
  195. CCNode(void);
  196. virtual~CCNode(void);
  197. constchar*description(void);
  198. /**allocatesandinitializesanode.
  199. Thenodewillbecreatedas"autorelease".
  200. staticCCNode*create(void);//自动释放对象构造器
  201. //scenemanagement
  202. /**callbackthatiscalledeverytimetheCCNodeentersthe'stage'.
  203. IftheCCNodeentersthe'stage'withatransition,thiscallbackiscalledwhenthetransitionstarts.
  204. DuringonEnteryoucan'ta"sister/brother"node.
  205. virtualvoidonEnter();//回调。如果节点进入时又过渡,那么在过渡开始时调度
  206. /**callbackthatiscalledwhentheCCNodeentersinthe'stage'.
  207. virtualvoidonEnterTransitionDidFinish();//回调,当过渡结束时调用
  208. /**callbackthatiscalledeverytimetheCCNodeleavesthe'stage'.
  209. IftheCCNodeleavesthe'stage'withatransition,0); background-color:inherit">DuringonExityoucan'taccessasiblingnode.
  210. virtualvoidonExit();//回调,节点离开时,如果有过渡,则在过渡结束时调用
  211. virtualvoidonExitTransitionDidStart();//回调,离开时,在过渡开始时调用
  212. /**RegisteronEnter/onExithandlerscriptfunction
  213. ScripthandlerautounregisterafteronEnter().
  214. virtualvoidregisterScriptHandler(intnHandler);
  215. virtualvoidunregisterScriptHandler(void);
  216. //composition:ADD
  217. /**Addsachildtothecontainerwithz-orderas0.
  218. Ifthechildisaddedtoa'running'node,then'onEnter'and'onEnterTransitionDidFinish'willbecalledimmediately.
  219. @sincev0.7.1
  220. virtualvoidaddChild(CCNode*child);//添加一个子节点,认z坐标为0.如果一个子节点被添加一个正在运行的节点,那么这个子节点的onEnter和onEnterTransitionDidFinish会被立即调用
  221. /**Addsachildtothecontainerwithaz-order
  222. virtualvoidaddChild(CCNode*child,87); font-weight:bold; background-color:inherit">intzOrder);//添加一个子节点,设置z坐标
  223. /**Addsachildtothecontainerwithzorderandtag
  224. intzOrder,87); font-weight:bold; background-color:inherit">inttag);//添加子节点,设置z坐标和tag标记
  225. //composition:REMOVE
  226. /**Removeitselffromitsparentnodeforcingacleanup.
  227. Ifthenodeorphan,thennothinghappens.
  228. @sincev2.1
  229. virtualvoidremoveFromParent();//从父节点删除自己,如果没有父节点则什么都不干
  230. /**Removeitselffromitsparentnode.Ifcleanupistrue,thenalsoremoveallactionsandcallbacks.
  231. @sincev0.99.3
  232. virtualvoidremoveFromParentAndCleanup(boolcleanup);//从父节点删除自己,如果cleanup标记为true,则删除其所有动作和回调函数
  233. /**Removesachildfromthecontainerforcingacleanup
  234. @sincev2.1
  235. virtualvoidremoveChild(CCNode*child);//删除一个子节点,强制cleanup为true
  236. /**Removesachildfromthecontainer.Itwillalsocleanupallrunningactionsdependingonthecleanupparameter.
  237. virtualvoidremoveChild(CCNode*child,87); font-weight:bold; background-color:inherit">boolcleanup);
  238. /**Removesachildfromthecontainerbytagvalueforcingacleanup.
  239. virtualvoidremoveChildByTag(inttag);
  240. /**Removesachildfromthecontainerbytagvalue.Itwillalsocleanupallrunningactionsdependingonthecleanupparameter
  241. virtualvoidremoveChildByTag(inttag,0); background-color:inherit">/**Removesallchildrenfromthecontainerforcingacleanup.
  242. virtualvoidremoveAllChildren();//删除所有子节点及其动作和回调,即cleanup强置true
  243. /**Removesallchildrenfromthecontaineranddoacleanupallrunningactionsdependingonthecleanupparameter.
  244. virtualvoidremoveAllChildrenWithCleanup(//composition:GET
  245. /**Getsachildfromthecontainergivenitstag
  246. @returnreturnsaCCNodeobject
  247. @sincev0.7.1
  248. CCNode*getChildByTag(/**Reordersachildaccordingtoanewzvalue.
  249. *ThechildMUSTbealreadyadded.
  250. virtualvoidreorderChild(CCNode*child,87); font-weight:bold; background-color:inherit">intzOrder);
  251. /**performanceimprovement,Sortthechildrenarrayoncebeforedrawing,insteadofeverytimewhenachildisaddedorreordered
  252. don'tcallthismanuallyunlessachildaddedneedstoberemovedinthesameframe*/
  253. virtualvoidsortAllChildren();
  254. /**Stopsallrunningactionsandschedulers
  255. virtualvoidcleanup(void);//停止所有动作和任务调度
  256. //draw
  257. /**Overridethismethodtodrawyourownnode.
  258. ThefollowingGLstateswillbeenabledbydefault:
  259. -glEnableClientState(GL_VERTEX_ARRAY);
  260. -glEnableClientState(GL_COLOR_ARRAY);
  261. -glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  262. -glEnable(GL_TEXTURE_2D);
  263. ANDYOUSHOULDNOTdisABLETHEMAFTERDRAWINGYOURNODE
  264. ButifyouenableanyotherGLstate,youshoulddisableitafterdrawingyournode.
  265. virtualvoiddraw(void);//画自己
  266. /**recursivemethodthatvisititschildrenanddrawthem*/
  267. virtualvoidvisit(void);//递归访问子节点并绘制它们
  268. //transformations
  269. //MARMALADEADDEDTHIS...soITISNOLONGERSPECIFICTOCCSprite
  270. /**updatesthequadaccordingthetherotation,position,scalevalues.*/
  271. virtualvoidupdateTransform(void);
  272. /**performsOpenGLview-matrixtransformationbasedonposition,scale,rotationandotherattributes.*/
  273. voidtransform(void);
  274. /**performsOpenGLview-matrixtransformationofit'sancestors.
  275. Generallytheancestorsarealreadytransformed,butincertaincases(eg:attachingaFBO)
  276. it'snecessarytotransformtheancestorsagain.
  277. @sincev0.7.2
  278. voidtransformAncestors(void);
  279. /**returnsa"local"axisalignedboundingBoxofthenode.
  280. ThereturnedBoxisrelativeonlytoitsparent.
  281. @sincev0.8.2
  282. CCRectboundingBox(void);//返回节点的边框矩形区域,相对于其父节点
  283. //actions
  284. /**Executesanaction,andreturnstheactionthatisexecuted.
  285. Thenodebecomestheaction'starget.
  286. @warningStartingfromv0.8actionsdon'tretaintheirtargetanymore.
  287. @returnAnActionpointer
  288. CCAction*runAction(CCAction*action);//执行一个动作。执行动作的节点将变成动作的target
  289. /**Removesallactionsfromtherunningactionlist*/
  290. voidstopAllActions(void);
  291. /**Removesanactionfromtherunningactionlist*/
  292. voidstopAction(CCAction*action);
  293. /**Removesanactionfromtherunningactionlistgivenitstag
  294. voidstopActionByTag(/**Getsanactionfromtherunningactionlistgivenitstag
  295. @returntheActionthewiththegiventag
  296. CCAction*getActionByTag(/**Returnsthenumbersofactionsthatarerunningplustheonesthatarescheduletorun(actionsinactionsToAddandactionsarrays).
  297. *Composableactionsarecountedas1action.Example:
  298. *Ifyouarerunning1Sequenceof7actions,itwillreturn1.
  299. *Ifyouarerunning7Sequencesof2actions,itwillreturn7.
  300. intnumberOfRunningActions(void);
  301. //timers
  302. /**checkwhetheraselectorisscheduled.*/
  303. boolisScheduled(SEL_SCHEDULEselector);//检测一个选择器是否被调用
  304. /**schedulesthe"update"method.Itwillusetheordernumber0.Thismethodwillbecalledeveryframe.
  305. Scheduledmethodswithalowerordervaluewillbecalledbeforetheonesthathaveahigherordervalue.
  306. Onlyone"update"methodCouldbescheduledpernode.
  307. voidscheduleUpdate(void);//采用0优先级调度update函数,这个函数每一帧都会被执行,优先级数字越小,权重越高,也就越优先调用。每个节点只能有一个update被调度。
  308. /**schedulesthe"update"selectorwithacustompriority.Thisselectorwillbecalledeveryframe.
  309. Scheduledselectorswithalowerprioritywillbecalledbeforetheonesthathaveahighervalue.
  310. Onlyone"update"selectorCouldbescheduledpernode(Youcan'thave2'update'selectors).
  311. voidscheduleUpdateWithPriority(intpriority);//用一个优先级调度update函数,每一帧都调用
  312. /*unschedulesthe"update"method.
  313. voidunscheduleUpdate(void);//停止调度update函数
  314. /**schedulesaselector.
  315. Thescheduledselectorwillbetickedeveryframe
  316. voidschedule(SEL_SCHEDULEselector);//选择器selector每一帧都被调一次
  317. /**schedulesacustomselectorwithanintervaltimeinseconds.
  318. Iftimeis0itwillbetickedeveryframe.
  319. Iftimeis0,itisrecommendedtouse'scheduleUpdate'instead.
  320. Iftheselectorisalreadyscheduled,thentheintervalparameter
  321. willbeupdatedwithoutschedulingitagain.
  322. voidschedule(SEL_SCHEDULEselector,87); font-weight:bold; background-color:inherit">floatinterval);//自定义时间间隔调度选择器selector,比如每秒一次
  323. /**
  324. repeatwillexecutetheactionrepeat+1times,foracontinuesactionusekCCRepeatForever
  325. delayistheamountoftimetheactionwillwaitbeforeexecution
  326. floatinterval,unsignedintrepeat,87); font-weight:bold; background-color:inherit">floatdelay);
  327. Schedulesaselectorthatrunsonlyonce,withadelayof0orlarger
  328. voidscheduleOnce(SEL_SCHEDULEselector,87); font-weight:bold; background-color:inherit">floatdelay);//以一个延迟时间调度回调selector,仅调用一次
  329. /**unschedulesacustomselector.*/
  330. voidunschedule(SEL_SCHEDULEselector);//停止调度自定义的选择器
  331. /**unscheduleallscheduledselectors:customselectors,andthe'update'selector.
  332. Actionsarenotaffectedbythismethod.
  333. @sincev0.99.3
  334. voidunscheduleAllSelectors(void);//停止调用所有选择器,包括自定义的和内置的update
  335. /**resumesallscheduledselectorsandactions.
  336. CalledinternallybyonEnter
  337. voidresumeSchedulerAndActions(void);
  338. /**pausesallscheduledselectorsandactions.
  339. CalledinternallybyonExit
  340. voidpauseSchedulerAndActions(void);
  341. /*Updatewillbecalledautomaticallyeveryframeif"scheduleUpdate"iscalled,andthenodeis"live"
  342. virtualvoidupdate(floatfDelta);//内置的选择器,如果调用了scheduleUpdate,那么这个选择器每一帧都会被调用
  343. //transformationmethods
  344. /**Returnsthematrixthattransformthenode's(local)spacecoordinatesintotheparent'sspacecoordinates.
  345. ThematrixisinPixels.
  346. virtualCCAffineTransformnodetoParentTransform(void);
  347. /**Returnsthematrixthattransformparent'sspacecoordinatestothenode's(local)spacecoordinates.
  348. virtualCCAffineTransformparentToNodeTransform(void);
  349. /**Returnstheworldaffinetransformmatrix.ThematrixisinPixels.
  350. virtualCCAffineTransformnodetoWorldTransform(void);
  351. /**Returnstheinverseworldaffinetransformmatrix.ThematrixisinPixels.
  352. virtualCCAffineTransformworldToNodeTransform(void);
  353. /**ConvertsaPointtonode(local)spacecoordinates.TheresultisinPoints.
  354. CCPointconvertToNodeSpace(constCCPoint&worldPoint);//将世界坐标系的点转换为节点的本地坐标系的点
  355. /**ConvertsaPointtoworldspacecoordinates.TheresultisinPoints.
  356. CCPointconvertToWorldspace(constCCPoint&nodePoint);//将节点的本地坐标系的点转换为世界坐标系的点
  357. treatingthereturned/receivednodepointasanchorrelative.
  358. CCPointconvertToNodeSpaceAR(constCCPoint&worldPoint);//将世界坐标系的点转换为基于锚点的节点本地坐标系的点
  359. /**ConvertsalocalPointtoworldspacecoordinates.TheresultisinPoints.
  360. treatingthereturned/receivednodepointasanchorrelative.
  361. CCPointconvertToWorldspaceAR(constCCPoint&nodePoint);//将基于锚点的节点的本地坐标系的点转换为世界坐标系的点
  362. /**conveniencemethodswhichtakeaCCTouchinsteadofCCPoint
  363. CCPointconvertTouchToNodeSpace(CCTouch*touch);//将一个屏幕坐标系的touch转换为节点的本地坐标系的点
  364. /**convertsaCCTouch(worldcoordinates)intoalocalcoordinate.ThismethodisAR(AnchorRelative).
  365. CCPointconvertTouchToNodeSpaceAR(CCTouch*touch);
  366. /**Schedulesforscript.*/
  367. voidscheduleUpdateWithPriorityLua(intnHandler,87); font-weight:bold; background-color:inherit">intpriority);

其中有有些较重要的成员变量和函数,做了注释,后面陆续写写。

相关文章

    本文实践自 RayWenderlich、Ali Hafizji 的文章《...
Cocos-code-ide使用入门学习地点:杭州滨江邮箱:appdevzw@1...
第一次開始用手游引擎挺激动!!!进入正题。下载资源1:从C...
    Cocos2d-x是一款强大的基于OpenGLES的跨平台游戏开发...
1.  来源 QuickV3sample项目中的2048样例游戏,以及最近《...
   Cocos2d-x3.x已经支持使用CMake来进行构建了,这里尝试...