ckvir
April 9, 2013, 8:11pm
#1
hi i am learning cocos2sx now
I use the following code to display FPS
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
// turn on display FPS
pDirector->setDisplayStats(true);
but my program background is white
so can i change FPS color from white to black??
thx
1 Like
GMTDev
April 9, 2013, 9:28pm
#2
Search for “createStatsLabel”, it’s in CCDirector.cpp, you could just add a line in there and set its colour.
ckvir
April 9, 2013, 10:14pm
#3
Gav GMTDev wrote:
Search for “createStatsLabel”, it’s in CCDirector.cpp, you could just add a line in there and set its colour.
this is original code and picture
picture
code
and i change code and compiler again
picture
code
m_pFPSLabel~~>setPosition, CC_DIRECTOR_STATS_POSITION));
—>m_pFPSLabel~~>setPosition(ccpAdd(ccp(contentSize.width, contentSize.height), CC_DIRECTOR_STATS_POSITION));
but it does’t seem to change
GMTDev
April 10, 2013, 4:31am
#4
Well changing the colour works, at the end of the void CCDirector::createStatsLabel() add:
m_pFPSLabel->setColor(ccc3(0xff,0,0));
m_pSPFLabel->setColor(ccc3(0xff,0,0));
m_pDrawsLabel->setColor(ccc3(0xff,0,0));
umai
May 2, 2016, 1:47am
#6
A public API for this would be handy as we use prebuilt libs these days!