c++ - Cocos2d-x Game screen not fit in iPhone 4 with iOS 7 -
i new cocos2d-x, found strange issue in game testing in simulator working fine. testing our game in iphone 5 , ipad thing working perfect got issue in iphone 4 device. there game screen display small , there show top , right side black area following screenshot:
i check default images size , resolution correct par apple guide line.
can please suggest me how fix issue. can't figure out there code related issue or need change in xcode.
following iphone 5 screen shot:
here appdelegate code:
bool appdelegate::applicationdidfinishlaunching() { wrapper->authenticatelocalplayer(); // initialize director ccdirector *pdirector = ccdirector::shareddirector(); pdirector->setopenglview(cceglview::sharedopenglview()); pdirector->setopenglview(cceglview::sharedopenglview()); // turn on display fps pdirector->setdisplaystats(false); // set fps. default value 1.0/60 if don't call pdirector->setanimationinterval(1.0 / 60); ccsize size = ccdirector::shareddirector()->getwinsize(); ipadx = size.width/1024; ipady = size.height/768; if (size.width==1024 || size.width==2048){ cceglview::sharedopenglview()->setdesignresolutionsize(1024, 768, kresolutionexactfit); scalex = 1.0f; scaley = 1.0f; } else { if (size.width<568) { scalex = 960.0f/1024; scaley = 640.0f/768; } else { scalex = 1136.0f/1024; scaley = 640.0f/768; } } // create scene. it's autorelease object ccscene *pscene = helloworld::scene(); // run pdirector->runwithscene(pscene); return true; }
try this:
//set design resolution
size designsize = size(960, 640); if (size.width==1024 || size.width==2048){ designsize = size(1024, 768); scalex = 1.0f; scaley = 1.0f; } else { if (size.width<568) { scalex = 960.0f/1024; scaley = 640.0f/768; } else { scalex = 1136.0f/1024; scaley = 640.0f/768; designsize = size(1136, 640); } } cceglview::sharedopenglview()->setdesignresolutionsize(designsize.width, designsize.height, kresolutionexactfit); cceglview::sharedopenglview()->setcontentscalefactor(max(768/designsize.height,1024/designsize.width) );
Comments
Post a Comment