如果你的浏览器支持WebGL,Phaser将自动检测并尽可能的使用它绘制。
尽管在具有GPU处理器的设备上,它通常有较好的性能,但在有些设备上它有可能反而会变慢。如果你注意到你的浏览器明显变慢,你可以使用如下代码强制浏览器使用普通的html画布。
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'gameContainer');
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'gameContainer');
While it usually translates to faster performance on devices with graphics processors, WebGL rendering can be slow and laggy on other machines. If you’re noticing significant lag on your browser, you can force Phaser to use plain HTML Canvas by changing the following line in app.js :
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'gameContainer'); var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'gameContainer');