Skip to content

Commit 13c99f3

Browse files
committed
Phaser.StageScaleMode has been renamed to ScaleManager and moved from the system folder to the core folder. It's still available under game.scale.
If your game references the old Phaser.StageScaleMode consts like SHOW_ALL you need to update them to Phaser.ScaleManager, i.e. Phaser.ScaleManager.SHOW_ALL. All of the Project Templates have been updated to reflect the above change.
1 parent fdde4cb commit 13c99f3

22 files changed

Lines changed: 321 additions & 112 deletions

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ module.exports = function (grunt) {
7070
'src/core/Stage.js',
7171
'src/core/Group.js',
7272
'src/core/World.js',
73+
'src/core/ScaleManager.js',
7374
'src/core/Game.js',
7475

7576
'src/input/Input.js',
@@ -100,7 +101,6 @@ module.exports = function (grunt) {
100101
'src/gameobjects/BitmapFont.js',
101102

102103
'src/system/Canvas.js',
103-
'src/system/StageScaleMode.js',
104104
'src/system/Device.js',
105105
'src/system/RequestAnimationFrame.js',
106106

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ Significant API changes:
7878
* Keyboard.removeKey has been removed. The way the new keyboard manager works means it's no longer required.
7979
* When a game un-pauses (from a visibility loss) it resets all Input components.
8080
* Time.advancedTiming is a new boolean property. If true Time.fps, fpsMin, fpsMax, frames, msMin and msMax will be calculated, otherwise they remain at their defaults.
81+
* Phaser.StageScaleMode has been renamed to ScaleManager and moved from the system folder to the core folder. It's still available under game.scale.
82+
* If your game references the old Phaser.StageScaleMode consts like SHOW_ALL you need to update them to Phaser.ScaleManager, i.e. Phaser.ScaleManager.SHOW_ALL.
8183

8284

8385
New features:

build/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
<script src="$path/src/core/Group.js"></script>
118118
<script src="$path/src/core/World.js"></script>
119119
<script src="$path/src/core/Game.js"></script>
120+
<script src="$path/src/core/ScaleManager.js"></script>
120121
121122
<script src="$path/src/input/Input.js"></script>
122123
<script src="$path/src/input/Key.js"></script>
@@ -146,7 +147,6 @@
146147
<script src="$path/src/gameobjects/BitmapFont.js"></script>
147148
148149
<script src="$path/src/system/Canvas.js"></script>
149-
<script src="$path/src/system/StageScaleMode.js"></script>
150150
<script src="$path/src/system/Device.js"></script>
151151
<script src="$path/src/system/RequestAnimationFrame.js"></script>
152152

examples/_site/view_full.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<script src="../src/core/Stage.js"></script>
7272
<script src="../src/core/Group.js"></script>
7373
<script src="../src/core/World.js"></script>
74+
<script src="../src/core/ScaleManager.js"></script>
7475
<script src="../src/core/Game.js"></script>
7576

7677
<script src="../src/input/Input.js"></script>
@@ -101,7 +102,6 @@
101102
<script src="../src/gameobjects/BitmapFont.js"></script>
102103

103104
<script src="../src/system/Canvas.js"></script>
104-
<script src="../src/system/StageScaleMode.js"></script>
105105
<script src="../src/system/Device.js"></script>
106106
<script src="../src/system/RequestAnimationFrame.js"></script>
107107

examples/_site/view_lite.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<script src="../src/core/Stage.js"></script>
7272
<script src="../src/core/Group.js"></script>
7373
<script src="../src/core/World.js"></script>
74+
<script src="../src/core/ScaleManager.js"></script>
7475
<script src="../src/core/Game.js"></script>
7576

7677
<script src="../src/input/Input.js"></script>
@@ -101,7 +102,6 @@
101102
<script src="../src/gameobjects/BitmapFont.js"></script>
102103

103104
<script src="../src/system/Canvas.js"></script>
104-
<script src="../src/system/StageScaleMode.js"></script>
105105
<script src="../src/system/Device.js"></script>
106106
<script src="../src/system/RequestAnimationFrame.js"></script>
107107

examples/wip/autoscroll.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ function create() {
2020
sprite = game.add.tileSprite(0, 0, 800, 600, 'starfield');
2121
sprite.autoScroll(0, 200);
2222

23+
game.add.image(200, 200, 'mummy');
24+
25+
game.world.scale.set(2);
26+
2327
}
2428

2529
function update() {

examples/wip/destroy state swap.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
3+
4+
function preload() {
5+
6+
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
7+
8+
}
9+
10+
var mummy;
11+
var anim;
12+
13+
function create() {
14+
15+
game.stage.backgroundColor = 0xff8855;
16+
17+
mummy = game.add.sprite(300, 200, 'mummy', 5);
18+
19+
mummy.animations.updateIfVisible = false;
20+
21+
anim = mummy.animations.add('walk');
22+
23+
anim.play(2, false);
24+
// anim.play(2, true);
25+
26+
}
27+
28+
function update() {
29+
30+
}
31+
32+
function render() {
33+
34+
game.debug.renderText(anim.frame + ' / 17', 32, 32);
35+
36+
}

examples/wip/destroy state.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
var BasicGame = {};
2+
3+
BasicGame.Boot = function (game) {
4+
};
5+
6+
BasicGame.Boot.prototype = {
7+
8+
preload: function () {
9+
10+
this.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
11+
12+
},
13+
14+
create: function () {
15+
16+
this.state.start('MainMenu');
17+
18+
}
19+
20+
};
21+
22+
BasicGame.MainMenu = function (game) {
23+
24+
this.mummy;
25+
this.anim;
26+
27+
};
28+
29+
BasicGame.MainMenu.prototype = {
30+
31+
create: function () {
32+
33+
this.stage.backgroundColor = 0x2d2d2d;
34+
35+
this.mummy = this.add.sprite(200, 400, 'mummy');
36+
37+
this.anim = this.mummy.animations.add('walk');
38+
39+
this.anim.play(10, false);
40+
41+
this.mummy.events.onAnimationComplete.add(this.changeIt, this);
42+
43+
},
44+
45+
changeIt: function () {
46+
47+
this.state.start('GameOver');
48+
49+
}
50+
51+
};
52+
53+
BasicGame.GameOver = function (game) {
54+
55+
this.dude;
56+
57+
};
58+
59+
BasicGame.GameOver.prototype = {
60+
61+
create: function () {
62+
63+
this.stage.backgroundColor = 0xff7744;
64+
65+
this.dude = this.add.sprite(300, 300, 'mummy');
66+
67+
}
68+
69+
};
70+
71+
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example');
72+
73+
game.state.add('Boot', BasicGame.Boot);
74+
game.state.add('MainMenu', BasicGame.MainMenu);
75+
game.state.add('GameOver', BasicGame.GameOver);
76+
77+
game.state.start('Boot');

examples/wip/state parameters.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ game.state.add('Boot', BasicGame.Boot);
8989
game.state.add('Preloader', BasicGame.Preloader);
9090
game.state.add('MainMenu', BasicGame.MainMenu);
9191

92-
game.state.start('Boot', true, false, 'hello', 'world');
92+
game.state.start('Boot');

resources/Project Templates/Basic/Boot.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BasicGame = {};
1+
var BasicGame = {};
22

33
BasicGame.Boot = function (game) {
44

@@ -17,33 +17,33 @@ BasicGame.Boot.prototype = {
1717
create: function () {
1818

1919
// Unless you specifically know your game needs to support multi-touch I would recommend setting this to 1
20-
this.game.input.maxPointers = 1;
20+
this.input.maxPointers = 1;
2121

2222
// Phaser will automatically pause if the browser tab the game is in loses focus. You can disable that here:
23-
this.game.stage.disableVisibilityChange = true;
23+
this.stage.disableVisibilityChange = true;
2424

2525
if (this.game.device.desktop)
2626
{
2727
// If you have any desktop specific settings, they can go in here
28-
this.game.stage.scale.pageAlignHorizontally = true;
28+
this.scale.pageAlignHorizontally = true;
2929
}
3030
else
3131
{
3232
// Same goes for mobile settings.
3333
// In this case we're saying "scale the game, no lower than 480x260 and no higher than 1024x768"
34-
this.game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
35-
this.game.stage.scale.minWidth = 480;
36-
this.game.stage.scale.minHeight = 260;
37-
this.game.stage.scale.maxWidth = 1024;
38-
this.game.stage.scale.maxHeight = 768;
39-
this.game.stage.scale.forceLandscape = true;
40-
this.game.stage.scale.pageAlignHorizontally = true;
41-
this.game.stage.scale.setScreenSize(true);
34+
this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
35+
this.scale.minWidth = 480;
36+
this.scale.minHeight = 260;
37+
this.scale.maxWidth = 1024;
38+
this.scale.maxHeight = 768;
39+
this.scale.forceLandscape = true;
40+
this.scale.pageAlignHorizontally = true;
41+
this.scale.setScreenSize(true);
4242
}
4343

4444
// By this point the preloader assets have loaded to the cache, we've set the game settings
4545
// So now let's start the real preloader going
46-
this.game.state.start('Preloader');
46+
this.state.start('Preloader');
4747

4848
}
4949

0 commit comments

Comments
 (0)