Skip to content

Commit b27130c

Browse files
author
Jeroen Reurings
committed
Merge branch 'master' of https://github.com/photonstorm/phaser
2 parents 9006f19 + 19a0828 commit b27130c

58 files changed

Lines changed: 541 additions & 568 deletions

Some content is hidden

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

src/animations/Animation.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ var GetValue = require('../utils/object/GetValue');
1111
/**
1212
* @classdesc
1313
* A Frame based Animation.
14-
*
14+
*
1515
* This consists of a key, some default values (like the frame rate) and a bunch of Frame objects.
16-
*
16+
*
1717
* The Animation Manager creates these. Game Objects don't own an instance of these directly.
1818
* Game Objects have the Animation Component, which are like playheads to global Animations (these objects)
1919
* So multiple Game Objects can have playheads all pointing to this one Animation instance.
@@ -303,7 +303,7 @@ var Animation = new Class({
303303
* @method Phaser.Animations.Animation#addFrame
304304
* @since 3.0.0
305305
*
306-
* @param {[type]} config - [description]
306+
* @param {string|object[]} config - [description]
307307
*
308308
* @return {Phaser.Animations.Animation} This Animation object.
309309
*/
@@ -326,7 +326,7 @@ var Animation = new Class({
326326
* @since 3.0.0
327327
*
328328
* @param {integer} index - [description]
329-
* @param {[type]} config - [description]
329+
* @param {string|object[]} config - [description]
330330
*
331331
* @return {Phaser.Animations.Animation} This Animation object.
332332
*/
@@ -436,7 +436,8 @@ var Animation = new Class({
436436
* @since 3.0.0
437437
*
438438
* @param {Phaser.Textures.TextureManager} textureManager - [description]
439-
* @param {[type]} frames - [description]
439+
* @param {string|object[]} frames - [description]
440+
* @param {string} [defaultTextureKey] - [description]
440441
*
441442
* @return {Phaser.Animations.AnimationFrame[]} [description]
442443
*/

src/display/canvas/CanvasPool.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ var CanvasPool = function ()
3232
* @function Phaser.Display.Canvas.CanvasPool.create
3333
* @since 3.0.0
3434
*
35-
* @param {any} parent - [description]
36-
* @param {integer} [width=1] - [description]
37-
* @param {integer} [height=1] - [description]
38-
* @param {integer} [type] - [description]
35+
* @param {any} parent - The parent of the Canvas object.
36+
* @param {integer} [width=1] - The width of the Canvas.
37+
* @param {integer} [height=1] - The height of the Canvas.
38+
* @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`.
3939
*
4040
* @return {HTMLCanvasElement} [description]
4141
*/
42-
var create = function (parent, width, height, type)
42+
var create = function (parent, width, height, canvasType)
4343
{
4444
if (width === undefined) { width = 1; }
4545
if (height === undefined) { height = 1; }
46-
if (type === undefined) { type = CONST.CANVAS; }
46+
if (canvasType === undefined) { canvasType = CONST.CANVAS; }
4747

4848
var canvas;
49-
var container = first(type);
49+
var container = first(canvasType);
5050

5151
if (container === null)
5252
{
5353
container = {
5454
parent: parent,
5555
canvas: document.createElement('canvas'),
56-
type: type
56+
type: canvasType
5757
};
5858

5959
pool.push(container);
@@ -70,7 +70,7 @@ var CanvasPool = function ()
7070
canvas.width = width;
7171
canvas.height = height;
7272

73-
if (_disableContextSmoothing && type === CONST.CANVAS)
73+
if (_disableContextSmoothing && canvasType === CONST.CANVAS)
7474
{
7575
Smoothing.disable(canvas.getContext('2d'));
7676
}
@@ -84,9 +84,9 @@ var CanvasPool = function ()
8484
* @function Phaser.Display.Canvas.CanvasPool.create2D
8585
* @since 3.0.0
8686
*
87-
* @param {any} parent - [description]
88-
* @param {integer} [width=1] - [description]
89-
* @param {integer} [height=1] - [description]
87+
* @param {any} parent - The parent of the Canvas object.
88+
* @param {integer} [width=1] - The width of the Canvas.
89+
* @param {integer} [height=1] - The height of the Canvas.
9090
*
9191
* @return {HTMLCanvasElement} [description]
9292
*/
@@ -101,9 +101,9 @@ var CanvasPool = function ()
101101
* @function Phaser.Display.Canvas.CanvasPool.createWebGL
102102
* @since 3.0.0
103103
*
104-
* @param {any} parent - [description]
105-
* @param {integer} [width=1] - [description]
106-
* @param {integer} [height=1] - [description]
104+
* @param {any} parent - The parent of the Canvas object.
105+
* @param {integer} [width=1] - The width of the Canvas.
106+
* @param {integer} [height=1] - The height of the Canvas.
107107
*
108108
* @return {HTMLCanvasElement} [description]
109109
*/
@@ -118,17 +118,17 @@ var CanvasPool = function ()
118118
* @function Phaser.Display.Canvas.CanvasPool.first
119119
* @since 3.0.0
120120
*
121-
* @param {integer} [type] - [description]
121+
* @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`.
122122
*
123123
* @return {HTMLCanvasElement} [description]
124124
*/
125-
var first = function (type)
125+
var first = function (canvasType)
126126
{
127-
if (type === undefined) { type = CONST.CANVAS; }
127+
if (canvasType === undefined) { canvasType = CONST.CANVAS; }
128128

129129
pool.forEach(function (container)
130130
{
131-
if (!container.parent && container.type === type)
131+
if (!container.parent && container.type === canvasType)
132132
{
133133
return container;
134134
}

src/display/canvas/Smoothing.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ var Smoothing = function ()
1818
*
1919
* @function Phaser.Display.Canvas.Smoothing.getPrefix
2020
* @since 3.0.0
21-
*
22-
* @param {[type]} context - [description]
23-
*
21+
*
22+
* @param {CanvasRenderingContext2D|WebGLRenderingContext} context - [description]
23+
*
2424
* @return {string} [description]
2525
*/
2626
var getPrefix = function (context)
@@ -49,10 +49,10 @@ var Smoothing = function ()
4949
*
5050
* @function Phaser.Display.Canvas.Smoothing.enable
5151
* @since 3.0.0
52-
*
53-
* @param {[type]} context - [description]
54-
*
55-
* @return {[type]} [description]
52+
*
53+
* @param {CanvasRenderingContext2D|WebGLRenderingContext} context - [description]
54+
*
55+
* @return {CanvasRenderingContext2D|WebGLRenderingContext} [description]
5656
*/
5757
var enable = function (context)
5858
{
@@ -78,10 +78,10 @@ var Smoothing = function ()
7878
*
7979
* @function Phaser.Display.Canvas.Smoothing.disable
8080
* @since 3.0.0
81-
*
82-
* @param {[type]} context - [description]
83-
*
84-
* @return {[type]} [description]
81+
*
82+
* @param {CanvasRenderingContext2D|WebGLRenderingContext} context - [description]
83+
*
84+
* @return {CanvasRenderingContext2D|WebGLRenderingContext} [description]
8585
*/
8686
var disable = function (context)
8787
{
@@ -104,10 +104,10 @@ var Smoothing = function ()
104104
*
105105
* @function Phaser.Display.Canvas.Smoothing.isEnabled
106106
* @since 3.0.0
107-
*
108-
* @param {[type]} context - [description]
109-
*
110-
* @return {boolean} [description]
107+
*
108+
* @param {CanvasRenderingContext2D|WebGLRenderingContext} context - [description]
109+
*
110+
* @return {boolean|null} [description]
111111
*/
112112
var isEnabled = function (context)
113113
{

src/display/mask/BitmapMask.js

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,50 +16,30 @@ var Class = require('../../utils/Class');
1616
* @since 3.0.0
1717
*
1818
* @param {Phaser.Scene} scene - [description]
19-
* @param {[type]} renderable - [description]
19+
* @param {Phaser.GameObjects.GameObject} renderable - A renderable Game Object that uses a texture, such as a Sprite.
2020
*/
2121
var BitmapMask = new Class({
22-
22+
2323
initialize:
2424

2525
function BitmapMask (scene, renderable)
2626
{
2727
var renderer = scene.sys.game.renderer;
2828

2929
/**
30-
* [description]
30+
* A renderable Game Object that uses a texture, such as a Sprite.
3131
*
3232
* @name Phaser.Display.Masks.BitmapMask#bitmapMask
33-
* @type {[type]}
33+
* @type {Phaser.GameObjects.GameObject}
3434
* @since 3.0.0
3535
*/
3636
this.bitmapMask = renderable;
3737

38-
/**
39-
* [description]
40-
*
41-
* @name Phaser.Display.Masks.BitmapMask#maskRenderTarget
42-
* @type {[type]}
43-
* @default null
44-
* @since 3.0.0
45-
*/
46-
this.maskRenderTarget = null;
47-
48-
/**
49-
* [description]
50-
*
51-
* @name Phaser.Display.Masks.BitmapMask#mainRenderTarget
52-
* @type {[type]}
53-
* @default null
54-
* @since 3.0.0
55-
*/
56-
this.mainRenderTarget = null;
57-
5838
/**
5939
* [description]
6040
*
6141
* @name Phaser.Display.Masks.BitmapMask#maskTexture
62-
* @type {[type]}
42+
* @type {WebGLTexture}
6343
* @default null
6444
* @since 3.0.0
6545
*/
@@ -69,7 +49,7 @@ var BitmapMask = new Class({
6949
* [description]
7050
*
7151
* @name Phaser.Display.Masks.BitmapMask#mainTexture
72-
* @type {[type]}
52+
* @type {WebGLTexture}
7353
* @default null
7454
* @since 3.0.0
7555
*/
@@ -125,7 +105,7 @@ var BitmapMask = new Class({
125105
this.maskTexture = renderer.createTexture2D(0, filter, filter, wrap, wrap, gl.RGBA, null, width, height);
126106
this.mainFramebuffer = renderer.createFramebuffer(width, height, this.mainTexture, false);
127107
this.maskFramebuffer = renderer.createFramebuffer(width, height, this.maskTexture, false);
128-
108+
129109
renderer.onContextRestored(function (renderer)
130110
{
131111
var width = renderer.width;
@@ -150,7 +130,7 @@ var BitmapMask = new Class({
150130
* @method Phaser.Display.Masks.BitmapMask#setBitmap
151131
* @since 3.0.0
152132
*
153-
* @param {[type]} renderable - [description]
133+
* @param {Phaser.GameObjects.GameObject} renderable - A renderable Game Object that uses a texture, such as a Sprite.
154134
*/
155135
setBitmap: function (renderable)
156136
{
@@ -163,8 +143,8 @@ var BitmapMask = new Class({
163143
* @method Phaser.Display.Masks.BitmapMask#preRenderWebGL
164144
* @since 3.0.0
165145
*
166-
* @param {[type]} renderer - [description]
167-
* @param {[type]} maskedObject - [description]
146+
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
147+
* @param {Phaser.GameObjects.GameObject} maskedObject - [description]
168148
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to.
169149
*/
170150
preRenderWebGL: function (renderer, maskedObject, camera)
@@ -178,7 +158,7 @@ var BitmapMask = new Class({
178158
* @method Phaser.Display.Masks.BitmapMask#postRenderWebGL
179159
* @since 3.0.0
180160
*
181-
* @param {[type]} renderer - [description]
161+
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
182162
*/
183163
postRenderWebGL: function (renderer)
184164
{
@@ -191,8 +171,8 @@ var BitmapMask = new Class({
191171
* @method Phaser.Display.Masks.BitmapMask#preRenderCanvas
192172
* @since 3.0.0
193173
*
194-
* @param {[type]} renderer - [description]
195-
* @param {[type]} mask - [description]
174+
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
175+
* @param {Phaser.GameObjects.GameObject} mask - [description]
196176
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to render to.
197177
*/
198178
preRenderCanvas: function ()
@@ -206,7 +186,7 @@ var BitmapMask = new Class({
206186
* @method Phaser.Display.Masks.BitmapMask#postRenderCanvas
207187
* @since 3.0.0
208188
*
209-
* @param {[type]} renderer - [description]
189+
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
210190
*/
211191
postRenderCanvas: function ()
212192
{

src/display/mask/GeometryMask.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var Class = require('../../utils/Class');
1616
* @since 3.0.0
1717
*
1818
* @param {Phaser.Scene} scene - [description]
19-
* @param {[type]} graphicsGeometry - [description]
19+
* @param {Phaser.GameObjects.Graphics} graphicsGeometry - [description]
2020
*/
2121
var GeometryMask = new Class({
2222

@@ -53,8 +53,8 @@ var GeometryMask = new Class({
5353
* @method Phaser.Display.Masks.GeometryMask#preRenderWebGL
5454
* @since 3.0.0
5555
*
56-
* @param {[type]} renderer - [description]
57-
* @param {[type]} mask - [description]
56+
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
57+
* @param {Phaser.GameObjects.GameObject} mask - [description]
5858
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
5959
*/
6060
preRenderWebGL: function (renderer, mask, camera)
@@ -88,7 +88,7 @@ var GeometryMask = new Class({
8888
* @method Phaser.Display.Masks.GeometryMask#postRenderWebGL
8989
* @since 3.0.0
9090
*
91-
* @param {[type]} renderer - [description]
91+
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
9292
*/
9393
postRenderWebGL: function (renderer)
9494
{
@@ -105,8 +105,8 @@ var GeometryMask = new Class({
105105
* @method Phaser.Display.Masks.GeometryMask#preRenderCanvas
106106
* @since 3.0.0
107107
*
108-
* @param {[type]} renderer - [description]
109-
* @param {[type]} mask - [description]
108+
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
109+
* @param {Phaser.GameObjects.GameObject} mask - [description]
110110
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
111111
*/
112112
preRenderCanvas: function (renderer, mask, camera)
@@ -126,7 +126,7 @@ var GeometryMask = new Class({
126126
* @method Phaser.Display.Masks.GeometryMask#postRenderCanvas
127127
* @since 3.0.0
128128
*
129-
* @param {[type]} renderer - [description]
129+
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
130130
*/
131131
postRenderCanvas: function (renderer)
132132
{

src/gameobjects/GameObjectCreator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ var GameObjectCreator = new Class({
120120

121121
// Static method called directly by the Game Object creator functions
122122

123-
GameObjectCreator.register = function (type, factoryFunction)
123+
GameObjectCreator.register = function (factoryType, factoryFunction)
124124
{
125-
if (!GameObjectCreator.prototype.hasOwnProperty(type))
125+
if (!GameObjectCreator.prototype.hasOwnProperty(factoryType))
126126
{
127-
GameObjectCreator.prototype[type] = factoryFunction;
127+
GameObjectCreator.prototype[factoryType] = factoryFunction;
128128
}
129129
};
130130

src/gameobjects/GameObjectFactory.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ var GameObjectFactory = new Class({
147147

148148
// Static method called directly by the Game Object factory functions
149149

150-
GameObjectFactory.register = function (type, factoryFunction)
150+
GameObjectFactory.register = function (factoryType, factoryFunction)
151151
{
152-
if (!GameObjectFactory.prototype.hasOwnProperty(type))
152+
if (!GameObjectFactory.prototype.hasOwnProperty(factoryType))
153153
{
154-
GameObjectFactory.prototype[type] = factoryFunction;
154+
GameObjectFactory.prototype[factoryType] = factoryFunction;
155155
}
156156
};
157157

0 commit comments

Comments
 (0)