CCDirector::sharedDirector()函数源码

static CCDisplayLinkDirector *s_SharedDirector = NULL;
CCDirector* CCDirector::sharedDirector(void)
{
    if (!s_SharedDirector)
    {
        s_SharedDirector = new CCDisplayLinkDirector();
        s_SharedDirector->init();
    }

    return s_SharedDirector;
}
类静态方法,获取全局唯一的 CCDirector 对象,如不存在则创建并获取对象

你可能感兴趣的:(CCDirector::sharedDirector()函数源码)