Merge remote-tracking branch 'origin/gles20' into gles20

This commit is contained in:
dualface 2012-09-14 17:57:56 +08:00
commit 62709d7c71
3 changed files with 19 additions and 9 deletions

View File

@ -73,21 +73,20 @@ NS_CC_BEGIN
// XXX it shoul be a Director ivar. Move it there once support for multiple directors is added
// singleton stuff
static CCDisplayLinkDirector s_SharedDirector;
static CCDisplayLinkDirector *s_SharedDirector = NULL;
#define kDefaultFPS 60 // 60 frames per second
extern const char* cocos2dVersion(void);
CCDirector* CCDirector::sharedDirector(void)
{
static bool s_bFirstUseDirector = true;
if (s_bFirstUseDirector)
if (!s_SharedDirector)
{
s_bFirstUseDirector = false;
s_SharedDirector.init();
s_SharedDirector = new CCDisplayLinkDirector();
s_SharedDirector->init();
}
return &s_SharedDirector;
return s_SharedDirector;
}
CCDirector::CCDirector(void)
@ -162,7 +161,7 @@ bool CCDirector::init(void)
CCDirector::~CCDirector(void)
{
CCLOG("cocos2d: deallocing %p", this);
CCLOG("cocos2d: deallocing CCDirector %p", this);
CC_SAFE_RELEASE(m_pFPSLabel);
CC_SAFE_RELEASE(m_pSPFLabel);
@ -185,6 +184,8 @@ CCDirector::~CCDirector(void)
CC_SAFE_DELETE(m_pLastUpdate);
// delete fps string
delete []m_pszFPS;
s_SharedDirector = NULL;
}
void CCDirector::setGLDefaultValues(void)
@ -593,6 +594,7 @@ void CCDirector::purgeDirector()
{
// cleanup scheduler
getScheduler()->unscheduleAllSelectors();
getActionManager()->removeAllActions();
// don't release the event handlers
// They are needed in case the director is run again
@ -643,6 +645,9 @@ void CCDirector::purgeDirector()
// OpenGL view
m_pobOpenGLView->end();
m_pobOpenGLView = NULL;
// delete CCDirector
release();
}
void CCDirector::setNextScene(void)

View File

@ -47,7 +47,7 @@ void CCLog(const char * pszFormat, ...)
void CCLuaLog(const char * pszFormat)
{
CCLog(pszFormat);
CCLog("%s", pszFormat);
}
// ios no MessageBox, use CCLog instead

View File

@ -59,10 +59,15 @@ static id s_sharedDirectorCaller;
-(void) dealloc
{
s_sharedDirectorCaller = nil;
NSLog(@"cocos2d: deallocing CCDirectorCaller %@", self);
CCLOG("cocos2d: deallocing CCDirectorCaller %x", (unsigned int)self);
if (displayLink) {
CVDisplayLinkRelease(displayLink);
}
CCLOG("--------------------------------------------------------------------------------");
CCLOG("");
CCLOG("");
CCLOG("");
[super dealloc];
}