add setContentScaleFactor()

This commit is contained in:
Ming 2010-10-15 07:47:48 +00:00
parent fb0987ae6c
commit 0298500abe
2 changed files with 19 additions and 5 deletions

View File

@ -789,6 +789,23 @@ void CCDirector::showProfilers()
}
#endif
void CCDirector::setContentScaleFactor(CGFloat scaleFactor)
{
if (scaleFactor != m_fContentScaleFactor)
{
m_fContentScaleFactor = scaleFactor;
m_obSurfaceSize = CGSizeMake(m_obScreenSize.width * scaleFactor, m_obScreenSize.height * scaleFactor);
if (m_pobOpenGLView)
{
updateContentScaleFactor();
}
// update projection
setProjection(m_eProjection);
}
}
// should we afford 4 types of director ??
// I think DisplayLinkDirector is enough
// so we now only support DisplayLinkDirector

View File

@ -246,11 +246,8 @@ public:
Only available when compiled using SDK >= 4.0.
@since v0.99.4
*/
inline void setContentScaleFactor(CGFloat obCGFloatValue)
{
assert(! isOpenGLAttached());
m_fContentScaleFactor = obCGFloatValue;
}
void setContentScaleFactor(CGFloat scaleFactor);
inline CGFloat getContentScaleFactor(void) { return m_fContentScaleFactor; }
// UI dependent