How can i change FPS color or position

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

Search for “createStatsLabel”, it’s in CCDirector.cpp, you could just add a line in there and set its colour.

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

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));

Gav GMTDev wrote:

Well changing the colour works, at the end of the void CCDirector::createStatsLabel() add:
>
[…]
thx u it seem to work
but it need to rebuild the project take a long time

A public API for this would be handy as we use prebuilt libs these days!