cocos2dx 启动过程详解二:内存管理和回调
来源:互联网 发布:电脑安装软件失败 编辑:程序博客网 时间:2024/06/11 06:04
void CCDirector::drawScene(void)
{
…...
//tick before glClear: issue #533
if (! m_bPaused) //暂停
{
m_pScheduler->update(m_fDeltaTime); //待会会解释这里的内容
}
@since v2.0
*/
CC_PROPERTY(CCScheduler*, m_pScheduler, Scheduler);
We can use getter to read the variable, and use the setter to change the variable.
@param varType : the type of variable.
@param varName : variable name.
@param funName : "get + funName" is the name of the getter.
"set + funName" is the name of the setter.
@warning : The getter and setter are public virtual functions, you should rewrite them first.
The variables and methods declared after CC_PROPERTY are all public.
If you need protected or private, please declare.
*/
#define CC_PROPERTY(varType, varName, funName)\
protected: varType varName;\
public: virtual varType get##funName(void);\
public: virtual void set##funName(varType var);
void CCScheduler::update(float dt)
// The 'timers' array may change while inside this loop
for (elt->timerIndex = 0; elt->timerIndex < elt->timers->num; ++(elt->timerIndex))
{
elt->currentTimer = (CCTimer*)(elt->timers->arr[elt->timerIndex]);
elt->currentTimerSalvaged = false;
elt->currentTimer->update(dt); //这里又有一个update函数哟
if (elt->currentTimerSalvaged)
{
// The currentTimer told the remove itself. To prevent the timer from
// accidentally deallocating itself before finishing its step, we retained
// it. Now that step is done, it's safe to release it.
elt->currentTimer->release();
}
elt->currentTimer = NULL;
}
{
…..
if (m_bRunForever && !m_bUseDelay)
{//standard timer usage
m_fElapsed += dt;
if (m_fElapsed >= m_fInterval)
{
if (m_pTarget && m_pfnSelector)
{
(m_pTarget->*m_pfnSelector)(m_fElapsed); //第一个出现了
}
…..
if( m_fElapsed >= m_fDelay )
{
if (m_pTarget && m_pfnSelector)
{
(m_pTarget->*m_pfnSelector)(m_fElapsed); //第二个出现了
}
……..
else
{
if (m_fElapsed >= m_fInterval)
{
if (m_pTarget && m_pfnSelector)
{
(m_pTarget->*m_pfnSelector)(m_fElapsed); //第三个出现了
}
……..
}
{
this->schedule(selector, interval, kCCRepeatForever, 0.0f);
}
void CCNode::schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay)
{
CCAssert( selector, "Argument must be non-nil");
CCAssert( interval >=0, "Argument must be positive");
m_pScheduler->scheduleSelector(selector, this, interval , repeat, delay, !m_bRunning);
}
{
。。。。。。
CCTimer *pTimer = new CCTimer();
pTimer->initWithTarget(pTarget, pfnSelector, fInterval, repeat, delay); //看这里
ccArrayAppendObject(pElement->timers, pTimer);
pTimer->release();
}
{
m_pTarget = pTarget;
。。。。
return true;
}
- cocos2dx 启动过程详解二:内存管理和回调
- cocos2dx 启动过程详解一:渲染
- 201215-03-19---cocos2dx内存管理--详解
- linux启动过程和linux内存管理总结
- 1.cocos2dx内存管理和CCArray,CCMenuItem
- C++内存管理详解(二)
- cocos2dx 使用过程中内存管理的理解
- Linux Kernel启动过程中的内存管理
- COCOS2DX引擎深入二————内存管理
- cocos2dx 启动渲染过程
- cocos2dx 内存管理
- cocos2dx 内存管理
- Cocos2dx-------->内存管理
- Cocos2Dx 内存管理封装
- Cocos2Dx 内存管理封装
- cocos2dx 内存管理
- cocos2dx的内存管理
- cocos2dx 内存管理
- [转]Oracle 字符集的查看和修改
- JAVA多线程的实现
- 黑马程序员-iOS学习日记(十)Foundation
- MS6324/26
- 通过ALAsset获取编辑过的图片
- cocos2dx 启动过程详解二:内存管理和回调
- MRF,马尔科夫随机场
- 什么是EABI?
- ubuntu 下修改默认gcc g++版本
- ns3 常用waf命令
- POJ 2524 Ubiquitous Religions //简单并查集
- Java基础- super 和 this 解析
- C# 从路径加载图片
- cocos2dx 内存管理