Merge pull request #1721 from minggo/gles20

do some bug fixes
This commit is contained in:
minggo 2012-12-04 02:45:48 -08:00
commit 646a513424
3 changed files with 50 additions and 43 deletions

View File

@ -907,16 +907,8 @@ CCArray* CCBReader::getAnimationManagersForNodes() {
************************************************************************/
float CCBReader::getResolutionScale()
{
// Init resolution scale
if (CCApplication::sharedApplication()->getTargetPlatform() == kTargetIpad)
{
return 2;
}
else
{
return 1;
}
}
NS_CC_EXT_END;

View File

@ -25,18 +25,32 @@ bool AppDelegate::applicationDidFinishLaunching()
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
pDirector->setProjection(kCCDirectorProjection2D);
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
CCSize designSize = CCSizeMake(320, 480);
CCSize resourceSize = CCSizeMake(320, 480);
// if (screenSize.height > 320)
// {
// CCSize resourceSize = CCSizeMake(640, 960);
// CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
// pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
// }
if (screenSize.height > 768)
{
resourceSize = CCSizeMake(1536, 2048);
CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-ipadhd");
}
else if (screenSize.height > 640)
{
resourceSize = CCSizeMake(768, 1536);
CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-ipad");
}
else if (screenSize.height > 320)
{
resourceSize = CCSizeMake(640, 960);
CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-iphonehd");
}
pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);

View File

@ -24,6 +24,7 @@ bool AppDelegate::applicationDidFinishLaunching()
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
pDirector->setProjection(kCCDirectorProjection2D);
// Set the design resolution
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(320, 480, kResolutionShowAll);