gpt4 book ai didi

playn - 如何设置 PlayN 大小

转载 作者:行者123 更新时间:2023-12-02 17:59:09 25 4
gpt4 key购买 nike

我已经尝试过:

graphics().setSize(800, 600);

但是它没有任何效果(至少对于java和html)。

而且这个方法似乎已被弃用。设置游戏大小的最佳方法是什么?

最佳答案

此方法在 PlayN 1.5 版本中已弃用,Android/iOS 上游戏 View 的大小由设备决定。 Java 上的大小是通过 JavaPlatform.Config 配置的。 HTML 中的大小由 playn-root div 的大小配置。

例如在 java 后端:

public class GameJava {
public static void main(String[] args) {
//Setting the size of the Java Backend
Config config = new Config();
config.width = 800;
config.height = 480;
JavaPlatform platform = JavaPlatform.register(config);
platform.assets().setPathPrefix("your/package/resources");
PlayN.run(new Game());
}
}

关于playn - 如何设置 PlayN 大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14156040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com