mirror of https://github.com/axmolengine/axmol.git
fixed #79
This commit is contained in:
parent
1411ba5f69
commit
4b34b3a015
|
@ -40,6 +40,11 @@ THE SOFTWARE.
|
||||||
#include "CCXApplication.h"
|
#include "CCXApplication.h"
|
||||||
#include "CCBitmapFontAtlas.h"
|
#include "CCBitmapFontAtlas.h"
|
||||||
#include "actions/CCActionManager.h"
|
#include "actions/CCActionManager.h"
|
||||||
|
#include "CCLabelAtlas.h"
|
||||||
|
|
||||||
|
#if CC_ENABLE_PROFILERS
|
||||||
|
#include "support/CCProfiling.h"
|
||||||
|
#endif // CC_ENABLE_PROFILERS
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -140,8 +145,7 @@ CCDirector::~CCDirector(void)
|
||||||
CCLOGINFO("cocos2d: deallocing %p", this);
|
CCLOGINFO("cocos2d: deallocing %p", this);
|
||||||
|
|
||||||
#if CC_DIRECTOR_FAST_FPS
|
#if CC_DIRECTOR_FAST_FPS
|
||||||
//todo
|
CCX_SAFE_RELEASE(m_pFPSLabel);
|
||||||
// FPSLabel->release();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CCX_SAFE_RELEASE(m_pRunningScene);
|
CCX_SAFE_RELEASE(m_pRunningScene);
|
||||||
|
@ -169,7 +173,14 @@ void CCDirector::setGLDefaultValues(void)
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
#if CC_DIRECTOR_FAST_FPS
|
#if CC_DIRECTOR_FAST_FPS
|
||||||
// todo: add needed source code
|
if (! m_pFPSLabel)
|
||||||
|
{
|
||||||
|
CCTexture2DPixelFormat currentFormat = CCTexture2D::defaultAlphaPixelFormat();
|
||||||
|
CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444);
|
||||||
|
m_pFPSLabel = CCLabelAtlas::labelAtlasWithString("00.0", "fps_images.png", 16, 24, '.');
|
||||||
|
m_pFPSLabel->retain();
|
||||||
|
CCTexture2D::setDefaultAlphaPixelFormat(currentFormat);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,8 +368,7 @@ void CCDirector::setProjection(ccDirectorProjection kProjection)
|
||||||
|
|
||||||
void CCDirector::purgeCachedData(void)
|
void CCDirector::purgeCachedData(void)
|
||||||
{
|
{
|
||||||
///@todo add needed source
|
CCBitmapFontAtlas::purgeCachedData();
|
||||||
// CCBitmapFontAtlas::purgeCacheData();
|
|
||||||
CCSpriteFrameCache::purgeSharedSpriteFrameCache();
|
CCSpriteFrameCache::purgeSharedSpriteFrameCache();
|
||||||
CCTextureCache::purgeSharedTextureCache();
|
CCTextureCache::purgeSharedTextureCache();
|
||||||
}
|
}
|
||||||
|
@ -406,7 +416,7 @@ bool CCDirector::isOpenGLAttached(void)
|
||||||
bool CCDirector::detach(void)
|
bool CCDirector::detach(void)
|
||||||
{
|
{
|
||||||
assert(isOpenGLAttached());
|
assert(isOpenGLAttached());
|
||||||
// remove from the superview
|
|
||||||
CCX_SAFE_DELETE(m_pobOpenGLView);
|
CCX_SAFE_DELETE(m_pobOpenGLView);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -594,9 +604,7 @@ void CCDirector::end(void)
|
||||||
stopAnimation();
|
stopAnimation();
|
||||||
|
|
||||||
#if CC_DIRECTOR_FAST_FPS
|
#if CC_DIRECTOR_FAST_FPS
|
||||||
// todo
|
CCX_SAFE_RELEASE(m_pFPSLabel);
|
||||||
// FPSLabel->release();
|
|
||||||
// FPSLabel = NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// purge bitmap cache
|
// purge bitmap cache
|
||||||
|
@ -699,7 +707,6 @@ void CCDirector::preMainLoop(void)
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: implement later
|
|
||||||
#if CC_DIRECTOR_FAST_FPS
|
#if CC_DIRECTOR_FAST_FPS
|
||||||
// display the FPS using a LabelAtlas
|
// display the FPS using a LabelAtlas
|
||||||
// updates the FPS every frame
|
// updates the FPS every frame
|
||||||
|
@ -714,17 +721,24 @@ void CCDirector::showFPS(void)
|
||||||
m_nFrames = 0;
|
m_nFrames = 0;
|
||||||
m_fAccumDt = 0;
|
m_fAccumDt = 0;
|
||||||
|
|
||||||
/*
|
char *str = new char[10];
|
||||||
NSString *str = [[NSString alloc] initWithFormat:@"%.1f", frameRate];
|
sprintf(str, "%.1f", m_fFrameRate);
|
||||||
[FPSLabel setString:str];
|
m_pFPSLabel->setString(str);
|
||||||
[str release];
|
delete [] str;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CC_DIRECTOR_FAST_FPS
|
#endif // CC_DIRECTOR_FAST_FPS
|
||||||
|
|
||||||
#if CC_ENABLE_PROFILERS
|
#if CC_ENABLE_PROFILERS
|
||||||
// implement later
|
void CCDirector::showProfilers()
|
||||||
|
{
|
||||||
|
m_fAccumDtForProfiler += m_fDeltaTime;
|
||||||
|
if (m_fAccumDtForProfiler > 1.0f)
|
||||||
|
{
|
||||||
|
m_fAccumDtForProfiler = 0;
|
||||||
|
CCProfiler::getSharedProfiler()->displayTimers();
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// should we afford 4 types of director ??
|
// should we afford 4 types of director ??
|
||||||
|
|
|
@ -473,8 +473,7 @@ protected:
|
||||||
ccTime m_fAccumDt;
|
ccTime m_fAccumDt;
|
||||||
ccTime m_fFrameRate;
|
ccTime m_fFrameRate;
|
||||||
#if CC_DIRECTOR_FAST_FPS
|
#if CC_DIRECTOR_FAST_FPS
|
||||||
// todo implement CCLabelAtlas
|
CCLabelAtlas *m_pFPSLabel;
|
||||||
// CCLabelAtlas *FPSLabel;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* is the running scene paused */
|
/* is the running scene paused */
|
||||||
|
|
|
@ -342,7 +342,7 @@ namespace cocos2d {
|
||||||
CCParticleSystem()
|
CCParticleSystem()
|
||||||
:m_pParticles(NULL)
|
:m_pParticles(NULL)
|
||||||
#if CC_ENABLE_PROFILERS
|
#if CC_ENABLE_PROFILERS
|
||||||
;m_pProfilingTimer(NULL)
|
,m_pProfilingTimer(NULL)
|
||||||
#endif
|
#endif
|
||||||
,m_pTexture(NULL)
|
,m_pTexture(NULL)
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Reference in New Issue