mirror of https://github.com/axmolengine/axmol.git
fixed #1516: The font size of labels for displaying FPS,SPF,DrawCount is incorrect in different design resolutions.
This commit is contained in:
parent
d68f7c76f6
commit
549dd92d8e
|
@ -775,20 +775,21 @@ void CCDirector::createStatsLabel()
|
|||
m_pDrawsLabel = new CCLabelAtlas();
|
||||
m_pDrawsLabel->initWithString("000", "fps_images.png", 12, 32, '.');
|
||||
*/
|
||||
m_pFPSLabel = CCLabelTTF::create("00.0", "Arial", 24);
|
||||
int fontSize = (int)(m_obWinSizeInPoints.height / 320.0f * 24);
|
||||
m_pFPSLabel = CCLabelTTF::create("00.0", "Arial", fontSize);
|
||||
m_pFPSLabel->retain();
|
||||
m_pSPFLabel = CCLabelTTF::create("0.000", "Arial", 24);
|
||||
m_pSPFLabel = CCLabelTTF::create("0.000", "Arial", fontSize);
|
||||
m_pSPFLabel->retain();
|
||||
m_pDrawsLabel = CCLabelTTF::create("000", "Arial", 24);
|
||||
m_pDrawsLabel = CCLabelTTF::create("000", "Arial", fontSize);
|
||||
m_pDrawsLabel->retain();
|
||||
|
||||
//CCTexture2D::setDefaultAlphaPixelFormat(currentFormat);
|
||||
|
||||
|
||||
CCSize contentSize = m_pDrawsLabel->getContentSize();
|
||||
m_pDrawsLabel->setPosition(ccpAdd(ccp(contentSize.width/2, contentSize.height/2 + 40), CC_DIRECTOR_STATS_POSITION));
|
||||
m_pDrawsLabel->setPosition(ccpAdd(ccp(contentSize.width/2, contentSize.height*5/2), CC_DIRECTOR_STATS_POSITION));
|
||||
contentSize = m_pSPFLabel->getContentSize();
|
||||
m_pSPFLabel->setPosition(ccpAdd(ccp(contentSize.width/2, contentSize.height/2 + 20), CC_DIRECTOR_STATS_POSITION));
|
||||
m_pSPFLabel->setPosition(ccpAdd(ccp(contentSize.width/2, contentSize.height*3/2), CC_DIRECTOR_STATS_POSITION));
|
||||
contentSize = m_pFPSLabel->getContentSize();
|
||||
m_pFPSLabel->setPosition(ccpAdd(ccp(contentSize.width/2, contentSize.height/2), CC_DIRECTOR_STATS_POSITION));
|
||||
}
|
||||
|
|
|
@ -87,12 +87,10 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height, Resol
|
|||
|
||||
m_eResolutionPolicy = resolutionPolicy;
|
||||
|
||||
//setViewPortInPoints(0, 0,m_obScreenSize.width, m_obScreenSize.height);
|
||||
|
||||
// reset director's member variables to fit visible rect
|
||||
CCDirector::sharedDirector()->createStatsLabel();
|
||||
// reset director's member variables to fit visible rect
|
||||
CCDirector::sharedDirector()->m_obWinSizeInPoints = getSize();
|
||||
CCDirector::sharedDirector()->m_obWinSizeInPixels = CCSizeMake(m_obDesignResolutionSize.width*CC_CONTENT_SCALE_FACTOR(), m_obDesignResolutionSize.height*CC_CONTENT_SCALE_FACTOR());
|
||||
CCDirector::sharedDirector()->createStatsLabel();
|
||||
CCDirector::sharedDirector()->setGLDefaultValues();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue