如何获得iPhone 6或6 Plus的确切屏幕尺寸
How to get the exact screensize of an iPhone 6 or 6 Plus
我正在使用cocoas2d-x V3.0。我试过了
Size screenSize = CCDirector::getInstance()->getWinSizeInPixels();
但它返回iPhone 5的大小(640 * 1136),而我正在iPhone 6或iPhone 6plus模拟器上进行测试。
您需要获取 cocos2d-x v3.3,因为以前版本的 cocos2d-x 无法获得 iPhone 6 和 iPhone 6 plus 的正确屏幕分辨率,因为它们仍然认为比例因子为 2 而不是 3,因此返回 iPhone 5 分辨率。
这个问题已经讨论过 这个链接: https://github.com/cocos2d/cocos2d-x/issues/8545
You need to add Launch images for Iphone 6 & 6+ , only then
it will show you its real screen size.
Go to your Xcode -> Select Target -> Select General ->
select Launch Image Source under App Icons & Launch Images .
Now you can add there your launch images for iphone 6 & plus
which could be 1334*750 & 2208*1242 For landScape mode.
Now you can have your device screenSize with following code .
Size WinSize= Director::getInstance()->getWinSize();
i have faced same thing in my project & this way i solved it.
i am using Xcode 6 & cocos2d-x 3.2
I hope this helps.
相关文章:
- UE4-如何在给定4个屏幕坐标的情况下缩放纹理或材质
- 如何在GTK程序运行时禁用屏幕保护程序/电源管理/屏幕消隐
- 使用 SFML 和 C++ 将 Pixel 打印到屏幕上
- 在 Windows 8/10 技术中完全实时的屏幕捕获,没有延迟
- Winapi:屏幕截图未显示在窗口中
- 如何在快板的屏幕中显示子位图的绘制?
- 按回车键后输出屏幕关闭
- 要在屏幕上绘制一些小瓷砖,我应该使用 QQuickItem 还是 QQuickPaintedItem?
- SFML 向下移动时如何围绕屏幕中心旋转?
- 截取屏幕截图后程序卡住
- 如何使用 redis-plus-plus 存储二进制数据,就像我想存储结构一样?@for_stack?
- C++鼠标单击时的屏幕截图不起作用
- 屏幕插入运算符<<的运算符过载问题
- 编译 Cilk Plus 程序时遇到问题
- 获取网格中心的屏幕位置
- SFML 中的字体.信息不显示在屏幕上.显示的不是信息,而是点
- 如何在屏幕上环绕x和y?
- GetDIBits 在屏幕捕获函数中多次迭代后返回零
- OpenGL ES 2.0将纹理绘制到屏幕上是行不通的
- 如何获得iPhone 6或6 Plus的确切屏幕尺寸