diff --git a/examples/wip/state smoothed.js b/examples/wip/state smoothed.js new file mode 100644 index 00000000..193a1917 --- /dev/null +++ b/examples/wip/state smoothed.js @@ -0,0 +1,105 @@ +var BasicGame = {}; + +BasicGame.Boot = function (game) { + + this.a; + this.b; + +}; + +BasicGame.Boot.prototype = { + + init: function (a, b) { + + this.a = a; + this.b = b; + console.log('Boot is alive'); + console.log('A: ', this.a); + console.log('B: ', this.b); + + }, + + create: function () { + + this.stage.smoothed = false; + console.log('Boot create'); + this.game.state.start('Preloader', true, false, this.a, this.b); + + } + +}; + +BasicGame.Preloader = function (game) { + + this.a; + this.b; + +}; + +BasicGame.Preloader.prototype = { + + init: function (a, b) { + + this.a = a; + this.b = b; + console.log('Preloader is alive'); + console.log('A: ', this.a); + console.log('B: ', this.b); + + }, + + preload: function () { + + this.load.image('backdrop', 'assets/pics/atari_fujilogo.png'); + + }, + + create: function () { + + console.log('Preloader create'); + this.game.state.start('MainMenu', true, false, this.a, this.b); + + } + +}; + +BasicGame.MainMenu = function (game) { + + this.a; + this.b; + +}; + +BasicGame.MainMenu.prototype = { + + init: function (a, b) { + + this.a = a; + this.b = b; + + }, + + create: function () { + + this.game.stage.backgroundColor = 0x2d2d2d; + + console.log('Main Menu is alive'); + console.log('A: ', this.a); + console.log('B: ', this.b); + console.log(this.stage.smoothed); + + var s = this.add.sprite(0, 0, 'backdrop'); + s.scale.set(4); + + } + +}; + +// var game = new Phaser.Game(1024, 768, Phaser.AUTO, 'phaser-example', null, false, false); +var game = new Phaser.Game(1024, 768, Phaser.AUTO, 'phaser-example', null, false, true); + +game.state.add('Boot', BasicGame.Boot); +game.state.add('Preloader', BasicGame.Preloader); +game.state.add('MainMenu', BasicGame.MainMenu); + +game.state.start('Boot', true, false, 'hello', 'world'); diff --git a/src/core/Game.js b/src/core/Game.js index 0e5a1988..3e1243c7 100644 --- a/src/core/Game.js +++ b/src/core/Game.js @@ -65,7 +65,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant this.transparent = false; /** - * @property {boolean} antialias - Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality). + * @property {boolean} antialias - Anti-alias graphics. By default scaled images are smoothed in Canvas and WebGL, set anti-alias to false to disable this globally. * @default */ this.antialias = true; @@ -531,10 +531,7 @@ Phaser.Game.prototype = { this.context = null; } - if (!this.antialias) - { - this.stage.smoothed = false; - } + this.stage.smoothed = this.antialias; Phaser.Canvas.addToDOM(this.canvas, this.parent, true); Phaser.Canvas.setTouchAction(this.canvas); diff --git a/src/core/Stage.js b/src/core/Stage.js index c4a39283..8c35956b 100644 --- a/src/core/Stage.js +++ b/src/core/Stage.js @@ -383,7 +383,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", { get: function () { - return !!PIXI.scaleModes.LINEAR; + return !PIXI.scaleModes.LINEAR; },