0

A simple example of what I'd like to achieve:

<body>
    <div style="float:left;">
        Hey, look to the right. There's my game!
    </div>
    <div id="mygame">
        <script src="mygame/mygame.nocache.js"></script>
    </div>
</body>

The problem is: the PlayN javascript appears to append the canvas comprising my game to the end of the DOM and reset the body attributes to match the canvas size. So the game always ends up at the bottom of the screen.

I suppose I could add some javascript to rearrange the layout after the canvas is loaded. Is it possible to have the canvas loaded into a specified element?

klenwell
  • 6,978
  • 4
  • 45
  • 84
  • Just saw this question: http://stackoverflow.com/q/10461310/1093087. Perhaps an iframe tag is the way to go? I'll give it a try. – klenwell Jun 18 '12 at 15:53

1 Answers1

3

Add id="playn-root" to the element you want to have the game canvas in.

At startup, PlayN looks for this id. If found, the game canvas is added inside the corresponding element. Otherwise, it is appended to the body element.

Stefan Haustein
  • 18,427
  • 3
  • 36
  • 51