melonjs 9.1.1 → 9.1.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/dist/melonjs.js +41 -71
- package/dist/melonjs.min.js +2 -2
- package/dist/melonjs.module.js +41 -71
- package/package.json +1 -1
- package/src/shapes/poly.js +31 -0
- package/src/shapes/rectangle.js +0 -61
- package/src/system/device.js +6 -6
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v9.1.
|
|
2
|
+
* melonJS Game Engine - v9.1.2
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -10591,6 +10591,37 @@ var Polygon = window.Jay.extend({
|
|
|
10591
10591
|
return this;
|
|
10592
10592
|
},
|
|
10593
10593
|
|
|
10594
|
+
/**
|
|
10595
|
+
* Shifts the Polygon to the given position vector.
|
|
10596
|
+
* @name shift
|
|
10597
|
+
* @memberOf me.Polygon
|
|
10598
|
+
* @function
|
|
10599
|
+
* @param {me.Vector2d} position
|
|
10600
|
+
*/
|
|
10601
|
+
/**
|
|
10602
|
+
* Shifts the Polygon to the given x, y position.
|
|
10603
|
+
* @name shift
|
|
10604
|
+
* @memberOf me.Polygon
|
|
10605
|
+
* @function
|
|
10606
|
+
* @param {Number} x
|
|
10607
|
+
* @param {Number} y
|
|
10608
|
+
*/
|
|
10609
|
+
shift() {
|
|
10610
|
+
var _x, _y;
|
|
10611
|
+
if (arguments.length === 2) {
|
|
10612
|
+
// x, y
|
|
10613
|
+
_x = arguments[0];
|
|
10614
|
+
_y = arguments[1];
|
|
10615
|
+
} else {
|
|
10616
|
+
// vector
|
|
10617
|
+
_x = arguments[0].x;
|
|
10618
|
+
_y = arguments[0].y;
|
|
10619
|
+
}
|
|
10620
|
+
this.pos.x = _x;
|
|
10621
|
+
this.pos.y = _y;
|
|
10622
|
+
this.updateBounds();
|
|
10623
|
+
},
|
|
10624
|
+
|
|
10594
10625
|
/**
|
|
10595
10626
|
* Returns true if the polygon contains the given point.
|
|
10596
10627
|
* (Note: it is highly recommended to first do a hit test on the corresponding <br>
|
|
@@ -10801,67 +10832,6 @@ var Rect = Polygon.extend({
|
|
|
10801
10832
|
return this.setShape(rect.pos.x, rect.pos.y, rect.width, rect.height);
|
|
10802
10833
|
},
|
|
10803
10834
|
|
|
10804
|
-
/**
|
|
10805
|
-
* translate the rect by the specified offset
|
|
10806
|
-
* @name translate
|
|
10807
|
-
* @memberOf me.Rect.prototype
|
|
10808
|
-
* @function
|
|
10809
|
-
* @param {Number} x x offset
|
|
10810
|
-
* @param {Number} y y offset
|
|
10811
|
-
* @return {me.Rect} this rectangle
|
|
10812
|
-
*/
|
|
10813
|
-
/**
|
|
10814
|
-
* translate the rect by the specified vector
|
|
10815
|
-
* @name translate
|
|
10816
|
-
* @memberOf me.Rect.prototype
|
|
10817
|
-
* @function
|
|
10818
|
-
* @param {me.Vector2d} v vector offset
|
|
10819
|
-
* @return {me.Rect} this rectangle
|
|
10820
|
-
*/
|
|
10821
|
-
translate : function () {
|
|
10822
|
-
var _x, _y;
|
|
10823
|
-
|
|
10824
|
-
if (arguments.length === 2) {
|
|
10825
|
-
// x, y
|
|
10826
|
-
_x = arguments[0];
|
|
10827
|
-
_y = arguments[1];
|
|
10828
|
-
} else {
|
|
10829
|
-
// vector
|
|
10830
|
-
_x = arguments[0].x;
|
|
10831
|
-
_y = arguments[0].y;
|
|
10832
|
-
}
|
|
10833
|
-
|
|
10834
|
-
this.pos.x += _x;
|
|
10835
|
-
this.pos.y += _y;
|
|
10836
|
-
|
|
10837
|
-
return this;
|
|
10838
|
-
},
|
|
10839
|
-
|
|
10840
|
-
/**
|
|
10841
|
-
* Shifts the rect to the given position vector.
|
|
10842
|
-
* @name shift
|
|
10843
|
-
* @memberOf me.Rect
|
|
10844
|
-
* @function
|
|
10845
|
-
* @param {me.Vector2d} position
|
|
10846
|
-
*/
|
|
10847
|
-
/**
|
|
10848
|
-
* Shifts the rect to the given x, y position.
|
|
10849
|
-
* @name shift
|
|
10850
|
-
* @memberOf me.Rect
|
|
10851
|
-
* @function
|
|
10852
|
-
* @param {Number} x
|
|
10853
|
-
* @param {Number} y
|
|
10854
|
-
*/
|
|
10855
|
-
shift : function () {
|
|
10856
|
-
if (arguments.length === 2) {
|
|
10857
|
-
// x, y
|
|
10858
|
-
this.pos.set(arguments[0], arguments[1]);
|
|
10859
|
-
} else {
|
|
10860
|
-
// vector
|
|
10861
|
-
this.pos.setV(arguments[0]);
|
|
10862
|
-
}
|
|
10863
|
-
},
|
|
10864
|
-
|
|
10865
10835
|
/**
|
|
10866
10836
|
* merge this rectangle with another one
|
|
10867
10837
|
* @name union
|
|
@@ -28268,16 +28238,16 @@ let device = {
|
|
|
28268
28238
|
}
|
|
28269
28239
|
|
|
28270
28240
|
// set pause/stop action on losing focus
|
|
28271
|
-
window.addEventListener("blur", function () {
|
|
28241
|
+
window.addEventListener("blur", (function () {
|
|
28272
28242
|
if (this.stopOnBlur) {
|
|
28273
28243
|
state$1.stop(true);
|
|
28274
28244
|
}
|
|
28275
28245
|
if (this.pauseOnBlur) {
|
|
28276
28246
|
state$1.pause(true);
|
|
28277
28247
|
}
|
|
28278
|
-
}, false);
|
|
28248
|
+
}).bind(this), false);
|
|
28279
28249
|
// set restart/resume action on gaining focus
|
|
28280
|
-
window.addEventListener("focus", function () {
|
|
28250
|
+
window.addEventListener("focus", (function () {
|
|
28281
28251
|
if (this.stopOnBlur) {
|
|
28282
28252
|
state$1.restart(true);
|
|
28283
28253
|
}
|
|
@@ -28288,7 +28258,7 @@ let device = {
|
|
|
28288
28258
|
if (this.autoFocus) {
|
|
28289
28259
|
this.focus();
|
|
28290
28260
|
}
|
|
28291
|
-
}, false);
|
|
28261
|
+
}).bind(this), false);
|
|
28292
28262
|
|
|
28293
28263
|
|
|
28294
28264
|
// Set the name of the hidden property and the change event for visibility
|
|
@@ -28312,7 +28282,7 @@ let device = {
|
|
|
28312
28282
|
if (typeof (visibilityChange) === "string") {
|
|
28313
28283
|
// add the corresponding event listener
|
|
28314
28284
|
document.addEventListener(visibilityChange,
|
|
28315
|
-
function () {
|
|
28285
|
+
(function () {
|
|
28316
28286
|
if (document[hidden]) {
|
|
28317
28287
|
if (this.stopOnBlur) {
|
|
28318
28288
|
state$1.stop(true);
|
|
@@ -28328,7 +28298,7 @@ let device = {
|
|
|
28328
28298
|
state$1.resume(true);
|
|
28329
28299
|
}
|
|
28330
28300
|
}
|
|
28331
|
-
}, false
|
|
28301
|
+
}).bind(this), false
|
|
28332
28302
|
);
|
|
28333
28303
|
}
|
|
28334
28304
|
},
|
|
@@ -32368,10 +32338,10 @@ var plugin = {
|
|
|
32368
32338
|
* this can be overridden by the plugin
|
|
32369
32339
|
* @public
|
|
32370
32340
|
* @type String
|
|
32371
|
-
* @default "9.1.
|
|
32341
|
+
* @default "9.1.2"
|
|
32372
32342
|
* @name me.plugin.Base#version
|
|
32373
32343
|
*/
|
|
32374
|
-
this.version = "9.1.
|
|
32344
|
+
this.version = "9.1.2";
|
|
32375
32345
|
}
|
|
32376
32346
|
}),
|
|
32377
32347
|
|
|
@@ -36623,7 +36593,7 @@ var Jay = window.Jay;
|
|
|
36623
36593
|
* @name version
|
|
36624
36594
|
* @type {string}
|
|
36625
36595
|
*/
|
|
36626
|
-
const version = "9.1.
|
|
36596
|
+
const version = "9.1.2";
|
|
36627
36597
|
|
|
36628
36598
|
|
|
36629
36599
|
/**
|
package/package.json
CHANGED
package/src/shapes/poly.js
CHANGED
|
@@ -330,6 +330,37 @@ var Polygon = window.Jay.extend({
|
|
|
330
330
|
return this;
|
|
331
331
|
},
|
|
332
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Shifts the Polygon to the given position vector.
|
|
335
|
+
* @name shift
|
|
336
|
+
* @memberOf me.Polygon
|
|
337
|
+
* @function
|
|
338
|
+
* @param {me.Vector2d} position
|
|
339
|
+
*/
|
|
340
|
+
/**
|
|
341
|
+
* Shifts the Polygon to the given x, y position.
|
|
342
|
+
* @name shift
|
|
343
|
+
* @memberOf me.Polygon
|
|
344
|
+
* @function
|
|
345
|
+
* @param {Number} x
|
|
346
|
+
* @param {Number} y
|
|
347
|
+
*/
|
|
348
|
+
shift() {
|
|
349
|
+
var _x, _y;
|
|
350
|
+
if (arguments.length === 2) {
|
|
351
|
+
// x, y
|
|
352
|
+
_x = arguments[0];
|
|
353
|
+
_y = arguments[1];
|
|
354
|
+
} else {
|
|
355
|
+
// vector
|
|
356
|
+
_x = arguments[0].x;
|
|
357
|
+
_y = arguments[0].y;
|
|
358
|
+
}
|
|
359
|
+
this.pos.x = _x;
|
|
360
|
+
this.pos.y = _y;
|
|
361
|
+
this.updateBounds();
|
|
362
|
+
},
|
|
363
|
+
|
|
333
364
|
/**
|
|
334
365
|
* Returns true if the polygon contains the given point.
|
|
335
366
|
* (Note: it is highly recommended to first do a hit test on the corresponding <br>
|
package/src/shapes/rectangle.js
CHANGED
|
@@ -113,67 +113,6 @@ var Rect = Polygon.extend({
|
|
|
113
113
|
return this.setShape(rect.pos.x, rect.pos.y, rect.width, rect.height);
|
|
114
114
|
},
|
|
115
115
|
|
|
116
|
-
/**
|
|
117
|
-
* translate the rect by the specified offset
|
|
118
|
-
* @name translate
|
|
119
|
-
* @memberOf me.Rect.prototype
|
|
120
|
-
* @function
|
|
121
|
-
* @param {Number} x x offset
|
|
122
|
-
* @param {Number} y y offset
|
|
123
|
-
* @return {me.Rect} this rectangle
|
|
124
|
-
*/
|
|
125
|
-
/**
|
|
126
|
-
* translate the rect by the specified vector
|
|
127
|
-
* @name translate
|
|
128
|
-
* @memberOf me.Rect.prototype
|
|
129
|
-
* @function
|
|
130
|
-
* @param {me.Vector2d} v vector offset
|
|
131
|
-
* @return {me.Rect} this rectangle
|
|
132
|
-
*/
|
|
133
|
-
translate : function () {
|
|
134
|
-
var _x, _y;
|
|
135
|
-
|
|
136
|
-
if (arguments.length === 2) {
|
|
137
|
-
// x, y
|
|
138
|
-
_x = arguments[0];
|
|
139
|
-
_y = arguments[1];
|
|
140
|
-
} else {
|
|
141
|
-
// vector
|
|
142
|
-
_x = arguments[0].x;
|
|
143
|
-
_y = arguments[0].y;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
this.pos.x += _x;
|
|
147
|
-
this.pos.y += _y;
|
|
148
|
-
|
|
149
|
-
return this;
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Shifts the rect to the given position vector.
|
|
154
|
-
* @name shift
|
|
155
|
-
* @memberOf me.Rect
|
|
156
|
-
* @function
|
|
157
|
-
* @param {me.Vector2d} position
|
|
158
|
-
*/
|
|
159
|
-
/**
|
|
160
|
-
* Shifts the rect to the given x, y position.
|
|
161
|
-
* @name shift
|
|
162
|
-
* @memberOf me.Rect
|
|
163
|
-
* @function
|
|
164
|
-
* @param {Number} x
|
|
165
|
-
* @param {Number} y
|
|
166
|
-
*/
|
|
167
|
-
shift : function () {
|
|
168
|
-
if (arguments.length === 2) {
|
|
169
|
-
// x, y
|
|
170
|
-
this.pos.set(arguments[0], arguments[1]);
|
|
171
|
-
} else {
|
|
172
|
-
// vector
|
|
173
|
-
this.pos.setV(arguments[0]);
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
|
|
177
116
|
/**
|
|
178
117
|
* merge this rectangle with another one
|
|
179
118
|
* @name union
|
package/src/system/device.js
CHANGED
|
@@ -142,16 +142,16 @@ let device = {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
// set pause/stop action on losing focus
|
|
145
|
-
window.addEventListener("blur", function () {
|
|
145
|
+
window.addEventListener("blur", (function () {
|
|
146
146
|
if (this.stopOnBlur) {
|
|
147
147
|
state.stop(true);
|
|
148
148
|
}
|
|
149
149
|
if (this.pauseOnBlur) {
|
|
150
150
|
state.pause(true);
|
|
151
151
|
}
|
|
152
|
-
}, false);
|
|
152
|
+
}).bind(this), false);
|
|
153
153
|
// set restart/resume action on gaining focus
|
|
154
|
-
window.addEventListener("focus", function () {
|
|
154
|
+
window.addEventListener("focus", (function () {
|
|
155
155
|
if (this.stopOnBlur) {
|
|
156
156
|
state.restart(true);
|
|
157
157
|
}
|
|
@@ -162,7 +162,7 @@ let device = {
|
|
|
162
162
|
if (this.autoFocus) {
|
|
163
163
|
this.focus();
|
|
164
164
|
}
|
|
165
|
-
}, false);
|
|
165
|
+
}).bind(this), false);
|
|
166
166
|
|
|
167
167
|
|
|
168
168
|
// Set the name of the hidden property and the change event for visibility
|
|
@@ -186,7 +186,7 @@ let device = {
|
|
|
186
186
|
if (typeof (visibilityChange) === "string") {
|
|
187
187
|
// add the corresponding event listener
|
|
188
188
|
document.addEventListener(visibilityChange,
|
|
189
|
-
function () {
|
|
189
|
+
(function () {
|
|
190
190
|
if (document[hidden]) {
|
|
191
191
|
if (this.stopOnBlur) {
|
|
192
192
|
state.stop(true);
|
|
@@ -202,7 +202,7 @@ let device = {
|
|
|
202
202
|
state.resume(true);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
}, false
|
|
205
|
+
}).bind(this), false
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
208
|
},
|