对手机和平板电脑等不同设备的密度支持

发布于 2025-01-08 12:05:35 字数 198 浏览 2 评论 0原文

众所周知,在不同的设备和密度上,您需要使用 dp(dpi) 来计算图像大小/比率等。

我的问题是如何获得设备密度 (dpi) 来正确计算我可以确定的图像将在具有不同 dpi 的手机和平板电脑等每个设备上正确显示?

在纯 Android 上,这很简单,但有 playn ? 对此有什么好的解决办法吗?我想确保我的游戏在每台设备上都能正常显示......

It is known problem that on different devices and densities you need to use dp(dpi) for images sizes/ratios etc.

My question is how can i get the device density (dpi) to properly calculate for my images that i can be sure it will display correct on each devices like phones and tablets with different dpi's ??

On pure Android it's simple but with playn ?
Is there any good solution for that? I want to be sure that my game will look fine on each devices...

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

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

发布评论

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

评论(1

就此别过 2025-01-15 12:05:35

您必须使用特定于平台的 API 来获取设备密度,然后在选择纹理和布局图形时将该信息提供给游戏。

PlayN 不会、也不可能神奇地让一切正常运转。 Android 和 iOS 对显示密度采取不同的方法,手机和平板电脑之间的视图尺寸差异在很大程度上与显示密度正交。

这是一篇有关如何在 Android 上处理不同尺寸和密度的文章

You will have to use platform-specific APIs to obtain the device density and then make that information available to the game when selecting your textures and laying out your graphics.

PlayN does not, and cannot, magically just make it all work. Android and iOS take differing approaches to display density, and the view size difference between phones and tablets is a dimension largely orthogonal to display density.

Here's an article on how to handle different sizes and densities on Android.

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