Skip to content

Commit 5c30fd0

Browse files
committed
Stage.smoothed was returning the opposite of its actual setting (phaserjs#494)
1 parent 10b3dbf commit 5c30fd0

3 files changed

Lines changed: 108 additions & 6 deletions

File tree

examples/wip/state smoothed.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
var BasicGame = {};
2+
3+
BasicGame.Boot = function (game) {
4+
5+
this.a;
6+
this.b;
7+
8+
};
9+
10+
BasicGame.Boot.prototype = {
11+
12+
init: function (a, b) {
13+
14+
this.a = a;
15+
this.b = b;
16+
console.log('Boot is alive');
17+
console.log('A: ', this.a);
18+
console.log('B: ', this.b);
19+
20+
},
21+
22+
create: function () {
23+
24+
this.stage.smoothed = false;
25+
console.log('Boot create');
26+
this.game.state.start('Preloader', true, false, this.a, this.b);
27+
28+
}
29+
30+
};
31+
32+
BasicGame.Preloader = function (game) {
33+
34+
this.a;
35+
this.b;
36+
37+
};
38+
39+
BasicGame.Preloader.prototype = {
40+
41+
init: function (a, b) {
42+
43+
this.a = a;
44+
this.b = b;
45+
console.log('Preloader is alive');
46+
console.log('A: ', this.a);
47+
console.log('B: ', this.b);
48+
49+
},
50+
51+
preload: function () {
52+
53+
this.load.image('backdrop', 'assets/pics/atari_fujilogo.png');
54+
55+
},
56+
57+
create: function () {
58+
59+
console.log('Preloader create');
60+
this.game.state.start('MainMenu', true, false, this.a, this.b);
61+
62+
}
63+
64+
};
65+
66+
BasicGame.MainMenu = function (game) {
67+
68+
this.a;
69+
this.b;
70+
71+
};
72+
73+
BasicGame.MainMenu.prototype = {
74+
75+
init: function (a, b) {
76+
77+
this.a = a;
78+
this.b = b;
79+
80+
},
81+
82+
create: function () {
83+
84+
this.game.stage.backgroundColor = 0x2d2d2d;
85+
86+
console.log('Main Menu is alive');
87+
console.log('A: ', this.a);
88+
console.log('B: ', this.b);
89+
console.log(this.stage.smoothed);
90+
91+
var s = this.add.sprite(0, 0, 'backdrop');
92+
s.scale.set(4);
93+
94+
}
95+
96+
};
97+
98+
// var game = new Phaser.Game(1024, 768, Phaser.AUTO, 'phaser-example', null, false, false);
99+
var game = new Phaser.Game(1024, 768, Phaser.AUTO, 'phaser-example', null, false, true);
100+
101+
game.state.add('Boot', BasicGame.Boot);
102+
game.state.add('Preloader', BasicGame.Preloader);
103+
game.state.add('MainMenu', BasicGame.MainMenu);
104+
105+
game.state.start('Boot', true, false, 'hello', 'world');

src/core/Game.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
6565
this.transparent = false;
6666

6767
/**
68-
* @property {boolean} antialias - Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality).
68+
* @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.
6969
* @default
7070
*/
7171
this.antialias = true;
@@ -531,10 +531,7 @@ Phaser.Game.prototype = {
531531
this.context = null;
532532
}
533533

534-
if (!this.antialias)
535-
{
536-
this.stage.smoothed = false;
537-
}
534+
this.stage.smoothed = this.antialias;
538535

539536
Phaser.Canvas.addToDOM(this.canvas, this.parent, true);
540537
Phaser.Canvas.setTouchAction(this.canvas);

src/core/Stage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
383383

384384
get: function () {
385385

386-
return !!PIXI.scaleModes.LINEAR;
386+
return !PIXI.scaleModes.LINEAR;
387387

388388
},
389389

0 commit comments

Comments
 (0)