Monstamash Posted December 4, 2013 Share Posted December 4, 2013 I know I can float form elements ontop of the canvas, but I was looking to maybe use this plugin - https://github.com/goldfire/CanvasInput - for input but to use it, I need the canvas ID Does anyone know how to set this? Be default it appears a phaser game doesnt have canvas id? Link to comment Share on other sites More sharing options...
jcs Posted December 4, 2013 Share Posted December 4, 2013 I don't believe phaser gives the canvas an id, no, but you can get the canvas (see the Stage object) and add an id to itthis.game.stage.canvas.id = 'foobar';but make sure that canvas exists first. IIRC, it won't if you're using WebGL rendering Monstamash and jerome 2 Link to comment Share on other sites More sharing options...
Monstamash Posted December 4, 2013 Author Share Posted December 4, 2013 Simple when you know how Thanks Link to comment Share on other sites More sharing options...
rich Posted December 4, 2013 Share Posted December 4, 2013 Or even just:this.game.canvas.id = 'blah'; jerome 1 Link to comment Share on other sites More sharing options...
ReplacedAxis Posted December 22, 2016 Share Posted December 22, 2016 On 12/4/2013 at 1:48 PM, jcs said: I don't believe phaser gives the canvas an id, no, but you can get the canvas (see the Stage object) and add an id to it this.game.stage.canvas.id = 'foobar'; but make sure that canvas exists first. IIRC, it won't if you're using WebGL rendering This is a 3 year old post but for anyone looking to disable their mouse cursor on the canvas element this is what the solution was for me. I had my game setup without a pre-existing canvas so I had no id I could just easily GIVE one to the element so I could use it. Thanks! Link to comment Share on other sites More sharing options...
drhayes Posted December 22, 2016 Share Posted December 22, 2016 You could also use CSS for this: "canvas { cursor: none; }". Link to comment Share on other sites More sharing options...
Recommended Posts