iPad 和 iPhone 的坐标系有什么区别?

发布于 2024-09-11 16:00:10 字数 245 浏览 2 评论 0原文

我正在尝试在 cocos2d 中制作一个可以在多个平台(iPad、iPhone、iPod touch)上使用的应用程序。假设我将一个点设置为 (360,160)。该点将显示在 iPhone 屏幕左侧四分之三处和屏幕中间位置。它是否也会在 ipad 上执行此操作,或者我是否必须将点设置为 (768,384) 才能实现此结果?或者它是否拉伸屏幕。我想我必须这样做,但我不确定,因为当我在 iPhone 或 iPad 模拟过程中获得屏幕尺寸时,无论如何我总是得到 480x320。

I'm trying to make an application in cocos2d that can be used on multiple platforms (iPad, iPhone, iPod touch). Let's say I set a point to (360,160). The point would show up three fourths from the left and half way up the screen on the iPhone. Would it also do this on the ipad, or would I have to set the point to (768,384) to achieve this result? or does it stretch the screen. I figured I would have to, but am unsure because when I get the size of the screen during an iPhone OR iPad simulation, I always get 480x320 regardless.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白龙吟 2024-09-18 16:00:10

暂时忽略 iPhone 4,设备将其屏幕与其坐标空间 1:1 映射,因此 iPhone 的坐标空间大小为 320x480(或横向模式下为 480x320),而 iPad 的坐标空间大小为 768x1024(或横向模式下为 1024x768。)

当然,iPhone 4 使设备像素增加了四倍,但保持了与其他 iPhone 相同的坐标空间,并缩放绘图以匹配屏幕的分辨率。

Ignoring the iPhone 4 for the moment, the devices map their screens 1:1 with their coordinate spaces, so the iPhone has a coordinate space with size 320x480 (or 480x320 in landscape mode) while the iPad has a coordinate space with size 768x1024 (or 1024x768 in landscape mode.)

The iPhone 4, of course, quadruples the device pixels, but maintains an identical coordinate space to other iPhones and scales drawing to match the screen's resolution.

你的心境我的脸 2024-09-18 16:00:10

注意:如果您在 iPad 模拟器上运行时获得相同的分辨率,则意味着您没有将项目转换为 iPad 项目。或者您没有将其作为本机 iPad 应用程序启动,而是将其作为 iPad 模拟器中的 iPhone 应用程序启动。

确保您已完成将目标升级到 iPad -> Xcode:项目菜单,选择 iPad 的升级目标

在模拟器中运行时,请确保选择 iPad 模拟器作为活动可执行文件。

Note: if you get the same resolution running on the iPad Simulator it means you did not convert your project as an iPad project. Or you did not start it as a native iPad application but rather the iPhone App within the iPad Simulator.

Make sure you have gone through upgrading your target to iPad -> Xcode: Project menu, choose Upgrade Target for iPad

When running in the Simulator make sure you chose iPad Simulator as Active Executable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文