melonjs 10.1.0 → 10.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -12
- package/dist/melonjs.js +3119 -2857
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +2590 -2490
- package/dist/melonjs.module.js +2698 -2470
- package/package.json +10 -11
- package/src/audio/audio.js +43 -43
- package/src/camera/camera2d.js +55 -77
- package/src/entity/draggable.js +18 -17
- package/src/entity/droptarget.js +19 -18
- package/src/entity/entity.js +22 -26
- package/src/game.js +3 -3
- package/src/index.js +15 -11
- package/src/input/gamepad.js +13 -13
- package/src/input/input.js +1 -1
- package/src/input/keyboard.js +14 -16
- package/src/input/pointer.js +42 -35
- package/src/input/pointerevent.js +25 -33
- package/src/lang/deprecated.js +3 -3
- package/src/level/level.js +24 -16
- package/src/level/tiled/TMXGroup.js +6 -6
- package/src/level/tiled/TMXLayer.js +31 -31
- package/src/level/tiled/TMXObject.js +19 -19
- package/src/level/tiled/TMXTile.js +11 -12
- package/src/level/tiled/TMXTileMap.js +23 -21
- package/src/level/tiled/TMXTileset.js +13 -13
- package/src/level/tiled/TMXTilesetGroup.js +4 -4
- package/src/level/tiled/TMXUtils.js +13 -11
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +17 -17
- package/src/loader/loader.js +31 -27
- package/src/loader/loadingscreen.js +40 -72
- package/src/math/color.js +45 -64
- package/src/math/math.js +17 -17
- package/src/math/matrix2.js +46 -46
- package/src/math/matrix3.js +64 -64
- package/src/math/observable_vector2.js +45 -57
- package/src/math/observable_vector3.js +56 -70
- package/src/math/vector2.js +60 -59
- package/src/math/vector3.js +65 -64
- package/src/particles/emitter.js +53 -55
- package/src/particles/particle.js +1 -1
- package/src/physics/body.js +45 -51
- package/src/physics/bounds.js +36 -36
- package/src/physics/collision.js +15 -16
- package/src/physics/detector.js +10 -11
- package/src/physics/quadtree.js +19 -17
- package/src/physics/sat.js +17 -17
- package/src/physics/world.js +13 -10
- package/src/plugin/plugin.js +6 -6
- package/src/renderable/GUI.js +13 -18
- package/src/renderable/collectable.js +3 -3
- package/src/renderable/colorlayer.js +4 -4
- package/src/renderable/container.js +65 -46
- package/src/renderable/imagelayer.js +32 -31
- package/src/renderable/nineslicesprite.js +211 -0
- package/src/renderable/renderable.js +69 -67
- package/src/renderable/sprite.js +57 -43
- package/src/renderable/trigger.js +14 -15
- package/src/shapes/ellipse.js +27 -26
- package/src/shapes/line.js +8 -7
- package/src/shapes/poly.js +33 -31
- package/src/shapes/rectangle.js +50 -96
- package/src/state/stage.js +8 -8
- package/src/state/state.js +56 -56
- package/src/system/device.js +97 -84
- package/src/system/event.js +72 -72
- package/src/system/pooling.js +14 -14
- package/src/system/save.js +6 -3
- package/src/system/timer.js +20 -20
- package/src/text/bitmaptext.js +27 -33
- package/src/text/bitmaptextdata.js +9 -9
- package/src/text/text.js +118 -59
- package/src/tweens/easing.js +4 -4
- package/src/tweens/interpolation.js +4 -4
- package/src/tweens/tween.js +37 -27
- package/src/utils/agent.js +9 -8
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +4 -4
- package/src/utils/function.js +5 -5
- package/src/utils/string.js +12 -12
- package/src/utils/utils.js +19 -19
- package/src/video/canvas/canvas_renderer.js +90 -90
- package/src/video/renderer.js +40 -39
- package/src/video/texture.js +85 -76
- package/src/video/texture_cache.js +11 -0
- package/src/video/video.js +30 -30
- package/src/video/webgl/buffer/vertex.js +9 -1
- package/src/video/webgl/glshader.js +20 -20
- package/src/video/webgl/webgl_compositor.js +47 -37
- package/src/video/webgl/webgl_renderer.js +104 -104
package/src/tweens/tween.js
CHANGED
|
@@ -5,9 +5,9 @@ import { Easing } from "./easing.js";
|
|
|
5
5
|
import { Interpolation } from "./interpolation.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Tween.js - Licensed under the MIT license
|
|
9
|
-
* https://github.com/tweenjs/tween.js
|
|
10
|
-
*/
|
|
8
|
+
* Tween.js - Licensed under the MIT license
|
|
9
|
+
* https://github.com/tweenjs/tween.js
|
|
10
|
+
*/
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @classdesc
|
|
@@ -25,7 +25,7 @@ import { Interpolation } from "./interpolation.js";
|
|
|
25
25
|
* @class Tween
|
|
26
26
|
* @memberOf me
|
|
27
27
|
* @constructor
|
|
28
|
-
* @param {
|
|
28
|
+
* @param {object} object object on which to apply the tween
|
|
29
29
|
* @example
|
|
30
30
|
* // add a tween to change the object pos.x and pos.y variable to 200 in 3 seconds
|
|
31
31
|
* tween = new me.Tween(myObject.pos).to({
|
|
@@ -124,15 +124,16 @@ class Tween {
|
|
|
124
124
|
* @memberOf me.Tween
|
|
125
125
|
* @public
|
|
126
126
|
* @function
|
|
127
|
-
* @param {
|
|
128
|
-
* @param {
|
|
129
|
-
* @param {
|
|
127
|
+
* @param {object} properties hash of properties
|
|
128
|
+
* @param {object|number} [options] object of tween properties, or a duration if a numeric value is passed
|
|
129
|
+
* @param {number} [options.duration] tween duration
|
|
130
130
|
* @param {me.Tween.Easing} [options.easing] easing function
|
|
131
|
-
* @param {
|
|
132
|
-
* @param {
|
|
133
|
-
* @param {
|
|
131
|
+
* @param {number} [options.delay] delay amount expressed in milliseconds
|
|
132
|
+
* @param {boolean} [options.yoyo] allows the tween to bounce back to their original value when finished. To be used together with repeat to create endless loops.
|
|
133
|
+
* @param {number} [options.repeat] amount of times the tween should be repeated
|
|
134
134
|
* @param {me.Tween.Interpolation} [options.interpolation] interpolation function
|
|
135
|
-
* @param {
|
|
135
|
+
* @param {boolean} [options.autoStart] allow this tween to start automatically. Otherwise call me.Tween.start().
|
|
136
|
+
* @returns {me.Tween} this instance for object chaining
|
|
136
137
|
*/
|
|
137
138
|
to( properties, options ) {
|
|
138
139
|
|
|
@@ -157,7 +158,6 @@ class Tween {
|
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
return this;
|
|
160
|
-
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/**
|
|
@@ -166,6 +166,8 @@ class Tween {
|
|
|
166
166
|
* @memberOf me.Tween
|
|
167
167
|
* @public
|
|
168
168
|
* @function
|
|
169
|
+
* @param {number} [time] the current time when the tween was started
|
|
170
|
+
* @returns {me.Tween} this instance for object chaining
|
|
169
171
|
*/
|
|
170
172
|
start( time = timer.getTime() ) {
|
|
171
173
|
|
|
@@ -203,7 +205,6 @@ class Tween {
|
|
|
203
205
|
}
|
|
204
206
|
|
|
205
207
|
return this;
|
|
206
|
-
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
/**
|
|
@@ -212,6 +213,7 @@ class Tween {
|
|
|
212
213
|
* @memberOf me.Tween
|
|
213
214
|
* @public
|
|
214
215
|
* @function
|
|
216
|
+
* @returns {me.Tween} this instance for object chaining
|
|
215
217
|
*/
|
|
216
218
|
stop() {
|
|
217
219
|
// remove the tween from the world container
|
|
@@ -225,7 +227,8 @@ class Tween {
|
|
|
225
227
|
* @memberOf me.Tween
|
|
226
228
|
* @public
|
|
227
229
|
* @function
|
|
228
|
-
* @param {
|
|
230
|
+
* @param {number} amount delay amount expressed in milliseconds
|
|
231
|
+
* @returns {me.Tween} this instance for object chaining
|
|
229
232
|
*/
|
|
230
233
|
delay( amount ) {
|
|
231
234
|
|
|
@@ -240,7 +243,8 @@ class Tween {
|
|
|
240
243
|
* @memberOf me.Tween
|
|
241
244
|
* @public
|
|
242
245
|
* @function
|
|
243
|
-
* @param {
|
|
246
|
+
* @param {number} times amount of times the tween should be repeated
|
|
247
|
+
* @returns {me.Tween} this instance for object chaining
|
|
244
248
|
*/
|
|
245
249
|
repeat( times ) {
|
|
246
250
|
|
|
@@ -257,7 +261,8 @@ class Tween {
|
|
|
257
261
|
* @public
|
|
258
262
|
* @function
|
|
259
263
|
* @see me.Tween#repeat
|
|
260
|
-
* @param {
|
|
264
|
+
* @param {boolean} yoyo
|
|
265
|
+
* @returns {me.Tween} this instance for object chaining
|
|
261
266
|
*/
|
|
262
267
|
yoyo( yoyo ) {
|
|
263
268
|
|
|
@@ -272,7 +277,8 @@ class Tween {
|
|
|
272
277
|
* @memberOf me.Tween
|
|
273
278
|
* @public
|
|
274
279
|
* @function
|
|
275
|
-
* @param {me.Tween.Easing}
|
|
280
|
+
* @param {me.Tween.Easing} easing easing function
|
|
281
|
+
* @returns {me.Tween} this instance for object chaining
|
|
276
282
|
*/
|
|
277
283
|
easing( easing ) {
|
|
278
284
|
if (typeof easing !== "function") {
|
|
@@ -280,7 +286,6 @@ class Tween {
|
|
|
280
286
|
}
|
|
281
287
|
this._easingFunction = easing;
|
|
282
288
|
return this;
|
|
283
|
-
|
|
284
289
|
}
|
|
285
290
|
|
|
286
291
|
/**
|
|
@@ -289,7 +294,8 @@ class Tween {
|
|
|
289
294
|
* @memberOf me.Tween
|
|
290
295
|
* @public
|
|
291
296
|
* @function
|
|
292
|
-
* @param {me.Tween.Interpolation}
|
|
297
|
+
* @param {me.Tween.Interpolation} interpolation interpolation function
|
|
298
|
+
* @returns {me.Tween} this instance for object chaining
|
|
293
299
|
*/
|
|
294
300
|
interpolation( interpolation ) {
|
|
295
301
|
this._interpolationFunction = interpolation;
|
|
@@ -302,9 +308,10 @@ class Tween {
|
|
|
302
308
|
* @memberOf me.Tween
|
|
303
309
|
* @public
|
|
304
310
|
* @function
|
|
305
|
-
* @param {me.Tween} chainedTween Tween to be chained
|
|
311
|
+
* @param {...me.Tween} chainedTween Tween(s) to be chained
|
|
312
|
+
* @returns {me.Tween} this instance for object chaining
|
|
306
313
|
*/
|
|
307
|
-
chain() {
|
|
314
|
+
chain( chainedTween ) {
|
|
308
315
|
this._chainedTweens = arguments;
|
|
309
316
|
return this;
|
|
310
317
|
}
|
|
@@ -316,9 +323,10 @@ class Tween {
|
|
|
316
323
|
* @public
|
|
317
324
|
* @function
|
|
318
325
|
* @param {Function} onStartCallback callback
|
|
326
|
+
* @returns {me.Tween} this instance for object chaining
|
|
319
327
|
*/
|
|
320
|
-
onStart(
|
|
321
|
-
this._onStartCallback =
|
|
328
|
+
onStart( onStartCallback ) {
|
|
329
|
+
this._onStartCallback = onStartCallback;
|
|
322
330
|
return this;
|
|
323
331
|
}
|
|
324
332
|
|
|
@@ -329,9 +337,10 @@ class Tween {
|
|
|
329
337
|
* @public
|
|
330
338
|
* @function
|
|
331
339
|
* @param {Function} onUpdateCallback callback
|
|
340
|
+
* @returns {me.Tween} this instance for object chaining
|
|
332
341
|
*/
|
|
333
|
-
onUpdate(
|
|
334
|
-
this._onUpdateCallback =
|
|
342
|
+
onUpdate( onUpdateCallback ) {
|
|
343
|
+
this._onUpdateCallback = onUpdateCallback;
|
|
335
344
|
return this;
|
|
336
345
|
}
|
|
337
346
|
|
|
@@ -342,9 +351,10 @@ class Tween {
|
|
|
342
351
|
* @public
|
|
343
352
|
* @function
|
|
344
353
|
* @param {Function} onCompleteCallback callback
|
|
354
|
+
* @returns {me.Tween} this instance for object chaining
|
|
345
355
|
*/
|
|
346
|
-
onComplete(
|
|
347
|
-
this._onCompleteCallback =
|
|
356
|
+
onComplete( onCompleteCallback ) {
|
|
357
|
+
this._onCompleteCallback = onCompleteCallback;
|
|
348
358
|
return this;
|
|
349
359
|
};
|
|
350
360
|
|
package/src/utils/agent.js
CHANGED
|
@@ -17,9 +17,9 @@ var vendors = [ "ms", "MS", "moz", "webkit", "o" ];
|
|
|
17
17
|
* @public
|
|
18
18
|
* @name prefixed
|
|
19
19
|
* @function
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @
|
|
20
|
+
* @param {string} name Property name
|
|
21
|
+
* @param {object} [obj=window] Object or element reference to access
|
|
22
|
+
* @returns {string} Value of property
|
|
23
23
|
* @memberOf me.utils.agent
|
|
24
24
|
*/
|
|
25
25
|
export function prefixed(name, obj) {
|
|
@@ -43,10 +43,10 @@ export function prefixed(name, obj) {
|
|
|
43
43
|
* @public
|
|
44
44
|
* @name setPrefixed
|
|
45
45
|
* @function
|
|
46
|
-
* @param {
|
|
47
|
-
* @param {
|
|
48
|
-
* @param {
|
|
49
|
-
* @
|
|
46
|
+
* @param {string} name Property name
|
|
47
|
+
* @param {string} value Property value
|
|
48
|
+
* @param {object} [obj=window] Object or element reference to access
|
|
49
|
+
* @returns {boolean} true if one of the vendor-prefixed property was found
|
|
50
50
|
* @memberOf me.utils.agent
|
|
51
51
|
*/
|
|
52
52
|
export function setPrefixed(name, value, obj) {
|
|
@@ -64,6 +64,7 @@ export function setPrefixed(name, value, obj) {
|
|
|
64
64
|
obj[name] = value;
|
|
65
65
|
return true;
|
|
66
66
|
}
|
|
67
|
-
return false;
|
|
68
67
|
});
|
|
68
|
+
|
|
69
|
+
return false;
|
|
69
70
|
};
|
package/src/utils/array.js
CHANGED
|
@@ -13,8 +13,8 @@ import {random as mathRandom, weightedRandom as mathWeightedRandom} from "./../m
|
|
|
13
13
|
* @memberOf me.utils.array
|
|
14
14
|
* @name remove
|
|
15
15
|
* @param {Array} arr array from which to remove an object
|
|
16
|
-
* @param {
|
|
17
|
-
* @
|
|
16
|
+
* @param {object} obj to be removed
|
|
17
|
+
* @returns {Array} the modified Array
|
|
18
18
|
* var arr = [ "foo", "bar", "baz" ];
|
|
19
19
|
* // remove "foo" from the array
|
|
20
20
|
* me.utils.array.remove(arr, "foo");
|
|
@@ -34,7 +34,7 @@ export function remove(arr, obj) {
|
|
|
34
34
|
* @memberOf me.utils.array
|
|
35
35
|
* @name random
|
|
36
36
|
* @param {Array} arr array to pick a element
|
|
37
|
-
* @
|
|
37
|
+
* @returns {any} random member of array
|
|
38
38
|
* @example
|
|
39
39
|
* // Select a random array element
|
|
40
40
|
* var arr = [ "foo", "bar", "baz" ];
|
|
@@ -51,7 +51,7 @@ export function random(arr) {
|
|
|
51
51
|
* @memberOf me.utils.array
|
|
52
52
|
* @name weightedRandom
|
|
53
53
|
* @param {Array} arr array to pick a element
|
|
54
|
-
* @
|
|
54
|
+
* @returns {any} random member of array
|
|
55
55
|
*/
|
|
56
56
|
export function weightedRandom(arr) {
|
|
57
57
|
return arr[mathWeightedRandom(0, arr.length)];
|
package/src/utils/file.js
CHANGED
|
@@ -16,8 +16,8 @@ const REMOVE_EXT = /\.[^\.]*$/;
|
|
|
16
16
|
* @function
|
|
17
17
|
* @memberOf me.utils.file
|
|
18
18
|
* @name getBasename
|
|
19
|
-
* @param {
|
|
20
|
-
* @
|
|
19
|
+
* @param {string} path path containing the filename
|
|
20
|
+
* @returns {string} the base name without path information.
|
|
21
21
|
*/
|
|
22
22
|
export function getBasename(path) {
|
|
23
23
|
return path.replace(REMOVE_PATH, "").replace(REMOVE_EXT, "");
|
|
@@ -29,8 +29,8 @@ export function getBasename(path) {
|
|
|
29
29
|
* @function
|
|
30
30
|
* @memberOf me.utils.file
|
|
31
31
|
* @name getExtension
|
|
32
|
-
* @param {
|
|
33
|
-
* @
|
|
32
|
+
* @param {string} path path containing the filename
|
|
33
|
+
* @returns {string} filename extension.
|
|
34
34
|
*/
|
|
35
35
|
export function getExtension(path) {
|
|
36
36
|
return path.substring(path.lastIndexOf(".") + 1, path.length);
|
package/src/utils/function.js
CHANGED
|
@@ -4,17 +4,16 @@
|
|
|
4
4
|
* @memberOf me
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Executes a function as soon as the interpreter is idle (stack empty).
|
|
10
9
|
* @public
|
|
11
10
|
* @function
|
|
12
11
|
* @memberOf me.utils.function
|
|
13
12
|
* @name defer
|
|
14
|
-
* @param {Function}
|
|
15
|
-
* @param {
|
|
13
|
+
* @param {Function} func The function to be deferred.
|
|
14
|
+
* @param {object} thisArg The value to be passed as the this parameter to the target function when the deferred function is called
|
|
16
15
|
* @param {...*} [args] Optional additional arguments to carry for the function.
|
|
17
|
-
* @
|
|
16
|
+
* @returns {number} id that can be used to clear the deferred function using
|
|
18
17
|
* clearTimeout
|
|
19
18
|
* @example
|
|
20
19
|
* // execute myFunc() when the stack is empty,
|
|
@@ -33,8 +32,9 @@ export function defer(func, thisArg, ...args) {
|
|
|
33
32
|
* @memberOf me.utils.function
|
|
34
33
|
* @name throttle
|
|
35
34
|
* @param {Function} fn the function to be throttled.
|
|
36
|
-
* @param {
|
|
35
|
+
* @param {number} delay The delay in ms
|
|
37
36
|
* @param {no_trailing} no_trailing disable the execution on the trailing edge
|
|
37
|
+
* @returns {Function} the function that will be throttled
|
|
38
38
|
*/
|
|
39
39
|
export function throttle(fn, delay, no_trailing) {
|
|
40
40
|
var last = window.performance.now(), deferTimer;
|
package/src/utils/string.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* @function
|
|
12
12
|
* @memberOf me.utils.string
|
|
13
13
|
* @name capitalize
|
|
14
|
-
* @param {
|
|
15
|
-
* @
|
|
14
|
+
* @param {string} str the string to be capitalized
|
|
15
|
+
* @returns {string} the capitalized string
|
|
16
16
|
*/
|
|
17
17
|
export function capitalize(str) {
|
|
18
18
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -24,8 +24,8 @@ export function capitalize(str) {
|
|
|
24
24
|
* @function
|
|
25
25
|
* @memberOf me.utils.string
|
|
26
26
|
* @name trimLeft
|
|
27
|
-
* @param {
|
|
28
|
-
* @
|
|
27
|
+
* @param {string} str the string to be trimmed
|
|
28
|
+
* @returns {string} trimmed string
|
|
29
29
|
*/
|
|
30
30
|
export function trimLeft(str) {
|
|
31
31
|
return str.replace(/^\s+/, "");
|
|
@@ -37,8 +37,8 @@ export function trimLeft(str) {
|
|
|
37
37
|
* @function
|
|
38
38
|
* @memberOf me.utils.string
|
|
39
39
|
* @name trimRight
|
|
40
|
-
* @param {
|
|
41
|
-
* @
|
|
40
|
+
* @param {string} str the string to be trimmed
|
|
41
|
+
* @returns {string} trimmed string
|
|
42
42
|
*/
|
|
43
43
|
export function trimRight(str) {
|
|
44
44
|
return str.replace(/\s+$/, "");
|
|
@@ -50,8 +50,8 @@ export function trimRight(str) {
|
|
|
50
50
|
* @function
|
|
51
51
|
* @memberOf me.utils.string
|
|
52
52
|
* @name isNumeric
|
|
53
|
-
* @param {
|
|
54
|
-
* @
|
|
53
|
+
* @param {string} str the string to be tested
|
|
54
|
+
* @returns {boolean} true if string contains only digits
|
|
55
55
|
*/
|
|
56
56
|
export function isNumeric(str) {
|
|
57
57
|
if (typeof str === "string") {
|
|
@@ -66,8 +66,8 @@ export function isNumeric(str) {
|
|
|
66
66
|
* @function
|
|
67
67
|
* @memberOf me.utils.string
|
|
68
68
|
* @name isBoolean
|
|
69
|
-
* @param {
|
|
70
|
-
* @
|
|
69
|
+
* @param {string} str the string to be tested
|
|
70
|
+
* @returns {boolean} true if the string is either true or false
|
|
71
71
|
*/
|
|
72
72
|
export function isBoolean(str) {
|
|
73
73
|
var trimmed = str.trim();
|
|
@@ -80,8 +80,8 @@ export function isBoolean(str) {
|
|
|
80
80
|
* @function
|
|
81
81
|
* @memberOf me.utils.string
|
|
82
82
|
* @name toHex
|
|
83
|
-
* @param {
|
|
84
|
-
* @
|
|
83
|
+
* @param {string} str the string to be converted
|
|
84
|
+
* @returns {string} the converted hexadecimal value
|
|
85
85
|
*/
|
|
86
86
|
export function toHex(str) {
|
|
87
87
|
var res = "", c = 0;
|
package/src/utils/utils.js
CHANGED
|
@@ -31,20 +31,20 @@ var utils = {
|
|
|
31
31
|
* @function
|
|
32
32
|
* @memberOf me.utils
|
|
33
33
|
* @name getPixels
|
|
34
|
-
* @param {
|
|
35
|
-
* @
|
|
34
|
+
* @param {HTMLImageElement|HTMLCanvasElement} image Image to read
|
|
35
|
+
* @returns {ImageData} ImageData object
|
|
36
36
|
*/
|
|
37
|
-
getPixels : function (
|
|
38
|
-
if (
|
|
37
|
+
getPixels : function (image) {
|
|
38
|
+
if (image instanceof HTMLImageElement) {
|
|
39
39
|
var _context = CanvasRenderer.getContext2d(
|
|
40
|
-
createCanvas(
|
|
40
|
+
createCanvas(image.width, image.height)
|
|
41
41
|
);
|
|
42
|
-
_context.drawImage(
|
|
43
|
-
return _context.getImageData(0, 0,
|
|
42
|
+
_context.drawImage(image, 0, 0);
|
|
43
|
+
return _context.getImageData(0, 0, image.width, image.height);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
// canvas !
|
|
47
|
-
return
|
|
47
|
+
return image.getContext("2d").getImageData(0, 0, image.width, image.height);
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
|
|
@@ -54,9 +54,9 @@ var utils = {
|
|
|
54
54
|
* @function
|
|
55
55
|
* @memberOf me.utils
|
|
56
56
|
* @name checkVersion
|
|
57
|
-
* @param {
|
|
58
|
-
* @param {
|
|
59
|
-
* @
|
|
57
|
+
* @param {string} first First version string to compare
|
|
58
|
+
* @param {string} [second=me.version] Second version string to compare
|
|
59
|
+
* @returns {number} comparison result <br>< 0 : first < second<br>
|
|
60
60
|
* 0 : first == second<br>
|
|
61
61
|
* > 0 : first > second
|
|
62
62
|
* @example
|
|
@@ -87,14 +87,14 @@ var utils = {
|
|
|
87
87
|
* @function
|
|
88
88
|
* @memberOf me.utils
|
|
89
89
|
* @name getUriFragment
|
|
90
|
-
* @param {
|
|
91
|
-
* @
|
|
92
|
-
* @property {
|
|
93
|
-
* @property {
|
|
94
|
-
* @property {
|
|
95
|
-
* @property {
|
|
96
|
-
* @property {
|
|
97
|
-
* @property {
|
|
90
|
+
* @param {string} [url=document.location] an optional params string or URL containing fragment (hash) params to be parsed
|
|
91
|
+
* @returns {object} an object representing the deserialized params string.
|
|
92
|
+
* @property {boolean} [hitbox=false] draw the hitbox in the debug panel (if enabled)
|
|
93
|
+
* @property {boolean} [velocity=false] draw the entities velocity in the debug panel (if enabled)
|
|
94
|
+
* @property {boolean} [quadtree=false] draw the quadtree in the debug panel (if enabled)
|
|
95
|
+
* @property {boolean} [webgl=false] force the renderer to WebGL
|
|
96
|
+
* @property {boolean} [debug=false] display the debug panel (if preloaded)
|
|
97
|
+
* @property {string} [debugToggleKey="s"] show/hide the debug panel (if preloaded)
|
|
98
98
|
* @example
|
|
99
99
|
* // http://www.example.com/index.html#debug&hitbox=true&mytag=value
|
|
100
100
|
* var UriFragment = me.utils.getUriFragment();
|