diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index cb6102c5f2..3e6e6c0357 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -726,6 +726,8 @@ void CCDirector::showFPS(void) m_pFPSLabel->setString(str); delete [] str; } + + m_pFPSLabel->draw(); } #endif // CC_DIRECTOR_FAST_FPS diff --git a/test_uphone/test_uphoneApp.cpp b/test_uphone/test_uphoneApp.cpp index 279440d2d9..30fc8affbc 100644 --- a/test_uphone/test_uphoneApp.cpp +++ b/test_uphone/test_uphoneApp.cpp @@ -32,8 +32,10 @@ Ttest_uphoneApp::~Ttest_uphoneApp() bool Ttest_uphoneApp::initCocos2d() { // init director - CCDirector::getSharedDirector()->setOpenGLView(m_pMainWnd); - CCDirector::getSharedDirector()->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft); + CCDirector * pDirector = CCDirector::getSharedDirector(); + pDirector->setOpenGLView(m_pMainWnd); + pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft); + pDirector->setDisplayFPS(true); // load background image texture and get window size CCTexture2D * pTexture = CCTextureCache::sharedTextureCache()->addImage("/NEWPLUS/TDA_DATA/UserData/HelloWorld.png"); diff --git a/test_uphone/tests/ParticleTest/ParticleTest.cpp b/test_uphone/tests/ParticleTest/ParticleTest.cpp index d9c293db07..41ad3bab22 100644 --- a/test_uphone/tests/ParticleTest/ParticleTest.cpp +++ b/test_uphone/tests/ParticleTest/ParticleTest.cpp @@ -723,8 +723,8 @@ ParticleDemo::ParticleDemo(void) addChild( menu, 100 ); - CCLabel* labelAtlas = CCLabel::labelWithString("0000", "fonts", 16); - addChild(labelAtlas, 100, kTagLabelAtlas); + CCLabelAtlas* labelAtlas = CCLabelAtlas::labelAtlasWithString("0000", "fps_images.png", 16, 24, '.'); + addChild(labelAtlas, 100, kTagLabelAtlas); labelAtlas->setPosition( CGPointMake(254,50) ); // moving background @@ -785,13 +785,13 @@ void ParticleDemo::ccTouchEnded(CCTouch* touch, UIEvent* event) void ParticleDemo::step(ccTime dt) { -// CCLabel* atlas = (CCLabel*)getChildByTag(kTagLabelAtlas); -// -// char str[5] = {0}; -// //std::string str; -// sprintf(str, "%4d", m_emitter->getParticleCount()); -// //str.format("%4d", m_emitter->getParticleCount()); -// atlas->setString(str); + if (m_emitter) + { + CCLabelAtlas* atlas = (CCLabelAtlas*)getChildByTag(kTagLabelAtlas); + char str[5] = {0}; + sprintf(str, "%04d", m_emitter->getParticleCount()); + atlas->setString(str); + } } void ParticleDemo::toggleCallback(NSObject* pSender)