Search code examples
playn

game size on html


I'm using the latest PlayN version from git, where it was removed the setSize(w, h) method from the platform.

On the Java backend I give my game the desired dimension with:

Config conf = new Config();
conf.width = 720;
conf.height = 600;

JavaPlatform platform = JavaPlatform.register(conf);

I compile to HTML but now I'm not sure how to specify the game size on the HTML platform. I give the #playn-root element a style like this:

<style>
  #playn-root {
    height: 600px;
    width: 720px;
  }
</style>

And it does resize the div element, but my game it's still all shrinked inside of it (size 300 x 150)

Here's the init code for the game:

root = _iface.createRoot(new AbsoluteLayout(), rootSheet, graphics().rootLayer()).setSize(graphics().width(), graphics().height());

I'm missing something but I couldn't find what to change.


Solution

  • this was a bug in PlayN (the OOO fork), it was fixed in https://github.com/threerings/playn/commit/058a2e6919131b39cf2c26eb3db3fb220e523879