Question

I've tried :

graphics().setSize(800, 600);

But it has no effects (at least with java and html).

And it seems this method is deprecated. What is the best way to set up the game size ?

Was it helpful?

Solution

This method was deprecated in version 1.5 of PlayN, the size of your game view on Android/iOS is dictated by the device. The size on Java is configured via JavaPlatform.Config. The size in HTML is configured by the size of your playn-root div.

For example on the java backend:

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());
  }
}

OTHER TIPS

for HTML do something like this:

<style>
  #playn-root {
    width: 640px;
    height: 480px;
  }
</style>
....
<div id="playn-root"></div>
<body>
    <script src="game/game.nocache.js"></script>
</body>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top