Skip to content

Commit 5a4c41c

Browse files
committed
Merge branch 'dev' of https://github.com/photonstorm/phaser into dev
2 parents 043f6f1 + 05914d3 commit 5a4c41c

5 files changed

Lines changed: 35 additions & 11 deletions

File tree

.jshintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"globals" : { "Phaser": false, "PIXI": false, "p2": false, "CocoonJS": false },
2+
"globals" : { "Phaser": false, "PIXI": false, "p2": false, "CocoonJS": false, "process": false },
33

44
// Ignore Environment Globals
55
"browser" : true, // Standard browser globals e.g. `window`, `document`.

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ Thousands of developers worldwide use it. From indies and multi-national digital
3939

4040
<div align="center"><img src="http://phaser.io/images/github/news.jpg"></div>
4141

42-
> 15th July 2015
42+
> 22nd July 2015
4343
44-
To be written.
44+
Phaser 2.4 is another huge update. We had to bump the version number from 2.3 directly to 2.4 because of some API adjustments, all of which are fully detailed in the [Change Log](#change-log) at the end of this readme. While it's true we could have released it over a few smaller point releases, that just isn't how the cookie crumbled this time.
45+
46+
Phaser is a fully open-source project and as such we have no direct income from it at all. All development is funded by the client work that my company takes on. And of course the contributions from the incredible community (who also volunteer their skills for free)
4547

4648
That's all for now. I hope you enjoy Phaser 2.4.0. Happy coding everyone! See you on the forums.
4749

@@ -402,6 +404,7 @@ For the full list of p2 additions please read [their change log](https://github.
402404
* AnimationParser.spriteSheet can now accept either a string-based key or an HTML Image object as the key argument.
403405
* LoaderParser.bitmapFont, xmlBitmapFont and jsonBitmapFont all now return the font data rather than write it to the now deprecated PIXI.BitmapText.fonts global array.
404406
* PIXI.BitmapText has been removed as a global array, as it is no longer used.
407+
* PIXI has been made available for Phaser when using requireJS (thanks @mkristo #1923)
405408

406409
### Bug Fixes
407410

@@ -458,6 +461,7 @@ For the full list of p2 additions please read [their change log](https://github.
458461
* PIXI.DisplayObject.updateTransform now nulls the _currentBounds property (thanks @gaufqwi #1906)
459462
* Improved the JSON BitmapText implementation (thanks @Feenposhleen #1912 #1837)
460463
* game.make.group did not setup parent correctly (thanks @mthurlin #1911)
464+
* Fix reference error for process in the Device class (thanks @mkristo #1922)
461465

462466
### Deprecated
463467

src/Phaser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
*/
1111
var Phaser = Phaser || {
1212

13-
VERSION: '2.4.0-RC2',
14-
GAMES: [],
13+
VERSION: '2.4.0-RC3',
14+
15+
GAMES: [],
1516

1617
AUTO: 0,
1718
CANVAS: 1,

src/gameobjects/TileSprite.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@
1010
*
1111
* TileSprites have no input handler or physics bodies by default, both need enabling in the same way as for normal Sprites.
1212
*
13+
* You shouldn't ever create a TileSprite any larger than your actual screen size. If you want to create a large repeating background
14+
* that scrolls across the whole map of your game, then you create a TileSprite that fits the screen size and then use the `tilePosition`
15+
* property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will
16+
* consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to
17+
* adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs.
18+
*
1319
* An important note about texture dimensions:
1420
*
15-
* When running under Canvas a TileSprite can use any texture size without issue. When running under WebGL the texture should be
21+
* When running under Canvas a TileSprite can use any texture size without issue. When running under WebGL the texture should ideally be
1622
* a power of two in size (i.e. 4, 8, 16, 32, 64, 128, 256, 512, etch pixels width by height). If the texture isn't a power of two
1723
* it will be rendered to a blank canvas that is the correct size, which means you may have 'blank' areas appearing to the right and
1824
* bottom of your frame. To avoid this ensure your textures are perfect powers of two.
@@ -77,7 +83,9 @@ Phaser.TileSprite = function (game, x, y, width, height, key, frame) {
7783
*/
7884
this._scroll = new Phaser.Point();
7985

80-
PIXI.TilingSprite.call(this, PIXI.TextureCache['__default'], width, height);
86+
var def = game.cache.getImage('__default', true);
87+
88+
PIXI.TilingSprite.call(this, new PIXI.Texture(def.base), width, height);
8189

8290
Phaser.Component.Core.init.call(this, game, x, y, key, frame);
8391

src/pixi/extras/TilingSprite.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
*/
1515
PIXI.TilingSprite = function(texture, width, height)
1616
{
17-
PIXI.Sprite.call( this, texture);
17+
PIXI.Sprite.call(this, texture);
1818

1919
/**
20-
* The with of the tiling sprite
20+
* The width of the tiling sprite
2121
*
2222
* @property width
2323
* @type Number
@@ -377,6 +377,7 @@ PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
377377
{
378378
this.canvasBuffer = new PIXI.CanvasBuffer(targetWidth, targetHeight);
379379
this.tilingTexture = PIXI.Texture.fromCanvas(this.canvasBuffer.canvas);
380+
this.tilingTexture = PIXI.Texture.fromCanvas(this.canvasBuffer.canvas);
380381
this.tilingTexture.isTiling = true;
381382
this.tilingTexture.needsUpdate = true;
382383
}
@@ -387,15 +388,25 @@ PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
387388
this.canvasBuffer.context.strokeRect(0, 0, targetWidth, targetHeight);
388389
}
389390

391+
// If a sprite sheet we need this:
392+
var w = texture.crop.width;
393+
var h = texture.crop.height;
394+
395+
if (w !== targetWidth || h !== targetHeight)
396+
{
397+
w = targetWidth;
398+
h = targetHeight;
399+
}
400+
390401
this.canvasBuffer.context.drawImage(texture.baseTexture.source,
391402
texture.crop.x,
392403
texture.crop.y,
393404
texture.crop.width,
394405
texture.crop.height,
395406
dx,
396407
dy,
397-
texture.crop.width,
398-
texture.crop.height);
408+
w,
409+
h);
399410

400411
this.tileScaleOffset.x = frame.width / targetWidth;
401412
this.tileScaleOffset.y = frame.height / targetHeight;

0 commit comments

Comments
 (0)