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

前端之家收集整理的这篇文章主要介绍了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. ThedefaultskewYangleis0.PositivevaluesdistortthenodeinaCCWdirection.
  96. floatgetSkewY();
  97. virtualvoidsetSkewY(floatfSkewY);
  98. virtualCCArray*getChildren();
  99. /**ACCCameraobjectthatletsyoumovethenodeusingagluLookAt
  100. */
  101. virtualCCCamera*getCamera();
  102. /**ACCGridobjectthatisusedwhenapplyingeffects*/
  103. virtualCCGridBase*getGrid();
  104. virtualvoidsetGrid(CCGridBase*pGrid);
  105. /**Atagusedtoidentifythenodeeasily*/
  106. intgetTag();
  107. virtualvoidsetTag(intnTag);
  108. /**Acustomuserdatapointer*/
  109. virtualvoid*getUserData();
  110. virtualvoidsetUserData(void*pUserData);
  111. /**SimilartouserData,butinsteadofholdingavoid*itholdsanid*/
  112. virtualCCObject*getUserObject();
  113. virtualvoidsetUserObject(CCObject*pUserObject);//retain
  114. /**ShaderProgram
  115. @sincev2.0
  116. virtualCCGLProgram*getShaderProgram();
  117. virtualvoidsetShaderProgram(CCGLProgram*pShaderProgram);
  118. /**usedinternallyforzOrdersorting,don'tchangethismanually*/
  119. virtualunsignedintgetOrderOfArrival();
  120. virtualvoidsetOrderOfArrival(unsignedintuOrderOfArrival);
  121. /**GLserversidestate
  122. virtualccGLServerStategetGLServerState();
  123. virtualvoidsetGLServerState(ccGLServerStateglServerState);
  124. /**CCActionManagerusedbyalltheactions.
  125. IMPORTANT:IfyousetanewCCActionManager,thenprevIoUslycreatedactionsaregoingtoberemoved.
  126. @sincev2.0
  127. virtualCCActionManager*getActionManager();
  128. virtualvoidsetActionManager(CCActionManager*pActionManager);
  129. /**CCSchedulerusedtoscheduleall"updates"andtimers.
  130. IMPORTANT:IfyousetanewCCScheduler,thenprevIoUslycreatedtimers/updatearegoingtoberemoved.
  131. virtualCCScheduler*getScheduler();
  132. virtualvoidsetScheduler(CCScheduler*pScheduler);
  133. /**Aweakreferencetotheparent*/
  134. virtualCCNode*getParent();
  135. virtualvoidsetParent(CCNode*pParent);
  136. /**anchorPointisthepointaroundwhichalltransformationsandpositioningmanipulationstakeplace.
  137. It'slikeapininthenodewhereitis"attached"toitsparent.
  138. TheanchorPointisnormalized,likeapercentage.(0,0)meansthebottom-leftcornerand(1,1)meansthetop-rightcorner.
  139. Butyoucanusevalueshigherthan(1,1)andlowerthan(0,0)too.
  140. ThedefaultanchorPointis(0.5,0.5),soitstartsinthecenterofthenode.
  141. virtualCCPointgetAnchorPoint();
  142. virtualvoidsetAnchorPoint(constCCPoint&anchorPoint);
  143. /**TheanchorPointinabsolutepixels.
  144. Sincev0.8youcanonlyreadit.Ifyouwishtomodifyit,useanchorPointinstead
  145. virtualCCPointgetAnchorPointInPoints();
  146. /**Theuntransformedsizeofthenode.
  147. ThecontentSizeremainsthesamenomatterthenodeisscaledorrotated.
  148. Allnodeshasasize.LayerandScenehasthesamesizeofthescreen.
  149. @sincev0.8
  150. virtualCCSizegetContentSize();
  151. virtualvoidsetContentSize(constCCSize&contentSize);
  152. boolisVisible();
  153. virtualvoidsetVisible(boolvisible);
  154. /**Getthescalefactorofthenode.
  155. @warning:Assertwhenm_fScaleX!=m_fScaleY.
  156. floatgetScale();
  157. /**Thescalefactorofthenode.1.0isthedefaultscalefactor.ItmodifiestheXandYscaleatthesametime.*/
  158. virtualvoidsetScale(floatscale);
  159. /**Therotation(angle)ofthenodeindegrees.0isthedefaultrotationangle.PositivevaluesrotatenodeCW.*/
  160. floatgetRotation();
  161. virtualvoidsetRotation(floatfRotation);
  162. /**Therotation(angle)ofthenodeindegrees.0isthedefaultrotationangle.PositivevaluesrotatenodeCW.ItonlymodifiestheXrotationperformingahorizontalrotationalskew.*/
  163. floatgetRotationX();
  164. virtualvoidsetRotationX(floatfRotaionX);
  165. /**Therotation(angle)ofthenodeindegrees.0isthedefaultrotationangle.PositivevaluesrotatenodeCW.ItonlymodifiestheYrotationperformingaverticalrotationalskew.*/
  166. floatgetRotationY();
  167. virtualvoidsetRotationY(floatfRotationY);
  168. /**whetherornotthenodeisrunning*/
  169. boolisRunning();
  170. boolisIgnoreAnchorPointForPosition();
  171. virtualvoidignoreAnchorPointForPosition(boolisIgnoreAnchorPointForPosition);
  172. /**Getchildrencount*/
  173. unsignedintgetChildrenCount(void);
  174. void_setZOrder(intz);
  175. /**GetscripthandlerforonEnter/onExitevent.*/
  176. inlineintgetScriptHandler(){returnm_nScriptHandler;};
  177. /**get/setPositionforLua(passnumberfasterthanCCPointobject)
  178. luacode:
  179. localpos=node:getPositionLua()--returnCCPointobjectfromC++
  180. localx,y=node:getPosition()--returnx,yvaluesfromC++
  181. localx=node:getPositionX()
  182. localy=node:getPositionY()
  183. node:setPosition(x,y)--passx,yvaluestoC++
  184. node:setPositionX(x)
  185. node:setPositionY(y)
  186. constCCPoint&getPositionLua(void);
  187. voidgetPosition(float*x,float*y);
  188. floatgetPositionX(void);
  189. floatgetPositionY(void);
  190. voidsetPositionX(floatx);
  191. voidsetPositionY(floaty);
  192. voidsetPosition(floatx,87); font-weight:bold; background-color:inherit">floaty);
  193. public:
  194. CCNode(void);
  195. virtual~CCNode(void);
  196. constchar*description(void);
  197. /**allocatesandinitializesanode.
  198. Thenodewillbecreatedas"autorelease".
  199. staticCCNode*create(void);//自动释放对象构造器
  200. //scenemanagement
  201. /**callbackthatiscalledeverytimetheCCNodeentersthe'stage'.
  202. IftheCCNodeentersthe'stage'withatransition,thiscallbackiscalledwhenthetransitionstarts.
  203. DuringonEnteryoucan'ta"sister/brother"node.
  204. virtualvoidonEnter();//回调。如果节点进入时又过渡,那么在过渡开始时调度
  205. /**callbackthatiscalledwhentheCCNodeentersinthe'stage'.
  206. virtualvoidonEnterTransitionDidFinish();//回调,当过渡结束时调用
  207. /**callbackthatiscalledeverytimetheCCNodeleavesthe'stage'.
  208. IftheCCNodeleavesthe'stage'withatransition,0); background-color:inherit">DuringonExityoucan'taccessasiblingnode.
  209. virtualvoidonExit();//回调,节点离开时,如果有过渡,则在过渡结束时调用
  210. virtualvoidonExitTransitionDidStart();//回调,离开时,在过渡开始时调用
  211. /**RegisteronEnter/onExithandlerscriptfunction
  212. ScripthandlerautounregisterafteronEnter().
  213. virtualvoidregisterScriptHandler(intnHandler);
  214. virtualvoidunregisterScriptHandler(void);
  215. //composition:ADD
  216. /**Addsachildtothecontainerwithz-orderas0.
  217. Ifthechildisaddedtoa'running'node,then'onEnter'and'onEnterTransitionDidFinish'willbecalledimmediately.
  218. @sincev0.7.1
  219. virtualvoidaddChild(CCNode*child);//添加一个子节点,默认z坐标为0.如果一个子节点被添加到一个正在运行的节点,那么这个子节点的onEnter和onEnterTransitionDidFinish会被立即调用
  220. /**Addsachildtothecontainerwithaz-order
  221. virtualvoidaddChild(CCNode*child,87); font-weight:bold; background-color:inherit">intzOrder);//添加一个子节点,设置z坐标
  222. /**Addsachildtothecontainerwithzorderandtag
  223. intzOrder,87); font-weight:bold; background-color:inherit">inttag);//添加子节点,设置z坐标和tag标记
  224. //composition:REMOVE
  225. /**Removeitselffromitsparentnodeforcingacleanup.
  226. Ifthenodeorphan,thennothinghappens.
  227. @sincev2.1
  228. virtualvoidremoveFromParent();//从父节点删除自己,如果没有父节点则什么都不干
  229. /**Removeitselffromitsparentnode.Ifcleanupistrue,thenalsoremoveallactionsandcallbacks.
  230. @sincev0.99.3
  231. virtualvoidremoveFromParentAndCleanup(boolcleanup);//从父节点删除自己,如果cleanup标记为true,则删除其所有动作和回调函数
  232. /**Removesachildfromthecontainerforcingacleanup
  233. @sincev2.1
  234. virtualvoidremoveChild(CCNode*child);//删除一个子节点,强制cleanup为true
  235. /**Removesachildfromthecontainer.Itwillalsocleanupallrunningactionsdependingonthecleanupparameter.
  236. virtualvoidremoveChild(CCNode*child,87); font-weight:bold; background-color:inherit">boolcleanup);
  237. /**Removesachildfromthecontainerbytagvalueforcingacleanup.
  238. virtualvoidremoveChildByTag(inttag);
  239. /**Removesachildfromthecontainerbytagvalue.Itwillalsocleanupallrunningactionsdependingonthecleanupparameter
  240. virtualvoidremoveChildByTag(inttag,0); background-color:inherit">/**Removesallchildrenfromthecontainerforcingacleanup.
  241. virtualvoidremoveAllChildren();//删除所有子节点及其动作和回调,即cleanup强置true
  242. /**Removesallchildrenfromthecontaineranddoacleanupallrunningactionsdependingonthecleanupparameter.
  243. virtualvoidremoveAllChildrenWithCleanup(//composition:GET
  244. /**Getsachildfromthecontainergivenitstag
  245. @returnreturnsaCCNodeobject
  246. @sincev0.7.1
  247. CCNode*getChildByTag(/**Reordersachildaccordingtoanewzvalue.
  248. *ThechildMUSTbealreadyadded.
  249. virtualvoidreorderChild(CCNode*child,87); font-weight:bold; background-color:inherit">intzOrder);
  250. /**performanceimprovement,Sortthechildrenarrayoncebeforedrawing,insteadofeverytimewhenachildisaddedorreordered
  251. don'tcallthismanuallyunlessachildaddedneedstoberemovedinthesameframe*/
  252. virtualvoidsortAllChildren();
  253. /**Stopsallrunningactionsandschedulers
  254. virtualvoidcleanup(void);//停止所有动作和任务调度
  255. //draw
  256. /**Overridethismethodtodrawyourownnode.
  257. ThefollowingGLstateswillbeenabledbydefault:
  258. -glEnableClientState(GL_VERTEX_ARRAY);
  259. -glEnableClientState(GL_COLOR_ARRAY);
  260. -glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  261. -glEnable(GL_TEXTURE_2D);
  262. ANDYOUSHOULDNOTDISABLETHEMAFTERDRAWINGYOURNODE
  263. ButifyouenableanyotherGLstate,youshoulddisableitafterdrawingyournode.
  264. virtualvoiddraw(void);//画自己
  265. /**recursivemethodthatvisititschildrenanddrawthem*/
  266. virtualvoidvisit(void);//递归访问子节点并绘制它们
  267. //transformations
  268. //MARMALADEADDEDTHIS...SOITISNOLONGERSPECIFICTOCCSprite
  269. /**updatesthequadaccordingthetherotation,position,scalevalues.*/
  270. virtualvoidupdateTransform(void);
  271. /**performsOpenGLview-matrixtransformationbasedonposition,scale,rotationandotherattributes.*/
  272. voidtransform(void);
  273. /**performsOpenGLview-matrixtransformationofit'sancestors.
  274. Generallytheancestorsarealreadytransformed,butincertaincases(eg:attachingaFBO)
  275. it'snecessarytotransformtheancestorsagain.
  276. @sincev0.7.2
  277. voidtransformAncestors(void);
  278. /**returnsa"local"axisalignedboundingBoxofthenode.
  279. ThereturnedBoxisrelativeonlytoitsparent.
  280. @sincev0.8.2
  281. CCRectboundingBox(void);//返回节点的边框矩形区域,相对于其父节点
  282. //actions
  283. /**Executesanaction,andreturnstheactionthatisexecuted.
  284. Thenodebecomestheaction'starget.
  285. @warningStartingfromv0.8actionsdon'tretaintheirtargetanymore.
  286. @returnAnActionpointer
  287. CCAction*runAction(CCAction*action);//执行一个动作。执行动作的节点将变成动作的target
  288. /**Removesallactionsfromtherunningactionlist*/
  289. voidstopAllActions(void);
  290. /**Removesanactionfromtherunningactionlist*/
  291. voidstopAction(CCAction*action);
  292. /**Removesanactionfromtherunningactionlistgivenitstag
  293. voidstopActionByTag(/**Getsanactionfromtherunningactionlistgivenitstag
  294. @returntheActionthewiththegiventag
  295. CCAction*getActionByTag(/**Returnsthenumbersofactionsthatarerunningplustheonesthatarescheduletorun(actionsinactionsToAddandactionsarrays).
  296. *Composableactionsarecountedas1action.Example:
  297. *Ifyouarerunning1Sequenceof7actions,itwillreturn1.
  298. *Ifyouarerunning7Sequencesof2actions,itwillreturn7.
  299. intnumberOfRunningActions(void);
  300. //timers
  301. /**checkwhetheraselectorisscheduled.*/
  302. boolisScheduled(SEL_SCHEDULEselector);//检测一个选择器是否被调用
  303. /**schedulesthe"update"method.Itwillusetheordernumber0.Thismethodwillbecalledeveryframe.
  304. Scheduledmethodswithalowerordervaluewillbecalledbeforetheonesthathaveahigherordervalue.
  305. Onlyone"update"methodcouldbescheduledpernode.
  306. voidscheduleUpdate(void);//采用0优先级调度update函数,这个函数每一帧都会被执行,优先级数字越小,权重越高,也就越优先调用。每个节点只能有一个update被调度。
  307. /**schedulesthe"update"selectorwithacustompriority.Thisselectorwillbecalledeveryframe.
  308. Scheduledselectorswithalowerprioritywillbecalledbeforetheonesthathaveahighervalue.
  309. Onlyone"update"selectorcouldbescheduledpernode(Youcan'thave2'update'selectors).
  310. voidscheduleUpdateWithPriority(intpriority);//用一个优先级调度update函数,每一帧都调用
  311. /*unschedulesthe"update"method.
  312. voidunscheduleUpdate(void);//停止调度update函数
  313. /**schedulesaselector.
  314. Thescheduledselectorwillbetickedeveryframe
  315. voidschedule(SEL_SCHEDULEselector);//选择器selector每一帧都被调一次
  316. /**schedulesacustomselectorwithanintervaltimeinseconds.
  317. Iftimeis0itwillbetickedeveryframe.
  318. Iftimeis0,itisrecommendedtouse'scheduleUpdate'instead.
  319. Iftheselectorisalreadyscheduled,thentheintervalparameter
  320. willbeupdatedwithoutschedulingitagain.
  321. voidschedule(SEL_SCHEDULEselector,87); font-weight:bold; background-color:inherit">floatinterval);//自定义时间间隔调度选择器selector,比如每秒一次
  322. /**
  323. repeatwillexecutetheactionrepeat+1times,foracontinuesactionusekCCRepeatForever
  324. delayistheamountoftimetheactionwillwaitbeforeexecution
  325. floatinterval,unsignedintrepeat,87); font-weight:bold; background-color:inherit">floatdelay);
  326. Schedulesaselectorthatrunsonlyonce,withadelayof0orlarger
  327. voidscheduleOnce(SEL_SCHEDULEselector,87); font-weight:bold; background-color:inherit">floatdelay);//以一个延迟时间调度回调selector,仅调用一次
  328. /**unschedulesacustomselector.*/
  329. voidunschedule(SEL_SCHEDULEselector);//停止调度自定义的选择器
  330. /**unscheduleallscheduledselectors:customselectors,andthe'update'selector.
  331. Actionsarenotaffectedbythismethod.
  332. @sincev0.99.3
  333. voidunscheduleAllSelectors(void);//停止调用所有选择器,包括自定义的和内置的update
  334. /**resumesallscheduledselectorsandactions.
  335. CalledinternallybyonEnter
  336. voidresumeSchedulerAndActions(void);
  337. /**pausesallscheduledselectorsandactions.
  338. CalledinternallybyonExit
  339. voidpauseSchedulerAndActions(void);
  340. /*Updatewillbecalledautomaticallyeveryframeif"scheduleUpdate"iscalled,andthenodeis"live"
  341. virtualvoidupdate(floatfDelta);//内置的选择器,如果调用了scheduleUpdate,那么这个选择器每一帧都会被调用
  342. //transformationmethods
  343. /**Returnsthematrixthattransformthenode's(local)spacecoordinatesintotheparent'sspacecoordinates.
  344. ThematrixisinPixels.
  345. virtualCCAffineTransformnodeToParentTransform(void);
  346. /**Returnsthematrixthattransformparent'sspacecoordinatestothenode's(local)spacecoordinates.
  347. virtualCCAffineTransformparentToNodeTransform(void);
  348. /**Returnstheworldaffinetransformmatrix.ThematrixisinPixels.
  349. virtualCCAffineTransformnodeToWorldTransform(void);
  350. /**Returnstheinverseworldaffinetransformmatrix.ThematrixisinPixels.
  351. virtualCCAffineTransformworldToNodeTransform(void);
  352. /**ConvertsaPointtonode(local)spacecoordinates.TheresultisinPoints.
  353. CCPointconvertToNodeSpace(constCCPoint&worldPoint);//将世界坐标系的点转换为节点的本地坐标系的点
  354. /**ConvertsaPointtoworldspacecoordinates.TheresultisinPoints.
  355. CCPointconvertToWorldSpace(constCCPoint&nodePoint);//将节点的本地坐标系的点转换为世界坐标系的点
  356. treatingthereturned/receivednodepointasanchorrelative.
  357. CCPointconvertToNodeSpaceAR(constCCPoint&worldPoint);//将世界坐标系的点转换为基于锚点的节点本地坐标系的点
  358. /**ConvertsalocalPointtoworldspacecoordinates.TheresultisinPoints.
  359. treatingthereturned/receivednodepointasanchorrelative.
  360. CCPointconvertToWorldSpaceAR(constCCPoint&nodePoint);//将基于锚点的节点的本地坐标系的点转换为世界坐标系的点
  361. /**conveniencemethodswhichtakeaCCTouchinsteadofCCPoint
  362. CCPointconvertTouchToNodeSpace(CCTouch*touch);//将一个屏幕坐标系的touch转换为节点的本地坐标系的点
  363. /**convertsaCCTouch(worldcoordinates)intoalocalcoordinate.ThismethodisAR(AnchorRelative).
  364. CCPointconvertTouchToNodeSpaceAR(CCTouch*touch);
  365. /**Schedulesforscript.*/
  366. voidscheduleUpdateWithPriorityLua(intnHandler,87); font-weight:bold; background-color:inherit">intpriority);

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

原文链接:https://www.f2er.com/cocos2dx/342232.html

猜你在找的Cocos2d-x相关文章