2

I am having trouble integrating the playn-root component with the rest of my standard gwt panels and components. In other words I have standard gwt components like buttons and tables and cannot figure out how to add the playn root where I would like it to be.

There is an element called rootElement in HtmlGraphics that is a package protected memember that I think if I could get access to it, then I would be able to work with it like I need to. I have tried to extend the HtmlPlatform class, but because this class has no default constructor, it is not extendable.

How are we supposed to integrate playn with the rest of gwt for html targeted games?

Jonah
  • 41
  • 1
  • 5

1 Answers1

4

If you put a <div> in your HTML host page with the id playn-root then PlayN will add the game view to that div. The Cute example game demonstrates this:

<body bgcolor="black">
  <div id='playn-root'></div>
  <script src="cutegame/cutegame.nocache.js"></script>
</body>

If you need to get access to that div in your GWT app, you can use Document:

Document.get().getElementById("playn-root")
samskivert
  • 3,694
  • 20
  • 22
  • Thanks, that's a lot easier than the route I was headed. I was able to add the div tag and place the game where it needed to be with css. – Jonah May 13 '12 at 19:20
  • @samskivert I want to display html contents in my playn screen which will work for every version.That means i want it to write in core project itself.So will it help me ? – Android Killer Jul 18 '12 at 08:00