前端之家收集整理的这篇文章主要介绍了
cocos2dx 常识,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<0>Cocos2d-x基本类源码的剖析 CCApplication CCDirector,CCDisplayLinkDirector CCLayer CCScene CCSprite CCNode CCPoolManager CCAutoreleasePool CCFileUtils CCScheduler CCActionManager CCNotificationCenter <4> static inline unsigned int getHashCodeByString(const char *key) { unsigned int len = strlen(key); const char *end=key+len; unsigned int hash; for (hash = 0; key < end; key++) { hash *= 16777619; hash ^= (unsigned int) (unsigned char) toupper(*key); } return (hash); } 总结:得到hash码,看来也是这种取字节流的方式. <5> #define CCAssert(cond,msg) do { \ if (!(cond)) { \ if (!cc_assert_script_compatible(msg) && strlen(msg)) \ cocos2d::CCLog("Assert Failed: %s",msg); \ CC_ASSERT(cond); \ } \ } while (0) 总结:可见,CCAssert在断言着cloud为真,一旦不为真,那么就会输出msg提示信息. <6> void CCDirector::setKeypadDispatcher(CCKeypadDispatcher* pKeypadDispatcher) { CC_SAFE_RETAIN(pKeypadDispatcher); CC_SAFE_RELEASE(m_pKeypadDispatcher); m_pKeypadDispatcher = pKeypadDispatcher; } 总结:指针为方式内存泄露,也采取的这种,保存传进来的,释放原来的,将传进来的赋值给原来的. 原文链接:https://www.f2er.com/cocos2dx/339381.html