Skip to content

Commit 77e0422

Browse files
committed
Merge branch 'master' into rendering-cleanup
2 parents 7b3c2c6 + 1f72b90 commit 77e0422

338 files changed

Lines changed: 3163 additions & 349 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.

src/animations/Animation.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,6 @@ var Animation = new Class({
462462
});
463463
}
464464

465-
// console.table(frames);
466-
467465
if (!Array.isArray(frames) || frames.length === 0)
468466
{
469467
return out;
@@ -480,23 +478,17 @@ var Animation = new Class({
480478
continue;
481479
}
482480

481+
// Could be an integer or a string
483482
var frame = GetValue(item, 'frame', 0);
484483

484+
// The actual texture frame
485485
var textureFrame = textureManager.getFrame(key, frame);
486486

487487
animationFrame = new Frame(key, frame, index, textureFrame);
488488

489489
animationFrame.duration = GetValue(item, 'duration', 0);
490490
animationFrame.onUpdate = GetValue(item, 'onUpdate', null);
491491

492-
var visible = GetValue(item, 'visible', null);
493-
494-
if (visible !== null)
495-
{
496-
animationFrame.setVisible = true;
497-
animationFrame.visible = visible;
498-
}
499-
500492
animationFrame.isFirst = (!prev);
501493

502494
// The previously created animationFrame

src/animations/AnimationFrame.js

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,156 @@
11
var Class = require('../utils/Class');
22

3-
// Phaser.Animations.AnimationFrame
4-
53
var AnimationFrame = new Class({
64

75
initialize:
86

97
/**
10-
* [description]
8+
* A single frame in an Animation sequence.
9+
*
10+
* An AnimationFrame consists of a reference to the Texture it uses for rendering, references to other
11+
* frames in the animation, and index data. It also has the ability to fire its own `onUpdate` callback
12+
* and modify the animation timing.
13+
*
14+
* AnimationFrames are generated automatically by the Animation class.
1115
*
1216
* @class AnimationFrame
13-
* @memberOf Phaser.Animations.AnimationFrame
17+
* @memberOf Phaser.Animations
1418
* @constructor
1519
* @since 3.0.0
1620
*
17-
* @param {undefined} textureKey - [description]
18-
* @param {undefined} textureFrame - [description]
19-
* @param {undefined} index - [description]
20-
* @param {undefined} frame - [description]
21+
* @param {string} textureKey - The key of the Texture this AnimationFrame uses.
22+
* @param {string|integer} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses.
23+
* @param {integer} index - The index of this AnimationFrame within the Animation sequence.
24+
* @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering.
2125
*/
2226
function AnimationFrame (textureKey, textureFrame, index, frame)
2327
{
24-
// The keys into the Texture Manager of the texture + frame this uses
25-
2628
/**
27-
* [description]
29+
* The key of the Texture this AnimationFrame uses.
2830
*
2931
* @property {string} textureKey
32+
* @since 3.0.0
3033
*/
3134
this.textureKey = textureKey;
3235

3336
/**
34-
* [description]
37+
* The key of the Frame within the Texture that this AnimationFrame uses.
3538
*
36-
* @property {Phaser.Textures.Frame} textureFrame
39+
* @property {string|integer} textureFrame
40+
* @since 3.0.0
3741
*/
3842
this.textureFrame = textureFrame;
3943

40-
// The index of this frame within the Animation.frames array
41-
4244
/**
43-
* [description]
45+
* The index of this AnimationFrame within the Animation sequence.
4446
*
4547
* @property {integer} index
48+
* @since 3.0.0
4649
*/
4750
this.index = index;
4851

49-
// Texture Frame
50-
5152
/**
52-
* [description]
53+
* A reference to the Texture Frame this AnimationFrame uses for rendering.
5354
*
5455
* @property {Phaser.Textures.Frame} frame
56+
* @since 3.0.0
5557
*/
5658
this.frame = frame;
5759

58-
// Read-only
59-
6060
/**
61-
* [description]
61+
* Is this the first frame in an animation sequence?
6262
*
6363
* @property {boolean} isFirst
6464
* @default false
65+
* @readOnly
66+
* @since 3.0.0
6567
*/
6668
this.isFirst = false;
6769

68-
// Read-only
69-
7070
/**
71-
* [description]
71+
* Is this the last frame in an animation sequence?
7272
*
7373
* @property {boolean} isLast
7474
* @default false
75+
* @readOnly
76+
* @since 3.0.0
7577
*/
7678
this.isLast = false;
7779

78-
// The frame that comes before this one in the animation (if any)
79-
// Read-only
80-
8180
/**
82-
* [description]
81+
* A reference to the AnimationFrame that comes before this one in the animation, if any.
8382
*
84-
* @property {?[type]} prevFrame
83+
* @property {?Phaser.Animations.AnimationFrame} prevFrame
8584
* @default null
85+
* @readOnly
86+
* @since 3.0.0
8687
*/
8788
this.prevFrame = null;
8889

89-
// The frame that comes after this one in the animation (if any)
90-
// Read-only
91-
9290
/**
93-
* [description]
91+
* A reference to the AnimationFrame that comes after this one in the animation, if any.
9492
*
95-
* @property {?[type]} nextFrame
93+
* @property {?Phaser.Animations.AnimationFrame} nextFrame
9694
* @default null
95+
* @readOnly
96+
* @since 3.0.0
9797
*/
9898
this.nextFrame = null;
9999

100-
// Additional time (in ms) this frame should appear for - added onto the msPerFrame
101-
102100
/**
103-
* [description]
101+
* Additional time (in ms) that this frame should appear for during playback.
102+
* The value is added onto the msPerFrame set by the animation.
104103
*
105104
* @property {number} duration
106105
* @default 0
106+
* @since 3.0.0
107107
*/
108108
this.duration = 0;
109109

110-
// What % through the animation progress is this frame?
111-
// Read-only
112-
113110
/**
114-
* [description]
111+
* What % through the animation does this frame come?
112+
* This value is generated when the animation is created and cached here.
115113
*
116114
* @property {number} progress
117115
* @default 0
116+
* @readOnly
117+
* @since 3.0.0
118118
*/
119119
this.progress = 0;
120120

121-
// Callback if this frame gets displayed
122-
123121
/**
124-
* [description]
122+
* A frame specific callback, invoked if this frame gets displayed and the callback is set.
125123
*
126-
* @property {?[type]} onUpdate
124+
* @property {?function} onUpdate
127125
* @default null
126+
* @since 3.0.0
128127
*/
129128
this.onUpdate = null;
130-
131-
// When this frame hits, set sprite.visible to this
132-
133-
/**
134-
* [description]
135-
*
136-
* @property {boolean} setVisible
137-
* @default false
138-
*/
139-
this.setVisible = false;
140-
141-
this.visible = false;
142129
},
143130

131+
/**
132+
* Generates a JavaScript object suitable for converting to JSON.
133+
*
134+
* @method Phaser.Animations.AnimationFrame#toJSON
135+
* @since 3.0.0
136+
*
137+
* @return {object} The AnimationFrame data.
138+
*/
144139
toJSON: function ()
145140
{
146141
return {
147142
key: this.textureKey,
148143
frame: this.textureFrame,
149-
duration: this.duration,
150-
visible: this.visible
144+
duration: this.duration
151145
};
152146
},
153147

148+
/**
149+
* Destroys this object by removing references to external resources and callbacks.
150+
*
151+
* @method Phaser.Animations.AnimationFrame#destroy
152+
* @since 3.0.0
153+
*/
154154
destroy: function ()
155155
{
156156
this.frame = undefined;

src/boot/Config.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,22 @@ var ValueToColor = require('../display/color/ValueToColor');
2323
*/
2424

2525
/**
26-
* @typedef {object} GameConfig
26+
* @typedef {object} LoaderConfig
2727
*
28-
* @todo Add Physics Config
28+
* @property {string} [baseURL] - [description]
29+
* @property {string} [path] - [description]
30+
* @property {boolean} [enableParallel=true] - [description]
31+
* @property {integer} [maxParallelDownloads=4] - [description]
32+
* @property {string|undefined} [crossOrigin=undefined] - [description]
33+
* @property {string} [responseType] - [description]
34+
* @property {boolean} [async=true] - [description]
35+
* @property {string} [user] - [description]
36+
* @property {string} [password] - [description]
37+
* @property {integer} [timeout=0] - [description]
38+
*/
39+
40+
/**
41+
* @typedef {object} GameConfig
2942
*
3043
* @property {integer|string} [width=1024] - [description]
3144
* @property {integer|string} [height=768] - [description]
@@ -59,11 +72,10 @@ var ValueToColor = require('../display/color/ValueToColor');
5972
* @property {boolean} [transparent=false] - [description]
6073
* @property {boolean} [clearBeforeRender=true] - [description]
6174
* @property {string|number} [backgroundColor=0x000000] - [description]
62-
* @property {boolean} [preserveDrawingBuffer=false] - [description]
6375
* @property {object} [?callbacks] - [description]
6476
* @property {function} [callbacks.preBoot=NOOP] - [description]
6577
* @property {function} [callbacks.postBoot=NOOP] - [description]
66-
* @property {boolean} [useTicker=false] - [description]
78+
* @property {LoaderConfig} [?loader] - [description]
6779
* @property {object} [?images] - [description]
6880
* @property {string} [images.default] - [description]
6981
* @property {string} [images.missing] - [description]
@@ -164,14 +176,11 @@ var Config = new Class({
164176
this.transparent = GetValue(config, 'transparent', false);
165177
this.clearBeforeRender = GetValue(config, 'clearBeforeRender', true);
166178
this.backgroundColor = ValueToColor(GetValue(config, 'backgroundColor', 0));
167-
this.preserveDrawingBuffer = GetValue(config, 'preserveDrawingBuffer', false);
168179

169180
// Callbacks
170181
this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP);
171182
this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP);
172183

173-
this.useTicker = GetValue(config, 'useTicker', false);
174-
175184
// Physics
176185
// physics: {
177186
// system: 'impact',

src/boot/CreateRenderer.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
var CONST = require('../const');
1+
var CanvasInterpolation = require('../display/canvas/CanvasInterpolation');
22
var CanvasPool = require('../display/canvas/CanvasPool');
3+
var CONST = require('../const');
34
var Features = require('../device/Features');
4-
var CanvasInterpolation = require('../display/canvas/CanvasInterpolation');
55

66
/**
7-
* [description]
7+
* Called automatically by Phaser.Game and responsible for creating the renderer it will use.
8+
*
9+
* Relies upon two webpack global flags to be defined: `WEBGL_RENDERER` and `CANVAS_RENDERER` during build time, but not at run-time.
810
*
911
* @function Phaser.Boot.CreateRenderer
1012
* @since 3.0.0
1113
*
12-
* @param {Phaser.Game} game - [description]
14+
* @param {Phaser.Game} game - The Phaser.Game instance on which the renderer will be set.
1315
*/
1416
var CreateRenderer = function (game)
1517
{

src/boot/DebugHeader.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
var CONST = require('../const');
21
var CHECKSUM = require('../checksum');
2+
var CONST = require('../const');
33

44
/**
5-
* [description]
5+
* Called automatically by Phaser.Game and responsible for creating the console.log debug header.
6+
*
7+
* You can customize or disable the header via the Game Config object.
68
*
79
* @function Phaser.Boot.DebugHeader
810
* @since 3.0.0
911
*
10-
* @param {Phaser.Game} game - [description]
12+
* @param {Phaser.Game} game - The Phaser.Game instance which will output this debug header.
1113
*/
1214
var DebugHeader = function (game)
1315
{
@@ -25,11 +27,11 @@ var DebugHeader = function (game)
2527

2628
var audioType;
2729

28-
if(deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
30+
if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
2931
{
3032
audioType = 'Web Audio';
3133
}
32-
else if((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
34+
else if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
3335
{
3436
audioType = 'No Audio';
3537
}
@@ -38,9 +40,7 @@ var DebugHeader = function (game)
3840
audioType = 'HTML5 Audio';
3941
}
4042

41-
var ie = false;
42-
43-
if (!ie)
43+
if (!game.device.Browser.ie)
4444
{
4545
var c = '';
4646
var args = [ c ];
@@ -103,9 +103,6 @@ var DebugHeader = function (game)
103103
{
104104
console.log('Phaser v' + CONST.VERSION + ' / http://phaser.io');
105105
}
106-
107-
// Keep this during dev build only
108-
// console.log(CHECKSUM.build);
109106
};
110107

111108
module.exports = DebugHeader;

0 commit comments

Comments
 (0)