Skip to content

Commit 06a17b4

Browse files
committed
Fixed an issue in Text. Fixed the background color issue with Canvas games. Updated the Examples viewer so the side-by-side focuses the iframe now. Added new "Extend Group" example.
1 parent 299115c commit 06a17b4

11 files changed

Lines changed: 9602 additions & 8898 deletions

File tree

build/phaser.js

Lines changed: 9509 additions & 8864 deletions
Large diffs are not rendered by default.

build/phaser.min.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/_site/examples.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@
250250
"file": "display+order.js",
251251
"title": "display order"
252252
},
253+
{
254+
"file": "extending+a+group.js",
255+
"title": "extending a group"
256+
},
253257
{
254258
"file": "for+each.js",
255259
"title": "for each"

examples/_site/js/phaser-sideview.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ $(document).ready(function(){
3636
var height = $(window).height() - 270;
3737
$("#panel").css('height', height + 'px');
3838

39+
// iFrame focus
40+
$('a').click(function(e) { $('#viewer').focus(); });
41+
3942
})
4043

4144
.fail(function() {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
window.onload = function() {
2+
3+
// Here is a custom group
4+
// It will automatically create 30 sprites of the given image when created.
5+
6+
MonsterGroup = function (game, image, action) {
7+
8+
Phaser.Group.call(this, game);
9+
10+
for (var i = 0; i < 30; i++)
11+
{
12+
var sprite = this.create(game.world.randomX, game.world.randomY, image);
13+
14+
if (action == 'bounce')
15+
{
16+
game.add.tween(sprite).to({ y: sprite.y - 100 }, 2000, Phaser.Easing.Elastic.Out, true, 0, 1000, true);
17+
}
18+
else if (action == 'slide')
19+
{
20+
game.add.tween(sprite).to({ x: sprite.x + 200 }, 4000, Phaser.Easing.Elastic.Out, true, 0, 1000, true);
21+
}
22+
23+
}
24+
25+
};
26+
27+
MonsterGroup.prototype = Object.create(Phaser.Group.prototype);
28+
MonsterGroup.prototype.constructor = MonsterGroup;
29+
30+
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create });
31+
32+
var customGroup1;
33+
var customGroup2;
34+
35+
function preload() {
36+
37+
game.load.image('ufo', 'assets/sprites/ufo.png');
38+
game.load.image('baddie', 'assets/sprites/space-baddie.png');
39+
40+
}
41+
42+
function create() {
43+
44+
customGroup1 = new MonsterGroup(game, 'ufo', 'bounce');
45+
customGroup2 = new MonsterGroup(game, 'baddie', 'slide');
46+
47+
}
48+
49+
}();

examples/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div class="header">
1313
<div class="box100 no-padding">
1414
<div class="phaser-version">
15-
<span>Phaser Version: 1.1.2</span>
15+
<span>Phaser Version: 1.1.3</span>
1616
<a id="upgrade" href="https://github.com/photonstorm/phaser" class="version-button">New version: </a>
1717
</div>
1818
</div>

examples/sideview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</div>
2020
<div id="footer">
2121
<p id="total">Total examples: </p>
22-
<p>Phaser version: 1.1.2</p>
22+
<p>Phaser version: 1.1.3</p>
2323
<p><a href="index.html">Switch to Full View</a></p>
2424
</div>
2525

src/PixiPatch.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ PIXI.CanvasRenderer.prototype.render = function(stage)
2121

2222
PIXI.visibleCount++;
2323
stage.updateTransform();
24-
25-
// update the background color
26-
// if(this.view.style.backgroundColor!=stage.backgroundColorString && !this.transparent)this.view.style.backgroundColor = stage.backgroundColorString;
2724

2825
this.context.setTransform(1, 0, 0, 1, 0, 0);
29-
// this.context.clearRect(0, 0, this.width, this.height)
26+
this.context.clearRect(0, 0, this.width, this.height)
3027
this.renderDisplayObject(stage);
3128

3229
// Remove frame updates

src/core/Stage.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ Phaser.Stage.prototype = {
9898
Phaser.Canvas.setUserSelect(this.canvas, 'none');
9999
Phaser.Canvas.setTouchAction(this.canvas, 'none');
100100

101+
this.backgroundColor = '#000';
102+
101103
document.addEventListener('visibilitychange', this._onChange, false);
102104
document.addEventListener('webkitvisibilitychange', this._onChange, false);
103105
document.addEventListener('pagehide', this._onChange, false);
@@ -165,19 +167,23 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", {
165167

166168
this._backgroundColor = color;
167169

168-
if (this.game.renderType == Phaser.CANVAS)
169-
{
170-
// Set it directly, this allows us to use rgb alpha values in Canvas mode.
171-
this._stage.backgroundColorString = color;
172-
}
173-
else
170+
if (this.game.transparent === false)
174171
{
175-
if (typeof color === 'string')
172+
if (this.game.renderType == Phaser.CANVAS)
176173
{
177-
color = Phaser.Color.hexToRGB(color);
174+
// Set it directly, this allows us to use rgb alpha values in Canvas mode.
175+
this.game.canvas.style.backgroundColor = color;
176+
}
177+
else
178+
{
179+
if (typeof color === 'string')
180+
{
181+
color = Phaser.Color.hexToRGB(color);
182+
}
183+
184+
this._stage.setBackgroundColor(color);
178185
}
179186

180-
this._stage.setBackgroundColor(color);
181187
}
182188

183189
}

src/gameobjects/Text.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ Object.defineProperty(Phaser.Text.prototype, 'angle', {
202202

203203
/**
204204
* The x coordinate of this object in world space.
205-
* @name Phaser.BitmapText#x
205+
* @name Phaser.Text#x
206206
* @property {number} x - The x coordinate of this object in world space.
207207
*/
208-
Object.defineProperty(Phaser.BitmapText.prototype, 'x', {
208+
Object.defineProperty(Phaser.Text.prototype, 'x', {
209209

210210
get: function() {
211211
return this.position.x;
@@ -219,10 +219,10 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'x', {
219219

220220
/**
221221
* The y coordinate of this object in world space.
222-
* @name Phaser.BitmapText#y
222+
* @name Phaser.Text#y
223223
* @property {number} y - The y coordinate of this object in world space.
224224
*/
225-
Object.defineProperty(Phaser.BitmapText.prototype, 'y', {
225+
Object.defineProperty(Phaser.Text.prototype, 'y', {
226226

227227
get: function() {
228228
return this.position.y;

0 commit comments

Comments
 (0)