cocos2dx 常识
发布时间:2020-12-14 17:08:43 所属栏目:百科 来源:网络整理
导读:0Cocos2d-x基本类源码的剖析 CCApplication CCDirector,CCDisplayLinkDirector CCLayer CCScene CCSprite CCNode CCPoolManager CCAutoreleasePool CCFileUtils CCScheduler CCActionManager CCNotificationCenter 4 static inline unsigned int getHashCode
<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; } 总结:指针为方式内存泄露,也采取的这种,保存传进来的,释放原来的,将传进来的赋值给原来的. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |