对手机和平板电脑等不同设备的密度支持
众所周知,在不同的设备和密度上,您需要使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须使用特定于平台的 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.