如何使用playn在Android中自动检测屏幕尺寸?
我最近注意到图层可以在需要时调整大小,因此我尝试实现一种方法来将主图层的大小调整为运行时的 Android 屏幕的大小。
如何从 playn 中获取设备屏幕尺寸?
还有另一种方法可以根据所玩屏幕的大小来调整 Android 设备中游戏的大小吗?
I have recently noticed that layers can be resized when needed, so I'm trying to implement a method to resize the main layer to the size of the android screen where it is running.
How do I access to the device screen size from playn?
And there is another way to adjust the size of the game in android devices depending on the size of the screen with playn?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(3)
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我相信您正在寻找的是
PlayN.graphics().screenHeight()
和PlayN.graphics().screenWidth()
。从 Graphics.java 文件中复制:
正如描述所述, screenHeight() 和 screenWidth() 提供实际的屏幕高度/宽度。使用这些值,您可以调整游戏的大小或比例以适合屏幕。
I believe what you are looking for is
PlayN.graphics().screenHeight()
andPlayN.graphics().screenWidth()
.Copied out of the Graphics.java file:
As the descriptions state, screenHeight() and screenWidth() provide the actual screen height/width. With these values, you can adjust the size or scale of your game to fit the screen.