c++ - 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?
解决方案
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.
推荐阅读
- javascript - 使用 httpClient 方法按城市名称调用 JSON 数据文件
- python-3.x - 来自路由器的配置显示为一条线路需要多线路用于 ciscoconfparse
- java - 将文件从 Web 应用程序(弹簧启动)提交到 git 远程存储库,而不首先将存储库克隆为本地?这可能吗
- javascript - 读取当前选项时,选择 HTML 选择结果为空
- php - Laravel 6.2:Process 类依赖于 proc_open,这在您的 PHP 安装中不可用
- python - Tensorflow/tfjs“当输入是一个数组时,不应提供初始状态或常量”
- ios - Swift 持久权限询问
- java - 如何部分修改招摇的 springfox 示例值?
- reactjs - 如何从单个异步请求初始化存储在单独组件中的状态?
- qnamaker - 将图像添加到 Azure QnAMaker KB