Hattraz Posted September 15, 2013 Share Posted September 15, 2013 I may be mistaken, but I think Phaser handles the generation of the canvas/WebGL markup/placement. Is it possible to give it a particular HTML element to render within? Link to comment Share on other sites More sharing options...
rich Posted September 15, 2013 Share Posted September 15, 2013 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 More sharing options...
Recommended Posts