diff --git a/HelloWorld/win32/HelloWorld.win32.vcproj b/HelloWorld/win32/HelloWorld.win32.vcproj index 70d71b3243..82fb736c7d 100644 --- a/HelloWorld/win32/HelloWorld.win32.vcproj +++ b/HelloWorld/win32/HelloWorld.win32.vcproj @@ -119,7 +119,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(SolutionDir)cocos2dx\platform";"$(SolutionDir)cocos2dx\include";"$(SolutionDir)cocos2dx";"$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES";..\Classes" + AdditionalIncludeDirectories=""$(SolutionDir)cocos2dx\platform";"$(SolutionDir)cocos2dx\include";"$(SolutionDir)cocos2dx\kazmath\include";"$(SolutionDir)cocos2dx";"$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES";..\Classes" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index 9bc1fa43ca..3d11c35348 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -69,20 +69,21 @@ 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_pSharedDirector = NULL; +static CCDisplayLinkDirector s_SharedDirector; #define kDefaultFPS 60 // 60 frames per second extern const char* cocos2dVersion(void); CCDirector* CCDirector::sharedDirector(void) { - if (s_pSharedDirector == NULL) + static bool s_bFirstUseDirector = true; + if (s_bFirstUseDirector) { - s_pSharedDirector = new CCDisplayLinkDirector(); - s_pSharedDirector->init(); + s_bFirstUseDirector = false; + s_SharedDirector.init(); } - - return s_pSharedDirector; + + return &s_SharedDirector; } CCDirector::CCDirector(void) @@ -673,7 +674,6 @@ void CCDirector::purgeDirector() // OpenGL view m_pobOpenGLView->release(); m_pobOpenGLView = NULL; - CC_SAFE_DELETE(s_pSharedDirector); } void CCDirector::setNextScene(void) @@ -1008,8 +1008,8 @@ void CCDisplayLinkDirector::mainLoop(void) { if (m_bPurgeDirecotorInNextLoop) { - purgeDirector(); m_bPurgeDirecotorInNextLoop = false; + purgeDirector(); } else if (! m_bInvalid) { diff --git a/cocos2dx/proj.win32/cocos2d-win32.vcproj b/cocos2dx/proj.win32/cocos2d-win32.vcproj index 5d192e97c7..3ed64ef57b 100644 --- a/cocos2dx/proj.win32/cocos2d-win32.vcproj +++ b/cocos2dx/proj.win32/cocos2d-win32.vcproj @@ -124,7 +124,7 @@ />