Skip to content

Commit 36825cd

Browse files
committed
Added new Dynamic FX Generator.
Added AudioContext polyfill. Added start of ROADMAP.
1 parent 5893665 commit 36825cd

8 files changed

Lines changed: 695 additions & 1 deletion

File tree

v3/dev-guide/ROADMAP.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Phaser 3 Development Roadmap
2+
3+
The following is a list of all the key areas of the Phaser 2 API, and how they'll map to the Phaser 3 API.
4+
5+
## Animation
6+
7+
V2:
8+
9+
Animation Manager
10+
Animation Parser
11+
Animation Class
12+
FrameData
13+
Frame Class
14+
Creature run-times libs
15+
16+
V3:
17+
18+
The Texture Manager now handles all Texture parsing. It splits up Texture Atlases, creates Frame objects and handles Frame functions like Crop.
19+
20+
TODO:
21+
22+
* Define the format and API calls that Animations will take in Phaser 3, and decide upon if we require a 'central' Animation registry, rather than creating them multiple times, per Sprite instance.
23+
24+
* Decide if the Creature libs can still be supported.
25+
26+
## Camera
27+
28+
V2:
29+
30+
The Camera was essentially a Rectangle object with some special commands, to allow for Camera effects (shake, flash) and the tracking of Game Objects. It could never properly handle rotation or scaling.
31+
32+
V3:
33+
34+
The Camera is now a display level object with its own Transform, allowing you to rotate and scale, and have it update the scene correctly.
35+
36+
TODO:
37+
38+
* Camera effects (fade, flash)
39+
* Camera follow / target
40+
41+
Filter
42+
43+
Group
44+
45+
Plugins
46+
47+
Scale Manager
48+
49+
Signals
50+
51+
Stage
52+
53+
State Manager
54+
55+
World
56+
57+
Game Objects
58+
59+
BitmapData
60+
BitmapText
61+
Button
62+
Creature
63+
Graphics
64+
Image
65+
Particle
66+
RenderTexture
67+
RetroFont
68+
Rope
69+
Sprite
70+
SpriteBatch
71+
Text
72+
TileSprite
73+
Video
74+
75+
Geometry
76+
77+
Circle
78+
Ellipse
79+
Hermite
80+
Line
81+
Matrix
82+
Point
83+
Polygon
84+
Rectangle
85+
RoundedRectangle
86+
87+
Input
88+
89+
Input Manager
90+
Keyboard + Key
91+
Mouse
92+
MSPointer
93+
Touch
94+
Pointer
95+
Gamepad
96+
97+
Loader
98+
99+
Cache
100+
101+
Math
102+
Math functions
103+
QuadTree
104+
Random Data Generator
105+
106+
Net
107+
108+
Particles
109+
Arcade Physics Emitter + Particle
110+
111+
Physics
112+
Arcade Physics
113+
Ninja Physics
114+
P2 Physics
115+
116+
Renderer
117+
118+
Canvas
119+
Graphics Primitives
120+
Canvas Tint
121+
122+
WebGL
123+
RenderTextures
124+
Sprite Batch
125+
Filters
126+
Graphics Primitives
127+
128+
Sound
129+
Sound Manager
130+
Sound
131+
AudioSprite
132+
133+
Tilemap
134+
Tilemap class
135+
Tilemap Layer
136+
Tileset
137+
Tile
138+
ImageCollection
139+
140+
Time
141+
Master Time
142+
Timer
143+
TimerEvent
144+
145+
Tween
146+
Tween Manager
147+
Tween + TweenData
148+
Easing functions
149+
150+
Utils
151+
ArraySet
152+
ArrayUtils
153+
Canvas Utils
154+
Canvas Pool
155+
Color
156+
Debug
157+
Device
158+
DOM
159+
EarCut
160+
LinkedList
161+
RequestAnimationFrame
162+
Generic Utils
163+
164+

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: 'ca0e6af0-d6c6-11e6-8a0b-c583e07b191c'
2+
build: 'cd5e7c40-d7b6-11e6-b751-619825ddff5c'
33
};
44
module.exports = CHECKSUM;

