Jump to content

Render in HTML Element


Hattraz
 Share

Recommended Posts

You're not mistaken, it does indeed inject a canvas tag into the DOM. The 2nd parameter when you create your game allows you to control where in the DOM it is injected:

var game = new Phaser.Game(this, 'gameHolder', 800, 600, preload, create, update);

In the example above the canvas will be placed into 'gameHolder' (which needs to exist in advance).

 

There is no way to tell it to use an existing canvas though. It wouldn't take much to add support for that, but I'd love to hear a case for why it might be needed :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...