How to support various iphone screen sizes as of 2014?

后端 未结 5 1877
星月不相逢
星月不相逢 2020-12-19 08:36

I\'m almost done building my first iPhone app and am trying to add a background image, and am finding it a little confusing, because nowadays there\'s like 3 or 4 different

5条回答
  •  星月不相逢
    2020-12-19 09:07

    Which game engine are you using ? If you are using cocos2d or cocos2dx then you can use background image of 960 * 640 .Below code will scale the images according to the screen size.

    CCSize frameSize = pEGLView->getFrameSize();
        CCSize designSize = CCSizeMake(480, 320);
        vector searchPaths;
    
        CCSize resourceSize;
    
        Utility :: isPad = true;
        searchPaths.push_back("hd");
        resourceSize = CCSizeMake(960, 640);
    
        CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width , designSize.height, kResolutionExactFit);
        pDirector->setContentScaleFactor(resourceSize.width/designSize.width); 
    

提交回复
热议问题