c++iosiphonexcodecocos2d-x

Cocos2d-x Display resolution problem in in iPad Air(4th Gen) and iPadPro 11 inch


I used resource of 2048x1536 for all iPad device. Resolution is not perfect in iPad Air(4th Gen) and iPadPro 11 inch.

In all other iPad display correct.

Tested in Cocos2dx v4.0

Here is my code:

if (MyGameBridge::sharedGameBridge()->IsIpad())
       {
           auto designSize = Size(1024, 768);
           
           auto resourceSize = Size(2048, 1536);
           director->setContentScaleFactor(resourceSize.height/designSize.height);
           
           searchPaths.push_back("Data/iPad");
       }

Something wrong in my AppDelegate class..

Here is AppDelegate.cpp : https://app.box.com/s/i1zubskcq4hqky4e9depfcwlskm4xzmc

Here is Cocos2d v4 My Sample : https://app.box.com/s/6dp8o5ccbe8dtvulilficb3uk4b34keo Please check and help me.

In this sample source, you can see iPad Air(4thGen) resolution problem, also in iPadPro(11inch)..works perfect in all other iPads. Using separate resource set for iPadAir(4thGen) may works..but how to use single set of graphics for all iPad?


Solution

  • You are unsing ResolutionPolicy::NO_BORDER with that policy cropping can occur.

    NO_BORDER: The entire application fills the specified area, without distortion but possibly with some cropping, while maintaining the original aspect ratio of the application.

    When you use SHOW_ALL: The entire application is visible in the specified area without distortion while maintaining the original aspect ratio of the application. Borders can appear on two sides of the application.