Skip to content

Commit 1c7059e

Browse files
committed
Merge remote-tracking branch 'phaser-github/dev' into dev
Conflicts: src/animation/FrameData.js src/core/Game.js src/particles/arcade/Emitter.js src/time/Time.js src/tween/Tween.js
2 parents af09290 + 788fc7e commit 1c7059e

108 files changed

Lines changed: 27931 additions & 11247 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gruntfile.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ module.exports = function (grunt) {
1919

2020
grunt.registerTask('dist', ['replace', 'build', 'copy']);
2121

22+
grunt.registerTask('docs', ['pixidoc', 'builddoc']);
23+
2224
};

README.md

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
- [License](#license)
2222

2323
<a name="about"></a>
24-
# Phaser 2.1.4
24+
# Phaser 2.2.0
2525

2626
Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) internally for fast 2D Canvas and WebGL rendering.
2727

28-
Version: 2.1.4 "Bethal" - Released: -in development-
28+
Version: 2.2.0 "Bethal" - Released: -in development-
2929

3030
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
3131

@@ -43,7 +43,7 @@ By Richard Davey, [Photon Storm](http://www.photonstorm.com)
4343
![div](http://phaser.io/images/div4.png)
4444

4545
<a name="whats-new"></a>
46-
## Welcome to Phaser and What's new in 2.1.4?
46+
## Welcome to Phaser and What's new in 2.2.0?
4747

4848
![Pixi 2.0](http://www.phaser.io/images/pixi-v2.png)
4949

@@ -71,20 +71,48 @@ Finally the list of [community authored Phaser Tutorials](http://www.lessmilk.co
7171
<a name="change-log"></a>
7272
## Change Log
7373

74-
Version 2.1.4 - "Bethal" - in development
74+
Version 2.2.0 - "Bethal" - in development
7575

7676
### New Features
7777

78+
* Updated to Pixi v2.1.0 - see seprate change log entry below.
7879
* Cache.getRenderTexture will retrieve a RenderTexture that is stored in the Phaser Cache. This method replaces Cache.getTexture which is now deprecated.
7980
* Cache.autoResolveURL is a new boolean (default `false`) that automatically builds a cached map of all loaded assets vs. their absolute URLs, for use with Cache.getURL and Cache.checkURL. Note that in 2.1.3 and earlier this was enabled by default, but has since been moved behind this property which needs to be set to `true` *before* you load any assets to enable.
8081
* You can now call Tween.to again on a Tween that has already completed. This will re-use the same tween, on the original object, without having to recreate the Tween again. This allows a single tween instance to be re-used multiple times, providing they are linked to the same object (thanks InsaneHero)
8182
* Phaser.Color.valueToColor converts a value: a "hex" string, a "CSS 'web' string", or a number - into red, green, blue, and alpha components (thanks @pnstickne #1264)
8283
* Stage.backgroundColor now supports CSS 'rgba' values, as well as hex strings and hex numbers (thanks @pnstickne #1234)
83-
84+
* Pointer.addClickTrampoline now adds in support for click trampolines. These raise pointer events into click events, which are required internally for a few edge cases like IE11 full screen mode support, but are also useful if you know you specifically need a DOM click event from a pointer (thanks @pnstickne #1282)
85+
* Point.floor will Math.floor both the `x` and `y` values of the Point.
86+
* Point.ceil will Math.ceil both the `x` and `y` values of the Point.
87+
* ScaleManager.scaleSprite takes a Sprite or Image object and scales it to fit the given dimensions. Scaling happens proportionally without distortion to the sprites texture. The letterBox parameter controls if scaling will produce a letter-box effect or zoom the sprite until it fills the given values.
88+
* Phaser.DOM.getBounds is a cross-browser element.getBoundingClientRect method with optional cushion.
89+
* Phaser.DOM.calibrate is a private method that calibrates element coordinates for viewport checks.
90+
* Phaser.DOM.aspect gets the viewport aspect ratio (or the aspect ratio of an object or element)
91+
* Phaser.DOM.inViewport tests if the given DOM element is within the viewport, with an optional cushion parameter that allows you to specify a distance.
92+
* Phaser.DOM.viewportWidth returns the viewport width in pixels.
93+
* Phaser.DOM.viewportHeight returns the viewport height in pixels.
94+
* Phaser.DOM.documentWidth returns the document width in pixels.
95+
* Phaser.DOM.documentHeight returns the document height in pixels.
96+
* TilemapLayers have been given a decent performance boost on canvas with map shifting edge-redraw (thanks @pnstickne #1250)
97+
* A large refactor to how the internal game timers and physics calculations has been made. We've now swapped to using a fixed time step internally across Phaser, instead of the variable one we had before that caused glitchse on low-fps systems. Thanks to pjbaron for his help with all of these related changes.
98+
* We have separated the logic and render updates to permit slow motion and time slicing effects. We've fixed time calling to fix physics problems caused by variable time updates (i.e. collisions sometimes missing, objects tunneling, etc)
99+
* Once per frame calling for rendering and tweening to keep things as smooth as possible
100+
* Calculates a `suggestedFps` value (in multiples of 5 fps) based on a 2 second average of actual elapsed time values in the `Time.update` method. This is recalculated every 2 seconds so it could be used on a level-by-level basis if a game varies dramatically. I.e. if the fps rate consistently drops, you can adjust your game effects accordingly.
101+
* Game loop now tries to "catch up" frames if it is falling behind by iterating the logic update. This will help if the logic is occasionally causing things to run too slow, or if the renderer occasionally pushes the combined frame time over the FPS time. It's not a band-aid for a game that floods a low powered device however, so you still need to code accordingly. But it should help capture issues such as gc spikes or temporarily overloaded CPUs.
102+
* It now detects 'spiralling' which happens if a lot of frames are pushed out in succession meaning the CPU can never "catch up". It skips frames instead of trying to catch them up in this case. Note: the time value passed to the logic update functions is always constant regardless of these shenanigans.
103+
* Signals to the game program if there is a problem which might be fixed by lowering the desiredFps
104+
* Time.desiredFps is the new desired frame rate for your game.
105+
* Time.suggestedFps is the suggested frame rate for the game based on system load.
106+
* Time.slowMotion allows you to push the game into a slow motion mode. The default value is 1.0. 2.0 would be half speed, and so on.
107+
* Time.timeCap is no longer used and now deprecated. All timing is now handled by the fixed time-step code we've introduced.
108+
* Time.now can no longer be relied upon to contain a timestamp value. If the browser supports requestAnimationFrame then `Time.now` will contain the high resolution timer value that rAf generates. Otherwise it will contain the value of Date.now. If you require the actual time value (in milliseconds) then please use `Time.time` instead. Note that all Phaser sub-systems that used to rely on `Time.now` have been updated, so if you have any code that extends these please be sure to check it.
109+
* Game.forceSingleUpdate will force just a single logic update, regardless of the delta timer values. You can use this in extremely heavy CPU situations where you know you're about to flood the CPU but don't want Phaser to get stuck in a spiral.
110+
* Tilemap.createFromTiles will convert all tiles matching the given tile index (or an array of indexes) into Sprites. You can optionally then replace these tiles if you wish. This is perfect for games when you want to turn specific tiles into Sprites for extra control. The Sprites have an optional properties object which they can be populated with.
84111

85112
### Updates
86113

87114
* TypeScript definitions fixes and updates (thanks @clark-stevenson)
115+
* The TypeScript definitions have moved to the `typescript` folder in the root of the repository.
88116
* Cache._resolveUrl has been renamed to Cache._resolveURL internally and gained a new parameter. This method is a private internal one.
89117
* Cache.getUrl is deprecated. The same method is now available as Cache.getURL.
90118
* Loader.useXDomainRequest used to be enabled automatically for IE9 but is now always set to `false`. Please enable it only if you know your server set-up / CDN requires it, as some most certainly do, but we're finding them to be less and less used these days, so we feel it's safe to now disable this by default (#1248)
@@ -94,18 +122,70 @@ Version 2.1.4 - "Bethal" - in development
94122
* Phaser.Polygon has been refactored to address some Pixi v2 migration issues (thanks @pnstickne for the original implementation #1267)
95123
* Polygon.area is now only calculated when the Polygon points list is modified, rather than on every call.
96124
* Phaser.Polygon can now accept the points list in a variety of formats: Arrays of Points, numbers, objects with public x/y properties or any combination of, or as a parameter list (thanks @pnstickne for the original implementation #1267)
125+
* All of the Input classes now use the more consistent `enabled` property instead of `disabled`. I.e. you can now check `if (input.mouse.enabled)` rather than `if (!input.mouse.disabled)`. The disabled property has been moved to a getter for backwards compatibility but is deprecated and will be removed in a future version (thanks @pnstickne #1257)
126+
* The Input class has been given a minor refactor to tidy things up. Specifically:
127+
* pointerN are aliases to backed pointers[N-1] array. This simplifies (and increases the efficiency of) looping through all the pointers when applicable; also eliminates pointer-existance checks Removes various hard-coded limits (added MAX_POINTERS); changed maxPointers default
128+
* Removed some special-casing from cases where it did not matter
129+
* Removed === false/true, == usage for consistency, changed missing value check to typeof, etc.
130+
* Updated documentation for specificty; added @public\@protected
131+
* @deprecated currentPointers due to odd set pattern; totalCurrentPointers is more appropriate.
132+
(thanks @pnstickne #1283)
133+
* Various ScaleManager fixes and updates (thanks @pnstickne):
134+
* Scale modes can now be set independently
135+
* Switching between fullscreen and normal correctly restores modes
136+
* Alignment does not incorrectly offset in fullscreen mode (#1255)
137+
* Changing scale/alignment promptly refreshes layout
138+
* `isFullScreen` returns a boolean, as it should
139+
* Faster parent checks (if required)
140+
* NO_SCALE should not not scale (vs previous behavior of having no behavior)
141+
* Correct usage of scaleMode depending on mode
142+
* AudioSprite - removed an unnecessary if-statement (thanks @DaanHaaz #1312)
143+
* ArcadePhysics.skipQuadTree is now set to `true` by default. A QuadTree is a wonderful thing if the objects in your game are well spaced out. But in tightly packed games, especially those with tilemaps or single-screen games, they are a considerable performance drain and eat up CPU. We've taken the decision to disable the Arcade Physics QuadTree by default. It's all still in there and can be re-enabled via `game.physics.arcade.skipQuadTree = false`, but please only do so if you're sure your game benefits from this.
144+
* Phaser.DOM now houses new DOM functions. Some have been moved over from ScaleManager as appropriate.
97145

98146
### Bug Fixes
99147

100148
* Tilemaps in WebGL wouldn't update after the first frame due to a subtle change in how Pixi uploads new textures to the GPU.
101149
* XML files weren't being added to the URL map.
102150
* Cache._resolveURL was causing a Sound double-load in Firefox and causing errors (thanks @domonyiv #1253)
103151
* Loader.json was using the wrong context in IE9 with XDomainRequest calls (thanks @pnstickne #1258)
104-
* Polygon.contains was toggling the return value on each valid hit (thanks @Singularetantum #1265 #1266)
105152
* Text.updateText was incorrectly increasing the size of the texture each time it was called (thanks @spayton #1261)
106153
* Polygon.contains now correctly calculates the result (thanks @pnstickne @BurnedToast #1267)
107154
* Setting Key.enabled = false while it is down did not reset the isDown state (thanks @pnstickne #1190 #1271)
108-
155+
* The Gamepad.addCallbacks context parameter was never actually remembered, causing the callbacks to run in the wrong context (thanks @englercj #1285)
156+
* Animation.setFrame used the wrong frames array if `useLocalFrameIndex` was `false` and a numeric frame ID was given (thanks @Skeptron #1284)
157+
* Fullscreen mode in IE11 now works (thanks @pnstickne)
158+
* Cache.addBitmapData now auto-creates a FrameData (thanks @pnstickne #1294 #1300)
159+
* P2.BodyDebug circles were drawing at half widths (thanks @enriqueto #1288)
160+
* FrameData.clone fixed when cloning data using frame names rather than indexes (thanks pjbaron)
161+
* Lots of the Cache getters (such as `Cache.getbitmapData`) would return `undefined` if the asset couldn't be found. They now all consistently return `null` for missing entries (thanks @Matoking #1305)
162+
* Phaser games should now work again from the CocoonJS Launcher.
163+
164+
### Pixi 2.1.0 New Features
165+
166+
* unloadFromGPU added to PIXI.BaseTexture
167+
* PIXI.VideoTexture added
168+
* PIXI.RoundedRectangle added
169+
* Ensured all float32arrays use PIXI.Float32Array
170+
* Removed the use of call in updateTransform (as its 10x faster to run the function directly)
171+
* autoResize option added to renderer options (default is false). Pixi no longer automatically changes the style of the canvas.
172+
* PIXI.RenderTexture.getCanvas optimized
173+
174+
### Pixi 2.1.0 Bug Fixes
175+
176+
* Fix destroy method of PIXI.WebGLRenderer
177+
* Fixed Graphics.drawRoundedRectangle
178+
* Fixed Graphics.arcTo issue
179+
* Fixed Graphics.arc issue
180+
* Fixed Graphics.cacheAsBitmap alpha issue
181+
* Fixed PIXI.Strip alpha issue
182+
* Fixed PIXI.DisplayObject.cacheAsBitmap alpha issue
183+
* Fixed PIXI.RenderTexture Canvas Clear bug
184+
* Fixed PIXI.DisplayObject.updateTransform issue
185+
* Fixed webGL Shader textures issue
186+
* Fixed PIXI.DisplayObject.getLocalPosition()
187+
* Fixed CocoonJS crashing, when loading destroyed texture
188+
* Fix eventTarget emit bug
109189

110190
For details about changes made in previous versions of Phaser see the full Change Log at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
111191

@@ -157,11 +237,11 @@ Nice and easy :)
157237

158238
Phaser is now available on [CDNJS](http://cdnjs.com). You can include the following in your html:
159239

160-
`http://cdnjs.cloudflare.com/ajax/libs/phaser/2.1.4/phaser.min.js`
240+
`http://cdnjs.cloudflare.com/ajax/libs/phaser/2.2.0/phaser.min.js`
161241

162242
Or if you prefer you can leave the protocol off, so it works via http and https:
163243

164-
`//cdnjs.cloudflare.com/ajax/libs/phaser/2.1.4/phaser.min.js`
244+
`//cdnjs.cloudflare.com/ajax/libs/phaser/2.2.0/phaser.min.js`
165245

166246
![div](http://phaser.io/images/div1.png)
167247

@@ -178,7 +258,7 @@ If you need to support IE9 or Android 2.x and want to use P2 physics then you mu
178258

179259
Phaser is developed in JavaScript. We've made no assumptions about how you like to code your games, and were careful not to impose any form of class / inheritance / structure upon you. So you won't find it split into require modules or pull in 3rd party npm packages for example. That doesn't mean you can't, it just means we don't force you to do so. If you're a requireJS user you'll find a new template in the `resources\Project Templates` folder just for you.
180260

181-
If you code with [TypeScript](http://www.typescriptlang.org/) you'll find a comprehensive definitions file inside the `build` folder and tutorials on getting started. This definitions file is for TypeScript 1.0+. If you are using an earlier version of TypeScript (i.e. 0.9.5) you will need to include the WebGL definitions into your project first. This file isn't included with Phaser.
261+
If you code with [TypeScript](http://www.typescriptlang.org/) you'll find a comprehensive definitions file inside the `typescript` folder and tutorials on getting started on our site. This definitions file is for TypeScript 1.0+. If you are using an earlier version of TypeScript (i.e. 0.9.5) you will need to include the WebGL definitions into your project first. This file isn't included with Phaser.
182262

183263
<a name="build-files"></a>
184264
### Build Files and Custom Builds

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "phaser",
3-
"version": "2.1.4",
3+
"version": "2.2.0",
44
"homepage": "http://phaser.io",
55
"authors": [
66
"photonstorm <rich@photonstorm.com>"

build/config.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
<script src="$path/src/pixi/Pixi.js"></script>
4040
<script src="$path/src/pixi/geom/Matrix.js"></script>
4141
<script src="$path/src/pixi/geom/Polygon.js"></script>
42+
<script src="$path/src/pixi/geom/Rectangle.js"></script>
43+
<script src="$path/src/pixi/geom/RoundedRectangle.js"></script>
4244
<script src="$path/src/pixi/display/DisplayObject.js"></script>
4345
<script src="$path/src/pixi/display/DisplayObjectContainer.js"></script>
4446
<script src="$path/src/pixi/display/Sprite.js"></script>
@@ -139,6 +141,7 @@
139141
<script src="$path/src/gameobjects/Particle.js"></script>
140142
<script src="$path/src/gameobjects/Rope.js"></script>
141143
144+
<script src="$path/src/system/DOM.js"></script>
142145
<script src="$path/src/system/Canvas.js"></script>
143146
<script src="$path/src/system/Device.js"></script>
144147
<script src="$path/src/system/RequestAnimationFrame.js"></script>

build/custom/ninja.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/custom/p2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17902,7 +17902,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
1790217902
if (typeof color === 'undefined') { color = 0xffffff; }
1790317903
g.lineStyle(lineWidth, 0x000000, 1);
1790417904
g.beginFill(color, 1.0);
17905-
g.drawCircle(x, y, -radius);
17905+
g.drawCircle(x, y, -radius*2);
1790617906
g.endFill();
1790717907
g.moveTo(x, y);
1790817908
g.lineTo(x + radius * Math.cos(-angle), y + radius * Math.sin(-angle));

build/custom/p2.min.js

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

0 commit comments

Comments
 (0)