melonjs 13.2.1 → 13.4.0

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v13.2.1
2
+ * melonJS Game Engine - v13.4.0
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -13,7 +13,7 @@ var check = function (it) {
13
13
 
14
14
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
15
15
  var global$c =
16
- // eslint-disable-next-line es-x/no-global-this -- safe
16
+ // eslint-disable-next-line es/no-global-this -- safe
17
17
  check(typeof globalThis == 'object' && globalThis) ||
18
18
  check(typeof window == 'object' && window) ||
19
19
  // eslint-disable-next-line no-restricted-globals -- safe
@@ -36,14 +36,14 @@ var fails$8 = fails$9;
36
36
 
37
37
  // Detect IE8's incomplete defineProperty implementation
38
38
  var descriptors = !fails$8(function () {
39
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
39
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
40
40
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
41
41
  });
42
42
 
43
43
  var fails$7 = fails$9;
44
44
 
45
45
  var functionBindNative = !fails$7(function () {
46
- // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
46
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
47
47
  var test = (function () { /* empty */ }).bind();
48
48
  // eslint-disable-next-line no-prototype-builtins -- safe
49
49
  return typeof test != 'function' || test.hasOwnProperty('prototype');
@@ -60,7 +60,7 @@ var functionCall = NATIVE_BIND$1 ? call$4.bind(call$4) : function () {
60
60
  var objectPropertyIsEnumerable = {};
61
61
 
62
62
  var $propertyIsEnumerable = {}.propertyIsEnumerable;
63
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
63
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
64
64
  var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
65
65
 
66
66
  // Nashorn ~ JDK8 bug
@@ -122,12 +122,20 @@ var indexedObject = fails$6(function () {
122
122
  return classof$2(it) == 'String' ? split(it, '') : $Object$3(it);
123
123
  } : $Object$3;
124
124
 
125
+ // we can't use just `it == null` since of `document.all` special case
126
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
127
+ var isNullOrUndefined$2 = function (it) {
128
+ return it === null || it === undefined;
129
+ };
130
+
131
+ var isNullOrUndefined$1 = isNullOrUndefined$2;
132
+
125
133
  var $TypeError$5 = TypeError;
126
134
 
127
135
  // `RequireObjectCoercible` abstract operation
128
136
  // https://tc39.es/ecma262/#sec-requireobjectcoercible
129
137
  var requireObjectCoercible$3 = function (it) {
130
- if (it == undefined) throw $TypeError$5("Can't call method on " + it);
138
+ if (isNullOrUndefined$1(it)) throw $TypeError$5("Can't call method on " + it);
131
139
  return it;
132
140
  };
133
141
 
@@ -139,15 +147,36 @@ var toIndexedObject$3 = function (it) {
139
147
  return IndexedObject(requireObjectCoercible$2(it));
140
148
  };
141
149
 
150
+ var documentAll$2 = typeof document == 'object' && document.all;
151
+
152
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
153
+ var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
154
+
155
+ var documentAll_1 = {
156
+ all: documentAll$2,
157
+ IS_HTMLDDA: IS_HTMLDDA
158
+ };
159
+
160
+ var $documentAll$1 = documentAll_1;
161
+
162
+ var documentAll$1 = $documentAll$1.all;
163
+
142
164
  // `IsCallable` abstract operation
143
165
  // https://tc39.es/ecma262/#sec-iscallable
144
- var isCallable$b = function (argument) {
166
+ var isCallable$b = $documentAll$1.IS_HTMLDDA ? function (argument) {
167
+ return typeof argument == 'function' || argument === documentAll$1;
168
+ } : function (argument) {
145
169
  return typeof argument == 'function';
146
170
  };
147
171
 
148
172
  var isCallable$a = isCallable$b;
173
+ var $documentAll = documentAll_1;
174
+
175
+ var documentAll = $documentAll.all;
149
176
 
150
- var isObject$5 = function (it) {
177
+ var isObject$5 = $documentAll.IS_HTMLDDA ? function (it) {
178
+ return typeof it == 'object' ? it !== null : isCallable$a(it) || it === documentAll;
179
+ } : function (it) {
151
180
  return typeof it == 'object' ? it !== null : isCallable$a(it);
152
181
  };
153
182
 
@@ -198,13 +227,13 @@ if (!version$1 && userAgent) {
198
227
 
199
228
  var engineV8Version = version$1;
200
229
 
201
- /* eslint-disable es-x/no-symbol -- required for testing */
230
+ /* eslint-disable es/no-symbol -- required for testing */
202
231
 
203
232
  var V8_VERSION = engineV8Version;
204
233
  var fails$5 = fails$9;
205
234
 
206
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
207
- var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$5(function () {
235
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
236
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
208
237
  var symbol = Symbol();
209
238
  // Chrome 38 Symbol has incorrect toString conversion
210
239
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
@@ -213,9 +242,9 @@ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$5(function () {
213
242
  !Symbol.sham && V8_VERSION && V8_VERSION < 41;
214
243
  });
215
244
 
216
- /* eslint-disable es-x/no-symbol -- required for testing */
245
+ /* eslint-disable es/no-symbol -- required for testing */
217
246
 
218
- var NATIVE_SYMBOL$1 = nativeSymbol;
247
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
219
248
 
220
249
  var useSymbolAsUid = NATIVE_SYMBOL$1
221
250
  && !Symbol.sham
@@ -257,12 +286,13 @@ var aCallable$1 = function (argument) {
257
286
  };
258
287
 
259
288
  var aCallable = aCallable$1;
289
+ var isNullOrUndefined = isNullOrUndefined$2;
260
290
 
261
291
  // `GetMethod` abstract operation
262
292
  // https://tc39.es/ecma262/#sec-getmethod
263
293
  var getMethod$1 = function (V, P) {
264
294
  var func = V[P];
265
- return func == null ? undefined : aCallable(func);
295
+ return isNullOrUndefined(func) ? undefined : aCallable(func);
266
296
  };
267
297
 
268
298
  var call$2 = functionCall;
@@ -285,7 +315,7 @@ var shared$3 = {exports: {}};
285
315
 
286
316
  var global$9 = global$c;
287
317
 
288
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
318
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
289
319
  var defineProperty$1 = Object.defineProperty;
290
320
 
291
321
  var defineGlobalProperty$3 = function (key, value) {
@@ -309,10 +339,10 @@ var store$2 = sharedStore;
309
339
  (shared$3.exports = function (key, value) {
310
340
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
311
341
  })('versions', []).push({
312
- version: '3.24.1',
342
+ version: '3.25.3',
313
343
  mode: 'global',
314
344
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
315
- license: 'https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE',
345
+ license: 'https://github.com/zloirock/core-js/blob/v3.25.3/LICENSE',
316
346
  source: 'https://github.com/zloirock/core-js'
317
347
  });
318
348
 
@@ -333,7 +363,7 @@ var hasOwnProperty = uncurryThis$7({}.hasOwnProperty);
333
363
 
334
364
  // `HasOwnProperty` abstract operation
335
365
  // https://tc39.es/ecma262/#sec-hasownproperty
336
- // eslint-disable-next-line es-x/no-object-hasown -- safe
366
+ // eslint-disable-next-line es/no-object-hasown -- safe
337
367
  var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
338
368
  return hasOwnProperty(toObject(it), key);
339
369
  };
@@ -352,7 +382,7 @@ var global$7 = global$c;
352
382
  var shared$2 = shared$3.exports;
353
383
  var hasOwn$6 = hasOwnProperty_1;
354
384
  var uid$1 = uid$2;
355
- var NATIVE_SYMBOL = nativeSymbol;
385
+ var NATIVE_SYMBOL = symbolConstructorDetection;
356
386
  var USE_SYMBOL_AS_UID = useSymbolAsUid;
357
387
 
358
388
  var WellKnownSymbolsStore = shared$2('wks');
@@ -426,7 +456,7 @@ var createElement = documentCreateElement;
426
456
 
427
457
  // Thanks to IE8 for its funny defineProperty
428
458
  var ie8DomDefine = !DESCRIPTORS$6 && !fails$4(function () {
429
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
459
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
430
460
  return Object.defineProperty(createElement('div'), 'a', {
431
461
  get: function () { return 7; }
432
462
  }).a != 7;
@@ -441,7 +471,7 @@ var toPropertyKey$1 = toPropertyKey$2;
441
471
  var hasOwn$5 = hasOwnProperty_1;
442
472
  var IE8_DOM_DEFINE$1 = ie8DomDefine;
443
473
 
444
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
474
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
445
475
  var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
446
476
 
447
477
  // `Object.getOwnPropertyDescriptor` method
@@ -463,7 +493,7 @@ var fails$3 = fails$9;
463
493
  // V8 ~ Chrome 36-
464
494
  // https://bugs.chromium.org/p/v8/issues/detail?id=3334
465
495
  var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$3(function () {
466
- // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
496
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
467
497
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
468
498
  value: 42,
469
499
  writable: false
@@ -488,9 +518,9 @@ var anObject$1 = anObject$2;
488
518
  var toPropertyKey = toPropertyKey$2;
489
519
 
490
520
  var $TypeError = TypeError;
491
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
521
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
492
522
  var $defineProperty = Object.defineProperty;
493
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
523
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
494
524
  var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
495
525
  var ENUMERABLE = 'enumerable';
496
526
  var CONFIGURABLE$1 = 'configurable';
@@ -542,7 +572,7 @@ var DESCRIPTORS$1 = descriptors;
542
572
  var hasOwn$4 = hasOwnProperty_1;
543
573
 
544
574
  var FunctionPrototype = Function.prototype;
545
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
575
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
546
576
  var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
547
577
 
548
578
  var EXISTS = hasOwn$4(FunctionPrototype, 'name');
@@ -569,15 +599,14 @@ if (!isCallable$5(store$1.inspectSource)) {
569
599
  };
570
600
  }
571
601
 
572
- var inspectSource$2 = store$1.inspectSource;
602
+ var inspectSource$1 = store$1.inspectSource;
573
603
 
574
604
  var global$5 = global$c;
575
605
  var isCallable$4 = isCallable$b;
576
- var inspectSource$1 = inspectSource$2;
577
606
 
578
607
  var WeakMap$1 = global$5.WeakMap;
579
608
 
580
- var nativeWeakMap = isCallable$4(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
609
+ var weakMapBasicDetection = isCallable$4(WeakMap$1) && /native code/.test(String(WeakMap$1));
581
610
 
582
611
  var shared$1 = shared$3.exports;
583
612
  var uid = uid$2;
@@ -590,7 +619,7 @@ var sharedKey$1 = function (key) {
590
619
 
591
620
  var hiddenKeys$3 = {};
592
621
 
593
- var NATIVE_WEAK_MAP = nativeWeakMap;
622
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
594
623
  var global$4 = global$c;
595
624
  var uncurryThis$4 = functionUncurryThis;
596
625
  var isObject = isObject$5;
@@ -624,7 +653,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
624
653
  var wmhas = uncurryThis$4(store.has);
625
654
  var wmset = uncurryThis$4(store.set);
626
655
  set = function (it, metadata) {
627
- if (wmhas(store, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
656
+ if (wmhas(store, it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
628
657
  metadata.facade = it;
629
658
  wmset(store, it, metadata);
630
659
  return metadata;
@@ -639,7 +668,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
639
668
  var STATE = sharedKey('state');
640
669
  hiddenKeys$2[STATE] = true;
641
670
  set = function (it, metadata) {
642
- if (hasOwn$3(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
671
+ if (hasOwn$3(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
643
672
  metadata.facade = it;
644
673
  createNonEnumerableProperty$1(it, STATE, metadata);
645
674
  return metadata;
@@ -665,12 +694,12 @@ var isCallable$3 = isCallable$b;
665
694
  var hasOwn$2 = hasOwnProperty_1;
666
695
  var DESCRIPTORS = descriptors;
667
696
  var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
668
- var inspectSource = inspectSource$2;
697
+ var inspectSource = inspectSource$1;
669
698
  var InternalStateModule = internalState;
670
699
 
671
700
  var enforceInternalState = InternalStateModule.enforce;
672
701
  var getInternalState = InternalStateModule.get;
673
- // eslint-disable-next-line es-x/no-object-defineproperty -- safe
702
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
674
703
  var defineProperty = Object.defineProperty;
675
704
 
676
705
  var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails$2(function () {
@@ -745,7 +774,7 @@ var floor = Math.floor;
745
774
 
746
775
  // `Math.trunc` method
747
776
  // https://tc39.es/ecma262/#sec-math.trunc
748
- // eslint-disable-next-line es-x/no-math-trunc -- safe
777
+ // eslint-disable-next-line es/no-math-trunc -- safe
749
778
  var mathTrunc = Math.trunc || function trunc(x) {
750
779
  var n = +x;
751
780
  return (n > 0 ? floor : ceil)(n);
@@ -864,14 +893,14 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
864
893
 
865
894
  // `Object.getOwnPropertyNames` method
866
895
  // https://tc39.es/ecma262/#sec-object.getownpropertynames
867
- // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
896
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
868
897
  objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
869
898
  return internalObjectKeys(O, hiddenKeys);
870
899
  };
871
900
 
872
901
  var objectGetOwnPropertySymbols = {};
873
902
 
874
- // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
903
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
875
904
  objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
876
905
 
877
906
  var getBuiltIn = getBuiltIn$3;
@@ -989,7 +1018,7 @@ var global$2 = global$c;
989
1018
 
990
1019
  // `globalThis` object
991
1020
  // https://tc39.es/ecma262/#sec-globalthis
992
- $$4({ global: true }, {
1021
+ $$4({ global: true, forced: global$2.globalThis !== global$2 }, {
993
1022
  globalThis: global$2
994
1023
  });
995
1024
 
@@ -1101,7 +1130,7 @@ var forcedStringTrimMethod$1 = stringTrimForced;
1101
1130
  // https://tc39.es/ecma262/#String.prototype.trimleft
1102
1131
  var stringTrimStart = forcedStringTrimMethod$1('trimStart') ? function trimStart() {
1103
1132
  return $trimStart(this);
1104
- // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe
1133
+ // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
1105
1134
  } : ''.trimStart;
1106
1135
 
1107
1136
  var $$3 = _export;
@@ -1109,7 +1138,7 @@ var trimStart$1 = stringTrimStart;
1109
1138
 
1110
1139
  // `String.prototype.trimLeft` method
1111
1140
  // https://tc39.es/ecma262/#sec-string.prototype.trimleft
1112
- // eslint-disable-next-line es-x/no-string-prototype-trimleft-trimright -- safe
1141
+ // eslint-disable-next-line es/no-string-prototype-trimleft-trimright -- safe
1113
1142
  $$3({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimLeft !== trimStart$1 }, {
1114
1143
  trimLeft: trimStart$1
1115
1144
  });
@@ -1121,7 +1150,7 @@ var trimStart = stringTrimStart;
1121
1150
 
1122
1151
  // `String.prototype.trimStart` method
1123
1152
  // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1124
- // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe
1153
+ // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
1125
1154
  $$2({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimStart !== trimStart }, {
1126
1155
  trimStart: trimStart
1127
1156
  });
@@ -1145,7 +1174,7 @@ var forcedStringTrimMethod = stringTrimForced;
1145
1174
  // https://tc39.es/ecma262/#String.prototype.trimright
1146
1175
  var stringTrimEnd = forcedStringTrimMethod('trimEnd') ? function trimEnd() {
1147
1176
  return $trimEnd(this);
1148
- // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe
1177
+ // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
1149
1178
  } : ''.trimEnd;
1150
1179
 
1151
1180
  var $$1 = _export;
@@ -1153,7 +1182,7 @@ var trimEnd$1 = stringTrimEnd;
1153
1182
 
1154
1183
  // `String.prototype.trimRight` method
1155
1184
  // https://tc39.es/ecma262/#sec-string.prototype.trimend
1156
- // eslint-disable-next-line es-x/no-string-prototype-trimleft-trimright -- safe
1185
+ // eslint-disable-next-line es/no-string-prototype-trimleft-trimright -- safe
1157
1186
  $$1({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimRight !== trimEnd$1 }, {
1158
1187
  trimRight: trimEnd$1
1159
1188
  });
@@ -1165,7 +1194,7 @@ var trimEnd = stringTrimEnd;
1165
1194
 
1166
1195
  // `String.prototype.trimEnd` method
1167
1196
  // https://tc39.es/ecma262/#sec-string.prototype.trimend
1168
- // eslint-disable-next-line es-x/no-string-prototype-trimstart-trimend -- safe
1197
+ // eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
1169
1198
  $({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimEnd !== trimEnd }, {
1170
1199
  trimEnd: trimEnd
1171
1200
  });
@@ -32879,10 +32908,10 @@ class BasePlugin {
32879
32908
  * this can be overridden by the plugin
32880
32909
  * @public
32881
32910
  * @type {string}
32882
- * @default "13.2.1"
32911
+ * @default "13.4.0"
32883
32912
  * @name plugin.Base#version
32884
32913
  */
32885
- this.version = "13.2.1";
32914
+ this.version = "13.4.0";
32886
32915
  }
32887
32916
  }
32888
32917
 
@@ -34090,9 +34119,11 @@ class TextMetrics extends Bounds {
34090
34119
  for (var i = 0; i < characters.length; i++) {
34091
34120
  var ch = characters[i].charCodeAt(0);
34092
34121
  var glyph = this.ancestor.fontData.glyphs[ch];
34093
- var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
34094
- width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
34095
- lastGlyph = glyph;
34122
+ if (typeof glyph !== "undefined") {
34123
+ var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
34124
+ width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
34125
+ lastGlyph = glyph;
34126
+ }
34096
34127
  }
34097
34128
  return width;
34098
34129
  }
@@ -34923,25 +34954,32 @@ class BitmapText extends Renderable {
34923
34954
  // calculate the char index
34924
34955
  var ch = string.charCodeAt(c);
34925
34956
  var glyph = this.fontData.glyphs[ch];
34926
- var glyphWidth = glyph.width;
34927
- var glyphHeight = glyph.height;
34928
- var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
34929
-
34930
- // draw it
34931
- if (glyphWidth !== 0 && glyphHeight !== 0) {
34932
- // some browser throw an exception when drawing a 0 width or height image
34933
- renderer.drawImage(this.fontImage,
34934
- glyph.x, glyph.y,
34935
- glyphWidth, glyphHeight,
34936
- x + glyph.xoffset,
34937
- y + glyph.yoffset * this.fontScale.y,
34938
- glyphWidth * this.fontScale.x, glyphHeight * this.fontScale.y
34939
- );
34940
- }
34941
34957
 
34942
- // increment position
34943
- x += (glyph.xadvance + kerning) * this.fontScale.x;
34944
- lastGlyph = glyph;
34958
+ if (typeof glyph !== "undefined") {
34959
+ var glyphWidth = glyph.width;
34960
+ var glyphHeight = glyph.height;
34961
+ var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
34962
+ var scaleX = this.fontScale.x;
34963
+ var scaleY = this.fontScale.y;
34964
+
34965
+ // draw it
34966
+ if (glyphWidth !== 0 && glyphHeight !== 0) {
34967
+ // some browser throw an exception when drawing a 0 width or height image
34968
+ renderer.drawImage(this.fontImage,
34969
+ glyph.x, glyph.y,
34970
+ glyphWidth, glyphHeight,
34971
+ x + glyph.xoffset * scaleX,
34972
+ y + glyph.yoffset * scaleY,
34973
+ glyphWidth * scaleX, glyphHeight * scaleY
34974
+ );
34975
+ }
34976
+
34977
+ // increment position
34978
+ x += (glyph.xadvance + kerning) * scaleX;
34979
+ lastGlyph = glyph;
34980
+ } else {
34981
+ console.warn("BitmapText: no defined Glyph in for " + String.fromCharCode(ch));
34982
+ }
34945
34983
  }
34946
34984
  // increment line
34947
34985
  y += stringHeight;
@@ -37691,7 +37729,7 @@ Renderer.prototype.getScreenContext = function() {
37691
37729
  * @name version
37692
37730
  * @type {string}
37693
37731
  */
37694
- const version = "13.2.1";
37732
+ const version = "13.4.0";
37695
37733
 
37696
37734
 
37697
37735
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melonjs",
3
- "version": "13.2.1",
3
+ "version": "13.4.0",
4
4
  "description": "melonJS Game Engine",
5
5
  "homepage": "http://www.melonjs.org/",
6
6
  "keywords": [
@@ -52,7 +52,7 @@
52
52
  ],
53
53
  "dependencies": {
54
54
  "@teppeis/multimaps": "^2.0.0",
55
- "core-js": "^3.24.1",
55
+ "core-js": "^3.25.3",
56
56
  "earcut": "2.2.4",
57
57
  "eventemitter3": "^4.0.7",
58
58
  "howler": "2.2.3"
@@ -62,24 +62,24 @@
62
62
  "@rollup/plugin-buble": "^0.21.3",
63
63
  "@rollup/plugin-commonjs": "^22.0.2",
64
64
  "@rollup/plugin-image": "^2.1.1",
65
- "@rollup/plugin-node-resolve": "^13.3.0",
65
+ "@rollup/plugin-node-resolve": "^14.1.0",
66
66
  "@rollup/plugin-replace": "^4.0.0",
67
67
  "@types/offscreencanvas": "^2019.7.0",
68
- "@webdoc/cli": "^2.0.0",
68
+ "@webdoc/cli": "^2.1.2",
69
69
  "del-cli": "^5.0.0",
70
- "eslint": "^8.22.0",
71
- "jasmine-core": "^4.3.0",
72
- "karma": "^6.4.0",
70
+ "eslint": "^8.24.0",
71
+ "jasmine-core": "^4.4.0",
72
+ "karma": "^6.4.1",
73
73
  "karma-chrome-launcher": "^3.1.1",
74
74
  "karma-coverage": "^2.2.0",
75
75
  "karma-html-detailed-reporter": "^2.1.0",
76
76
  "karma-jasmine": "^5.1.0",
77
77
  "karma-nyan-reporter": "0.2.5",
78
- "rollup": "^2.78.1",
78
+ "rollup": "^2.79.1",
79
79
  "rollup-plugin-bundle-size": "^1.0.3",
80
80
  "rollup-plugin-string": "^3.0.0",
81
- "terser": "^5.14.2",
82
- "typescript": "^4.7.4"
81
+ "terser": "^5.15.0",
82
+ "typescript": "^4.8.3"
83
83
  },
84
84
  "scripts": {
85
85
  "build": "npm run lint && rollup -c --silent",
@@ -302,25 +302,32 @@ class BitmapText extends Renderable {
302
302
  // calculate the char index
303
303
  var ch = string.charCodeAt(c);
304
304
  var glyph = this.fontData.glyphs[ch];
305
- var glyphWidth = glyph.width;
306
- var glyphHeight = glyph.height;
307
- var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
308
-
309
- // draw it
310
- if (glyphWidth !== 0 && glyphHeight !== 0) {
311
- // some browser throw an exception when drawing a 0 width or height image
312
- renderer.drawImage(this.fontImage,
313
- glyph.x, glyph.y,
314
- glyphWidth, glyphHeight,
315
- x + glyph.xoffset,
316
- y + glyph.yoffset * this.fontScale.y,
317
- glyphWidth * this.fontScale.x, glyphHeight * this.fontScale.y
318
- );
319
- }
320
305
 
321
- // increment position
322
- x += (glyph.xadvance + kerning) * this.fontScale.x;
323
- lastGlyph = glyph;
306
+ if (typeof glyph !== "undefined") {
307
+ var glyphWidth = glyph.width;
308
+ var glyphHeight = glyph.height;
309
+ var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
310
+ var scaleX = this.fontScale.x;
311
+ var scaleY = this.fontScale.y;
312
+
313
+ // draw it
314
+ if (glyphWidth !== 0 && glyphHeight !== 0) {
315
+ // some browser throw an exception when drawing a 0 width or height image
316
+ renderer.drawImage(this.fontImage,
317
+ glyph.x, glyph.y,
318
+ glyphWidth, glyphHeight,
319
+ x + glyph.xoffset * scaleX,
320
+ y + glyph.yoffset * scaleY,
321
+ glyphWidth * scaleX, glyphHeight * scaleY
322
+ );
323
+ }
324
+
325
+ // increment position
326
+ x += (glyph.xadvance + kerning) * scaleX;
327
+ lastGlyph = glyph;
328
+ } else {
329
+ console.warn("BitmapText: no defined Glyph in for " + String.fromCharCode(ch));
330
+ }
324
331
  }
325
332
  // increment line
326
333
  y += stringHeight;
@@ -56,9 +56,11 @@ class TextMetrics extends Bounds {
56
56
  for (var i = 0; i < characters.length; i++) {
57
57
  var ch = characters[i].charCodeAt(0);
58
58
  var glyph = this.ancestor.fontData.glyphs[ch];
59
- var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
60
- width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
61
- lastGlyph = glyph;
59
+ if (typeof glyph !== "undefined") {
60
+ var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
61
+ width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
62
+ lastGlyph = glyph;
63
+ }
62
64
  }
63
65
  return width;
64
66
  }