v3/src/phaser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ var Phaser = {
2525

2626
},
2727

28+
Sound: require('./sound'),
29+
2830
Utils: {
2931

3032
Array: require('./utils/array/'),
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
/* Copyright 2013 Chris Wilson
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
/*
17+
18+
This monkeypatch library is intended to be included in projects that are
19+
written to the proper AudioContext spec (instead of webkitAudioContext),
20+
and that use the new naming and proper bits of the Web Audio API (e.g.
21+
using BufferSourceNode.start() instead of BufferSourceNode.noteOn()), but may
22+
have to run on systems that only support the deprecated bits.
23+
24+
This library should be harmless to include if the browser supports
25+
unprefixed "AudioContext", and/or if it supports the new names.
26+
27+
The patches this library handles:
28+
if window.AudioContext is unsupported, it will be aliased to webkitAudioContext().
29+
if AudioBufferSourceNode.start() is unimplemented, it will be routed to noteOn() or
30+
noteGrainOn(), depending on parameters.
31+
32+
The following aliases only take effect if the new names are not already in place:
33+
34+
AudioBufferSourceNode.stop() is aliased to noteOff()
35+
AudioContext.createGain() is aliased to createGainNode()
36+
AudioContext.createDelay() is aliased to createDelayNode()
37+
AudioContext.createScriptProcessor() is aliased to createJavaScriptNode()
38+
AudioContext.createPeriodicWave() is aliased to createWaveTable()
39+
OscillatorNode.start() is aliased to noteOn()
40+
OscillatorNode.stop() is aliased to noteOff()
41+
OscillatorNode.setPeriodicWave() is aliased to setWaveTable()
42+
AudioParam.setTargetAtTime() is aliased to setTargetValueAtTime()
43+
44+
This library does NOT patch the enumerated type changes, as it is
45+
recommended in the specification that implementations support both integer
46+
and string types for AudioPannerNode.panningModel, AudioPannerNode.distanceModel
47+
BiquadFilterNode.type and OscillatorNode.type.
48+
49+
*/
50+
(function (global, exports, perf) {
51+
'use strict';
52+
53+
function fixSetTarget(param) {
54+
if (!param) // if NYI, just return
55+
return;
56+
if (!param.setTargetAtTime)
57+
param.setTargetAtTime = param.setTargetValueAtTime;
58+
}
59+
60+
if (window.hasOwnProperty('webkitAudioContext') &&
61+
!window.hasOwnProperty('AudioContext')) {
62+
window.AudioContext = webkitAudioContext;
63+
64+
if (!AudioContext.prototype.hasOwnProperty('createGain'))
65+
AudioContext.prototype.createGain = AudioContext.prototype.createGainNode;
66+
if (!AudioContext.prototype.hasOwnProperty('createDelay'))
67+
AudioContext.prototype.createDelay = AudioContext.prototype.createDelayNode;
68+
if (!AudioContext.prototype.hasOwnProperty('createScriptProcessor'))
69+
AudioContext.prototype.createScriptProcessor = AudioContext.prototype.createJavaScriptNode;
70+
if (!AudioContext.prototype.hasOwnProperty('createPeriodicWave'))
71+
AudioContext.prototype.createPeriodicWave = AudioContext.prototype.createWaveTable;
72+
73+
74+
AudioContext.prototype.internal_createGain = AudioContext.prototype.createGain;
75+
AudioContext.prototype.createGain = function() {
76+
var node = this.internal_createGain();
77+
fixSetTarget(node.gain);
78+
return node;
79+
};
80+
81+
AudioContext.prototype.internal_createDelay = AudioContext.prototype.createDelay;
82+
AudioContext.prototype.createDelay = function(maxDelayTime) {
83+
var node = maxDelayTime ? this.internal_createDelay(maxDelayTime) : this.internal_createDelay();
84+
fixSetTarget(node.delayTime);
85+
return node;
86+
};
87+
88+
AudioContext.prototype.internal_createBufferSource = AudioContext.prototype.createBufferSource;
89+
AudioContext.prototype.createBufferSource = function() {
90+
var node = this.internal_createBufferSource();
91+
if (!node.start) {
92+
node.start = function ( when, offset, duration ) {
93+
if ( offset || duration )
94+
this.noteGrainOn( when || 0, offset, duration );
95+
else
96+
this.noteOn( when || 0 );
97+
};
98+
} else {
99+
node.internal_start = node.start;
100+
node.start = function( when, offset, duration ) {
101+
if( typeof duration !== 'undefined' )
102+
node.internal_start( when || 0, offset, duration );
103+
else
104+
node.internal_start( when || 0, offset || 0 );
105+
};
106+
}
107+
if (!node.stop) {
108+
node.stop = function ( when ) {
109+
this.noteOff( when || 0 );
110+
};
111+
} else {
112+
node.internal_stop = node.stop;
113+
node.stop = function( when ) {
114+
node.internal_stop( when || 0 );
115+
};
116+
}
117+
fixSetTarget(node.playbackRate);
118+
return node;
119+
};
120+
121+
AudioContext.prototype.internal_createDynamicsCompressor = AudioContext.prototype.createDynamicsCompressor;
122+
AudioContext.prototype.createDynamicsCompressor = function() {
123+
var node = this.internal_createDynamicsCompressor();
124+
fixSetTarget(node.threshold);
125+
fixSetTarget(node.knee);
126+
fixSetTarget(node.ratio);
127+
fixSetTarget(node.reduction);
128+
fixSetTarget(node.attack);
129+
fixSetTarget(node.release);
130+
return node;
131+
};
132+
133+
AudioContext.prototype.internal_createBiquadFilter = AudioContext.prototype.createBiquadFilter;
134+
AudioContext.prototype.createBiquadFilter = function() {
135+
var node = this.internal_createBiquadFilter();
136+
fixSetTarget(node.frequency);
137+
fixSetTarget(node.detune);
138+
fixSetTarget(node.Q);
139+
fixSetTarget(node.gain);
140+
return node;
141+
};
142+
143+
if (AudioContext.prototype.hasOwnProperty( 'createOscillator' )) {
144+
AudioContext.prototype.internal_createOscillator = AudioContext.prototype.createOscillator;
145+
AudioContext.prototype.createOscillator = function() {
146+
var node = this.internal_createOscillator();
147+
if (!node.start) {
148+
node.start = function ( when ) {
149+
this.noteOn( when || 0 );
150+
};
151+
} else {
152+
node.internal_start = node.start;
153+
node.start = function ( when ) {
154+
node.internal_start( when || 0);
155+
};
156+
}
157+
if (!node.stop) {
158+
node.stop = function ( when ) {
159+
this.noteOff( when || 0 );
160+
};
161+
} else {
162+
node.internal_stop = node.stop;
163+
node.stop = function( when ) {
164+
node.internal_stop( when || 0 );
165+
};
166+
}
167+
if (!node.setPeriodicWave)
168+
node.setPeriodicWave = node.setWaveTable;
169+
fixSetTarget(node.frequency);
170+
fixSetTarget(node.detune);
171+
return node;
172+
};
173+
}
174+
}
175+
176+
if (window.hasOwnProperty('webkitOfflineAudioContext') &&
177+
!window.hasOwnProperty('OfflineAudioContext')) {
178+
window.OfflineAudioContext = webkitOfflineAudioContext;
179+
}
180+
181+
}(window));
182+

v3/src/polyfills/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require('./Array.forEach');
22
require('./Array.isArray');
3+
require('./AudioContextMonkeyPatch');
34
require('./console');
45
require('./Function.bind');
56
require('./Math.trunc');

0 commit comments

Comments
 (0)