melonjs 15.11.0 → 15.13.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.
Files changed (151) hide show
  1. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
  2. package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
  3. package/dist/melonjs.mjs/_virtual/howler.js +1 -1
  4. package/dist/melonjs.mjs/_virtual/index.js +1 -1
  5. package/dist/melonjs.mjs/application/application.js +1 -1
  6. package/dist/melonjs.mjs/application/header.js +2 -2
  7. package/dist/melonjs.mjs/application/resize.js +1 -1
  8. package/dist/melonjs.mjs/application/settings.js +1 -1
  9. package/dist/melonjs.mjs/audio/audio.js +1 -1
  10. package/dist/melonjs.mjs/camera/camera2d.js +1 -1
  11. package/dist/melonjs.mjs/const.js +1 -1
  12. package/dist/melonjs.mjs/geometries/ellipse.js +1 -1
  13. package/dist/melonjs.mjs/geometries/line.js +1 -1
  14. package/dist/melonjs.mjs/geometries/path2d.js +1 -1
  15. package/dist/melonjs.mjs/geometries/point.js +1 -1
  16. package/dist/melonjs.mjs/geometries/poly.js +1 -1
  17. package/dist/melonjs.mjs/geometries/rectangle.js +1 -1
  18. package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
  19. package/dist/melonjs.mjs/index.js +2 -2
  20. package/dist/melonjs.mjs/input/gamepad.js +1 -1
  21. package/dist/melonjs.mjs/input/input.js +1 -1
  22. package/dist/melonjs.mjs/input/keyboard.js +1 -1
  23. package/dist/melonjs.mjs/input/pointer.js +1 -1
  24. package/dist/melonjs.mjs/input/pointerevent.js +1 -1
  25. package/dist/melonjs.mjs/lang/console.js +1 -1
  26. package/dist/melonjs.mjs/lang/deprecated.js +30 -1
  27. package/dist/melonjs.mjs/level/level.js +1 -1
  28. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
  29. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +1 -1
  30. package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
  31. package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
  32. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +1 -1
  33. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +1 -1
  34. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
  35. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +1 -1
  36. package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
  37. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  38. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  39. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
  40. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +1 -1
  41. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
  42. package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
  43. package/dist/melonjs.mjs/loader/cache.js +1 -1
  44. package/dist/melonjs.mjs/loader/loader.js +1 -1
  45. package/dist/melonjs.mjs/loader/loadingscreen.js +6 -6
  46. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
  47. package/dist/melonjs.mjs/loader/parsers/binary.js +1 -1
  48. package/dist/melonjs.mjs/loader/parsers/fontface.js +1 -1
  49. package/dist/melonjs.mjs/loader/parsers/image.js +1 -1
  50. package/dist/melonjs.mjs/loader/parsers/json.js +1 -1
  51. package/dist/melonjs.mjs/loader/parsers/script.js +1 -1
  52. package/dist/melonjs.mjs/loader/parsers/tmx.js +1 -1
  53. package/dist/melonjs.mjs/loader/settings.js +1 -1
  54. package/dist/melonjs.mjs/math/color.js +1 -1
  55. package/dist/melonjs.mjs/math/math.js +1 -1
  56. package/dist/melonjs.mjs/math/matrix2.js +1 -1
  57. package/dist/melonjs.mjs/math/matrix3.js +1 -1
  58. package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
  59. package/dist/melonjs.mjs/math/observable_vector3.js +1 -1
  60. package/dist/melonjs.mjs/math/vector2.js +1 -1
  61. package/dist/melonjs.mjs/math/vector3.js +1 -1
  62. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
  63. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
  64. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
  65. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
  66. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
  67. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +21 -15
  68. package/dist/melonjs.mjs/particles/emitter.js +1 -1
  69. package/dist/melonjs.mjs/particles/particle.js +1 -1
  70. package/dist/melonjs.mjs/particles/settings.js +1 -1
  71. package/dist/melonjs.mjs/physics/body.js +1 -1
  72. package/dist/melonjs.mjs/physics/bounds.js +1 -1
  73. package/dist/melonjs.mjs/physics/collision.js +1 -1
  74. package/dist/melonjs.mjs/physics/detector.js +1 -1
  75. package/dist/melonjs.mjs/physics/quadtree.js +1 -1
  76. package/dist/melonjs.mjs/physics/response.js +1 -1
  77. package/dist/melonjs.mjs/physics/sat.js +1 -1
  78. package/dist/melonjs.mjs/physics/world.js +1 -1
  79. package/dist/melonjs.mjs/plugin/plugin.js +3 -3
  80. package/dist/melonjs.mjs/renderable/collectable.js +1 -1
  81. package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
  82. package/dist/melonjs.mjs/renderable/container.js +1 -1
  83. package/dist/melonjs.mjs/renderable/draggable.js +1 -1
  84. package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
  85. package/dist/melonjs.mjs/renderable/entity/entity.js +1 -1
  86. package/dist/melonjs.mjs/renderable/imagelayer.js +1 -1
  87. package/dist/melonjs.mjs/renderable/light2d.js +1 -1
  88. package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
  89. package/dist/melonjs.mjs/renderable/renderable.js +1 -1
  90. package/dist/melonjs.mjs/renderable/sprite.js +1 -1
  91. package/dist/melonjs.mjs/renderable/text/bitmaptext.js +1 -1
  92. package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +1 -1
  93. package/dist/melonjs.mjs/renderable/text/glyph.js +1 -1
  94. package/dist/melonjs.mjs/renderable/text/text.js +1 -1
  95. package/dist/melonjs.mjs/renderable/text/textmetrics.js +1 -1
  96. package/dist/melonjs.mjs/renderable/text/textstyle.js +1 -1
  97. package/dist/melonjs.mjs/renderable/trigger.js +1 -1
  98. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +1 -1
  99. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +1 -1
  100. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +12 -11
  101. package/dist/melonjs.mjs/state/stage.js +3 -3
  102. package/dist/melonjs.mjs/state/state.js +1 -1
  103. package/dist/melonjs.mjs/system/device.js +1 -1
  104. package/dist/melonjs.mjs/system/dom.js +1 -1
  105. package/dist/melonjs.mjs/system/event.js +1 -1
  106. package/dist/melonjs.mjs/system/platform.js +1 -1
  107. package/dist/melonjs.mjs/system/pooling.js +1 -1
  108. package/dist/melonjs.mjs/system/save.js +1 -1
  109. package/dist/melonjs.mjs/system/timer.js +1 -1
  110. package/dist/melonjs.mjs/tweens/easing.js +1 -1
  111. package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
  112. package/dist/melonjs.mjs/tweens/tween.js +1 -1
  113. package/dist/melonjs.mjs/utils/agent.js +2 -1
  114. package/dist/melonjs.mjs/utils/array.js +1 -1
  115. package/dist/melonjs.mjs/utils/file.js +1 -1
  116. package/dist/melonjs.mjs/utils/function.js +1 -1
  117. package/dist/melonjs.mjs/utils/string.js +1 -1
  118. package/dist/melonjs.mjs/utils/utils.js +1 -1
  119. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +1 -1
  120. package/dist/melonjs.mjs/video/renderer.js +29 -23
  121. package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
  122. package/dist/melonjs.mjs/video/texture/cache.js +1 -1
  123. package/dist/melonjs.mjs/video/texture/canvas_texture.js +1 -1
  124. package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
  125. package/dist/melonjs.mjs/video/video.js +1 -1
  126. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
  127. package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +1 -1
  128. package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +1 -1
  129. package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +1 -1
  130. package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
  131. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
  132. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
  133. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
  134. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
  135. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
  136. package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
  137. package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
  138. package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
  139. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
  140. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1 -1
  141. package/dist/melonjs.module.js +113 -70
  142. package/dist/types/renderable/ui/uitextbutton.d.ts +10 -3
  143. package/dist/types/video/renderer.d.ts +12 -10
  144. package/package.json +15 -15
  145. package/src/application/header.js +1 -1
  146. package/src/lang/deprecated.js +31 -0
  147. package/src/loader/loadingscreen.js +5 -5
  148. package/src/renderable/ui/uitextbutton.js +11 -10
  149. package/src/state/stage.js +2 -2
  150. package/src/utils/agent.js +1 -0
  151. package/src/video/renderer.js +28 -22
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v15.11.0
2
+ * melonJS Game Engine - v15.13.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
@@ -205,7 +205,7 @@ var $TypeError$5 = TypeError;
205
205
  // `RequireObjectCoercible` abstract operation
206
206
  // https://tc39.es/ecma262/#sec-requireobjectcoercible
207
207
  var requireObjectCoercible$3 = function (it) {
208
- if (isNullOrUndefined$1(it)) throw $TypeError$5("Can't call method on " + it);
208
+ if (isNullOrUndefined$1(it)) throw new $TypeError$5("Can't call method on " + it);
209
209
  return it;
210
210
  };
211
211
 
@@ -393,7 +393,7 @@ var $TypeError$4 = TypeError;
393
393
  // `Assert: IsCallable(argument) is true`
394
394
  var aCallable$1 = function (argument) {
395
395
  if (isCallable$7(argument)) return argument;
396
- throw $TypeError$4(tryToString(argument) + ' is not a function');
396
+ throw new $TypeError$4(tryToString(argument) + ' is not a function');
397
397
  };
398
398
 
399
399
  var aCallable$2 = /*@__PURE__*/getDefaultExportFromCjs(aCallable$1);
@@ -425,7 +425,7 @@ var ordinaryToPrimitive$1 = function (input, pref) {
425
425
  if (pref === 'string' && isCallable$6(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
426
426
  if (isCallable$6(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
427
427
  if (pref !== 'string' && isCallable$6(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
428
- throw $TypeError$3("Can't convert object to primitive value");
428
+ throw new $TypeError$3("Can't convert object to primitive value");
429
429
  };
430
430
 
431
431
  var ordinaryToPrimitive$2 = /*@__PURE__*/getDefaultExportFromCjs(ordinaryToPrimitive$1);
@@ -473,10 +473,10 @@ var store$2 = sharedStore;
473
473
  (shared$5.exports = function (key, value) {
474
474
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
475
475
  })('versions', []).push({
476
- version: '3.32.2',
476
+ version: '3.33.0',
477
477
  mode: IS_PURE ? 'pure' : 'global',
478
478
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
479
- license: 'https://github.com/zloirock/core-js/blob/v3.32.2/LICENSE',
479
+ license: 'https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE',
480
480
  source: 'https://github.com/zloirock/core-js'
481
481
  });
482
482
 
@@ -567,7 +567,7 @@ var toPrimitive$1 = function (input, pref) {
567
567
  if (pref === undefined) pref = 'default';
568
568
  result = call$1(exoticToPrim, input, pref);
569
569
  if (!isObject$3(result) || isSymbol$1(result)) return result;
570
- throw $TypeError$2("Can't convert object to primitive value");
570
+ throw new $TypeError$2("Can't convert object to primitive value");
571
571
  }
572
572
  if (pref === undefined) pref = 'number';
573
573
  return ordinaryToPrimitive(input, pref);
@@ -668,7 +668,7 @@ var $TypeError$1 = TypeError;
668
668
  // `Assert: Type(argument) is Object`
669
669
  var anObject$2 = function (argument) {
670
670
  if (isObject$1(argument)) return argument;
671
- throw $TypeError$1($String$2(argument) + ' is not an object');
671
+ throw new $TypeError$1($String$2(argument) + ' is not an object');
672
672
  };
673
673
 
674
674
  var anObject$3 = /*@__PURE__*/getDefaultExportFromCjs(anObject$2);
@@ -713,7 +713,7 @@ var f$2 = objectDefineProperty.f = DESCRIPTORS$3 ? V8_PROTOTYPE_DEFINE_BUG ? fun
713
713
  if (IE8_DOM_DEFINE) try {
714
714
  return $defineProperty(O, P, Attributes);
715
715
  } catch (error) { /* empty */ }
716
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
716
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
717
717
  if ('value' in Attributes) O[P] = Attributes.value;
718
718
  return O;
719
719
  };
@@ -823,7 +823,7 @@ var getterFor = function (TYPE) {
823
823
  return function (it) {
824
824
  var state;
825
825
  if (!isObject(it) || (state = get$1(it)).type !== TYPE) {
826
- throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
826
+ throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
827
827
  } return state;
828
828
  };
829
829
  };
@@ -836,7 +836,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
836
836
  store.set = store.set;
837
837
  /* eslint-enable no-self-assign -- prototype methods protection */
838
838
  set = function (it, metadata) {
839
- if (store.has(it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
839
+ if (store.has(it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
840
840
  metadata.facade = it;
841
841
  store.set(it, metadata);
842
842
  return metadata;
@@ -851,7 +851,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
851
851
  var STATE = sharedKey('state');
852
852
  hiddenKeys$2[STATE] = true;
853
853
  set = function (it, metadata) {
854
- if (hasOwn$3(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
854
+ if (hasOwn$3(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
855
855
  metadata.facade = it;
856
856
  createNonEnumerableProperty$1(it, STATE, metadata);
857
857
  return metadata;
@@ -1326,7 +1326,7 @@ var classof = classof$1;
1326
1326
  var $String = String;
1327
1327
 
1328
1328
  var toString$2 = function (argument) {
1329
- if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1329
+ if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
1330
1330
  return $String(argument);
1331
1331
  };
1332
1332
 
@@ -9763,7 +9763,7 @@ var event = {
9763
9763
  var howler$1 = {};
9764
9764
 
9765
9765
  /*!
9766
- * howler.js v2.2.3
9766
+ * howler.js v2.2.4
9767
9767
  * howlerjs.com
9768
9768
  *
9769
9769
  * (c) 2013-2020, James Simpson of GoldFire Studios
@@ -10030,7 +10030,7 @@ var howler$1 = {};
10030
10030
 
10031
10031
  // Opera version <33 has mixed MP3 support, so we need to check for and block it.
10032
10032
  var ua = self._navigator ? self._navigator.userAgent : '';
10033
- var checkOpera = ua.match(/OPR\/([0-6].)/g);
10033
+ var checkOpera = ua.match(/OPR\/(\d+)/g);
10034
10034
  var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33);
10035
10035
  var checkSafari = ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1;
10036
10036
  var safariVersion = ua.match(/Version\/(.*?) /);
@@ -11932,6 +11932,10 @@ var howler$1 = {};
11932
11932
  var self = this;
11933
11933
  var isIOS = Howler._navigator && Howler._navigator.vendor.indexOf('Apple') >= 0;
11934
11934
 
11935
+ if (!node.bufferSource) {
11936
+ return self;
11937
+ }
11938
+
11935
11939
  if (Howler._scratchBuffer && node.bufferSource) {
11936
11940
  node.bufferSource.onended = null;
11937
11941
  node.bufferSource.disconnect(0);
@@ -12351,7 +12355,7 @@ var howler$1 = {};
12351
12355
  /*!
12352
12356
  * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
12353
12357
  *
12354
- * howler.js v2.2.3
12358
+ * howler.js v2.2.4
12355
12359
  * howlerjs.com
12356
12360
  *
12357
12361
  * (c) 2013-2020, James Simpson of GoldFire Studios
@@ -12864,18 +12868,9 @@ var howler$1 = {};
12864
12868
  panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : pa.panningModel
12865
12869
  };
12866
12870
 
12867
- // Update the panner values or create a new panner if none exists.
12871
+ // Create a new panner node if one doesn't already exist.
12868
12872
  var panner = sound._panner;
12869
- if (panner) {
12870
- panner.coneInnerAngle = pa.coneInnerAngle;
12871
- panner.coneOuterAngle = pa.coneOuterAngle;
12872
- panner.coneOuterGain = pa.coneOuterGain;
12873
- panner.distanceModel = pa.distanceModel;
12874
- panner.maxDistance = pa.maxDistance;
12875
- panner.refDistance = pa.refDistance;
12876
- panner.rolloffFactor = pa.rolloffFactor;
12877
- panner.panningModel = pa.panningModel;
12878
- } else {
12873
+ if (!panner) {
12879
12874
  // Make sure we have a position to setup the node with.
12880
12875
  if (!sound._pos) {
12881
12876
  sound._pos = self._pos || [0, 0, -0.5];
@@ -12883,7 +12878,18 @@ var howler$1 = {};
12883
12878
 
12884
12879
  // Create a new panner node.
12885
12880
  setupPanner(sound, 'spatial');
12881
+ panner = sound._panner;
12886
12882
  }
12883
+
12884
+ // Update the panner values or create a new panner if none exists.
12885
+ panner.coneInnerAngle = pa.coneInnerAngle;
12886
+ panner.coneOuterAngle = pa.coneOuterAngle;
12887
+ panner.coneOuterGain = pa.coneOuterGain;
12888
+ panner.distanceModel = pa.distanceModel;
12889
+ panner.maxDistance = pa.maxDistance;
12890
+ panner.refDistance = pa.refDistance;
12891
+ panner.rolloffFactor = pa.rolloffFactor;
12892
+ panner.panningModel = pa.panningModel;
12887
12893
  }
12888
12894
  }
12889
12895
 
@@ -13935,6 +13941,7 @@ function setPrefixed(name, value, obj) {
13935
13941
  obj[name] = value;
13936
13942
  return true;
13937
13943
  }
13944
+ return false;
13938
13945
  });
13939
13946
 
13940
13947
  return false;
@@ -18966,8 +18973,8 @@ class Stage {
18966
18973
  // empty or no default camera
18967
18974
  if (this.cameras.has("default") === false) {
18968
18975
  if (typeof default_camera === "undefined") {
18969
- let width = renderer.getWidth();
18970
- let height = renderer.getHeight();
18976
+ let width = renderer.width;
18977
+ let height = renderer.height;
18971
18978
  // new default camera instance
18972
18979
  default_camera = new Camera2d(0, 0, width, height);
18973
18980
  }
@@ -21019,6 +21026,30 @@ class Renderer {
21019
21026
  this.uvOffset = 0;
21020
21027
  }
21021
21028
 
21029
+ /**
21030
+ * return the height of the canvas which this renderer draws to
21031
+ * @returns {number} height of the system Canvas
21032
+ */
21033
+ get height() {
21034
+ return this.getCanvas().height;
21035
+ }
21036
+
21037
+ set height(value) {
21038
+ this.resize(this.width, value);
21039
+ }
21040
+
21041
+ /**
21042
+ * return the width of the canvas which this renderer draws to
21043
+ * @returns {number} width of the system Canvas
21044
+ */
21045
+ get width() {
21046
+ return this.getCanvas().width;
21047
+ }
21048
+
21049
+ set width(value) {
21050
+ this.resize(value, this.height);
21051
+ }
21052
+
21022
21053
  /**
21023
21054
  * prepare the framebuffer for drawing a new frame
21024
21055
  */
@@ -21040,8 +21071,8 @@ class Renderer {
21040
21071
  this.cache.clear();
21041
21072
  this.currentScissor[0] = 0;
21042
21073
  this.currentScissor[1] = 0;
21043
- this.currentScissor[2] = this.getCanvas().width;
21044
- this.currentScissor[3] = this.getCanvas().height;
21074
+ this.currentScissor[2] = this.width;
21075
+ this.currentScissor[3] = this.height;
21045
21076
  this.clearMask();
21046
21077
  }
21047
21078
 
@@ -21053,7 +21084,6 @@ class Renderer {
21053
21084
  return this.canvas;
21054
21085
  }
21055
21086
 
21056
-
21057
21087
  /**
21058
21088
  * return a reference to this renderer canvas corresponding Context
21059
21089
  * @returns {CanvasRenderingContext2D|WebGLRenderingContext}
@@ -21106,22 +21136,6 @@ class Renderer {
21106
21136
  return _context;
21107
21137
  }
21108
21138
 
21109
- /**
21110
- * return the width of the system Canvas
21111
- * @returns {number}
21112
- */
21113
- getWidth() {
21114
- return this.getCanvas().width;
21115
- }
21116
-
21117
- /**
21118
- * return the height of the system Canvas
21119
- * @returns {number} height of the system Canvas
21120
- */
21121
- getHeight() {
21122
- return this.getCanvas().height;
21123
- }
21124
-
21125
21139
  /**
21126
21140
  * get the current fill & stroke style color.
21127
21141
  * @returns {Color} current global color
@@ -21145,12 +21159,11 @@ class Renderer {
21145
21159
  */
21146
21160
  overlaps(bounds) {
21147
21161
  return (
21148
- bounds.left <= this.getWidth() && bounds.right >= 0 &&
21149
- bounds.top <= this.getHeight() && bounds.bottom >= 0
21162
+ bounds.left <= this.width && bounds.right >= 0 &&
21163
+ bounds.top <= this.height && bounds.bottom >= 0
21150
21164
  );
21151
21165
  }
21152
21166
 
21153
-
21154
21167
  /**
21155
21168
  * resizes the system canvas
21156
21169
  * @param {number} width - new width of the canvas
@@ -27908,7 +27921,7 @@ class ProgressBar extends Renderable {
27908
27921
  draw(renderer, viewport) {
27909
27922
  // draw the progress bar
27910
27923
  renderer.setColor("black");
27911
- renderer.fillRect(this.pos.x, viewport.centerY, renderer.getWidth(), this.barHeight / 2);
27924
+ renderer.fillRect(this.pos.x, viewport.centerY, renderer.width, this.barHeight / 2);
27912
27925
 
27913
27926
  renderer.setColor("#55aa00");
27914
27927
  renderer.fillRect(this.pos.x, viewport.centerY, this.progress, this.barHeight / 2);
@@ -27944,8 +27957,8 @@ class DefaultLoadingScreen extends Stage {
27944
27957
  // progress bar
27945
27958
  game.world.addChild(new ProgressBar(
27946
27959
  0,
27947
- renderer.getHeight() / 2,
27948
- renderer.getWidth(),
27960
+ renderer.height / 2,
27961
+ renderer.width,
27949
27962
  barHeight
27950
27963
  ), 1);
27951
27964
 
@@ -27953,8 +27966,8 @@ class DefaultLoadingScreen extends Stage {
27953
27966
  load({name: "melonjs_logo", type: "image", src: img}, () => {
27954
27967
  // melonJS logo
27955
27968
  game.world.addChild(new Sprite(
27956
- renderer.getWidth() / 2,
27957
- renderer.getHeight() / 2, {
27969
+ renderer.width / 2,
27970
+ renderer.height / 2, {
27958
27971
  image : "melonjs_logo",
27959
27972
  framewidth : 256,
27960
27973
  frameheight : 256
@@ -34647,8 +34660,8 @@ class UITextButton extends UIBaseElement {
34647
34660
  * @param {number} [settings.size=1] - The scale factor of the BitmapText
34648
34661
  * @param {string} [settings.text] - The text to display
34649
34662
  * @param {string} [settings.bindKey] - The key to bind the action to (default: none)
34650
- * @param {string} [settings.backgroundColor="#00aa0080"] - The css value of a background color
34651
- * @param {string} [settings.hoverColor="#00ff00ff"] - The css value of a color to be used if the pointer hovers over the button
34663
+ * @param {string} [settings.hoverOffColor="#00aa0080"] - The css value of a color to be used if the pointer is not hovering over the button
34664
+ * @param {string} [settings.hoverOnColor="#00ff00ff"] - The css value of a color to be used if the pointer hovers over the button
34652
34665
  * @param {string} [settings.borderStrokeColor="#000000"] - The css value of a color to be used to draw the border
34653
34666
  * @param {string} [settings.fillStyle] - The css value of a tint color to be used to tint the BitmapText
34654
34667
  * @param {string} [settings.textAlign="center"] - horizontal text alignment
@@ -34665,6 +34678,8 @@ class UITextButton extends UIBaseElement {
34665
34678
  * // if you omit the next two, size is calculated by the size of the text
34666
34679
  * borderWidth: 200,
34667
34680
  * borderHeight: 20,
34681
+ * backgroundColor: '#00aa0080',
34682
+ * hoverColor: '#00ff00ff'
34668
34683
  * });
34669
34684
  * }
34670
34685
  *
@@ -34685,16 +34700,18 @@ class UITextButton extends UIBaseElement {
34685
34700
  this.bindKey = settings.bindKey || -1;
34686
34701
 
34687
34702
  /**
34688
- * The css value of a background color
34703
+ * The css value of a color to be used if the pointer is nothovering over the button
34689
34704
  * @type {string}
34690
34705
  */
34691
- this.backgroundColor = settings.backgroundColor || "#00aa0080";
34706
+ // keep settings.backgroundColor for backward compatibility
34707
+ this.hoverOffColor = settings.hoverOffColor || settings.backgroundColor || "#00aa0080";
34692
34708
 
34693
34709
  /**
34694
34710
  * The css value of a color to be used if the pointer hovers over the button
34695
34711
  * @type {string}
34696
34712
  */
34697
- this.hoverColor = settings.hoverColor || "#00ff00ff";
34713
+ // keep settings.hoverColor for backward compatibility
34714
+ this.hoverOnColor = settings.hoverOnColor || settings.hoverColor || "#00ff00ff";
34698
34715
 
34699
34716
  /**
34700
34717
  * The css value of a color to be used to draw the border
@@ -34749,16 +34766,13 @@ class UITextButton extends UIBaseElement {
34749
34766
 
34750
34767
  draw(renderer) {
34751
34768
  if (this.hover === true) {
34752
- renderer.setColor(this.hoverColor);
34769
+ renderer.setColor(this.hoverOnColor);
34753
34770
  } else {
34754
- renderer.setColor(this.backgroundColor);
34771
+ renderer.setColor(this.hoverOffColor);
34755
34772
  }
34756
34773
  renderer.fill(this.border);
34757
34774
  renderer.setColor(this.borderStrokeColor);
34758
34775
  renderer.stroke(this.border);
34759
- this.bitmapText.preDraw(renderer);
34760
- this.bitmapText.draw(renderer);
34761
- this.bitmapText.postDraw(renderer);
34762
34776
  super.draw(renderer);
34763
34777
  }
34764
34778
  }
@@ -37892,7 +37906,7 @@ function consoleHeader(app) {
37892
37906
  );
37893
37907
 
37894
37908
  console.log( "resolution: " + "requested " + app.settings.width + "x" + app.settings.height +
37895
- ", got " + app.renderer.getWidth() + "x" + app.renderer.getHeight()
37909
+ ", got " + app.renderer.width + "x" + app.renderer.height
37896
37910
  );
37897
37911
  }
37898
37912
 
@@ -38340,9 +38354,9 @@ class BasePlugin {
38340
38354
  * define the minimum required version of melonJS<br>
38341
38355
  * this can be overridden by the plugin
38342
38356
  * @type {string}
38343
- * @default "15.11.0"
38357
+ * @default "15.13.0"
38344
38358
  */
38345
- this.version = "15.11.0";
38359
+ this.version = "15.13.0";
38346
38360
 
38347
38361
  /**
38348
38362
  * a reference to the app/game that registered this plugin
@@ -38585,6 +38599,35 @@ class GUI_Object extends UISpriteElement {
38585
38599
  }
38586
38600
  }
38587
38601
 
38602
+
38603
+ /**
38604
+ * return the width of the system Canvas
38605
+ * @public
38606
+ * @name getWidth
38607
+ * @class
38608
+ * @memberof Renderer#
38609
+ * @deprecated since 15.12.0
38610
+ * @see width
38611
+ */
38612
+ Renderer.prototype.getWidth = function() {
38613
+ warning("getWidth", "width", "15.12.0");
38614
+ return this.width;
38615
+ };
38616
+
38617
+ /**
38618
+ * return the height of the system Canvas
38619
+ * @public
38620
+ * @name getHeight
38621
+ * @class
38622
+ * @memberof Renderer#
38623
+ * @deprecated since 15.12.0
38624
+ * @see height
38625
+ */
38626
+ Renderer.prototype.getHeight = function() {
38627
+ warning("getHeight", "height", "15.12.0");
38628
+ return this.height;
38629
+ };
38630
+
38588
38631
  // ES5/ES6 polyfills
38589
38632
 
38590
38633
 
@@ -38595,7 +38638,7 @@ class GUI_Object extends UISpriteElement {
38595
38638
  * @name version
38596
38639
  * @type {string}
38597
38640
  */
38598
- const version = "15.11.0";
38641
+ const version = "15.13.0";
38599
38642
 
38600
38643
  /**
38601
38644
  * a flag indicating that melonJS is fully initialized
@@ -15,8 +15,8 @@ export default class UITextButton extends UIBaseElement {
15
15
  * @param {number} [settings.size=1] - The scale factor of the BitmapText
16
16
  * @param {string} [settings.text] - The text to display
17
17
  * @param {string} [settings.bindKey] - The key to bind the action to (default: none)
18
- * @param {string} [settings.backgroundColor="#00aa0080"] - The css value of a background color
19
- * @param {string} [settings.hoverColor="#00ff00ff"] - The css value of a color to be used if the pointer hovers over the button
18
+ * @param {string} [settings.hoverOffColor="#00aa0080"] - The css value of a color to be used if the pointer is not hovering over the button
19
+ * @param {string} [settings.hoverOnColor="#00ff00ff"] - The css value of a color to be used if the pointer hovers over the button
20
20
  * @param {string} [settings.borderStrokeColor="#000000"] - The css value of a color to be used to draw the border
21
21
  * @param {string} [settings.fillStyle] - The css value of a tint color to be used to tint the BitmapText
22
22
  * @param {string} [settings.textAlign="center"] - horizontal text alignment
@@ -33,6 +33,8 @@ export default class UITextButton extends UIBaseElement {
33
33
  * // if you omit the next two, size is calculated by the size of the text
34
34
  * borderWidth: 200,
35
35
  * borderHeight: 20,
36
+ * backgroundColor: '#00aa0080',
37
+ * hoverColor: '#00ff00ff'
36
38
  * });
37
39
  * }
38
40
  *
@@ -49,11 +51,16 @@ export default class UITextButton extends UIBaseElement {
49
51
  * @type {string}
50
52
  */
51
53
  bindKey: string;
54
+ /**
55
+ * The css value of a color to be used if the pointer is nothovering over the button
56
+ * @type {string}
57
+ */
58
+ hoverOffColor: string;
52
59
  /**
53
60
  * The css value of a color to be used if the pointer hovers over the button
54
61
  * @type {string}
55
62
  */
56
- hoverColor: string;
63
+ hoverOnColor: string;
57
64
  /**
58
65
  * The css value of a color to be used to draw the border
59
66
  * @type {string}
@@ -65,6 +65,18 @@ export default class Renderer {
65
65
  currentTint: Color;
66
66
  projectionMatrix: Matrix3d;
67
67
  uvOffset: number;
68
+ set height(arg: number);
69
+ /**
70
+ * return the height of the canvas which this renderer draws to
71
+ * @returns {number} height of the system Canvas
72
+ */
73
+ get height(): number;
74
+ set width(arg: number);
75
+ /**
76
+ * return the width of the canvas which this renderer draws to
77
+ * @returns {number} width of the system Canvas
78
+ */
79
+ get width(): number;
68
80
  /**
69
81
  * prepare the framebuffer for drawing a new frame
70
82
  */
@@ -100,16 +112,6 @@ export default class Renderer {
100
112
  * @returns {CanvasRenderingContext2D}
101
113
  */
102
114
  getContext2d(canvas: HTMLCanvasElement, transparent?: boolean | undefined): CanvasRenderingContext2D;
103
- /**
104
- * return the width of the system Canvas
105
- * @returns {number}
106
- */
107
- getWidth(): number;
108
- /**
109
- * return the height of the system Canvas
110
- * @returns {number} height of the system Canvas
111
- */
112
- getHeight(): number;
113
115
  /**
114
116
  * get the current fill & stroke style color.
115
117
  * @returns {Color} current global color
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melonjs",
3
- "version": "15.11.0",
3
+ "version": "15.13.0",
4
4
  "description": "melonJS Game Engine",
5
5
  "homepage": "http://www.melonjs.org/",
6
6
  "type": "module",
@@ -53,36 +53,36 @@
53
53
  ],
54
54
  "dependencies": {
55
55
  "@teppeis/multimaps": "^3.0.0",
56
- "core-js": "^3.32.2",
56
+ "core-js": "^3.33.0",
57
57
  "earcut": "2.2.4",
58
58
  "eventemitter3": "^5.0.1",
59
- "howler": "2.2.3"
59
+ "howler": "2.2.4"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@babel/eslint-parser": "^7.22.15",
63
63
  "@babel/plugin-syntax-import-assertions": "^7.22.5",
64
- "@fastify/static": "^6.11.0",
64
+ "@fastify/static": "^6.11.2",
65
65
  "@melonjs/webdoc-theme": "^1.1.1",
66
- "@rollup/plugin-commonjs": "^25.0.4",
67
- "@rollup/plugin-image": "^3.0.2",
68
- "@rollup/plugin-node-resolve": "^15.2.1",
69
- "@rollup/plugin-replace": "^5.0.2",
66
+ "@rollup/plugin-commonjs": "^25.0.5",
67
+ "@rollup/plugin-image": "^3.0.3",
68
+ "@rollup/plugin-node-resolve": "^15.2.2",
69
+ "@rollup/plugin-replace": "^5.0.3",
70
70
  "@webdoc/cli": "^2.2.0",
71
- "chromedriver": "^116.0.0",
71
+ "chromedriver": "^117.0.3",
72
72
  "cross-env": "^7.0.3",
73
73
  "del-cli": "^5.1.0",
74
- "eslint": "^8.49.0",
75
- "eslint-plugin-jsdoc": "^46.6.0",
74
+ "eslint": "^8.51.0",
75
+ "eslint-plugin-jsdoc": "^46.8.2",
76
76
  "expect": "^29.7.0",
77
77
  "expect-mocha-image-snapshot": "^3.0.15",
78
- "fastify": "^4.23.0",
78
+ "fastify": "^4.23.2",
79
79
  "mocha": "^10.2.0",
80
80
  "npm-self-link": "^1.1.7",
81
- "puppeteer": "^21.2.0",
82
- "rollup": "^3.29.1",
81
+ "puppeteer": "^21.3.8",
82
+ "rollup": "^3.29.4",
83
83
  "rollup-plugin-bundle-size": "^1.0.3",
84
84
  "rollup-plugin-string": "^3.0.0",
85
- "terser": "^5.19.4",
85
+ "terser": "^5.21.0",
86
86
  "typescript": "^5.2.2"
87
87
  },
88
88
  "scripts": {
@@ -21,6 +21,6 @@ export function consoleHeader(app) {
21
21
  );
22
22
 
23
23
  console.log( "resolution: " + "requested " + app.settings.width + "x" + app.settings.height +
24
- ", got " + app.renderer.getWidth() + "x" + app.renderer.getHeight()
24
+ ", got " + app.renderer.width + "x" + app.renderer.height
25
25
  );
26
26
  }
@@ -111,3 +111,34 @@ export class GUI_Object extends UISpriteElement {
111
111
  super(x, y, settings);
112
112
  }
113
113
  }
114
+
115
+
116
+ /**
117
+ * return the width of the system Canvas
118
+ * @public
119
+ * @name getWidth
120
+ * @class
121
+ * @memberof Renderer#
122
+ * @deprecated since 15.12.0
123
+ * @see width
124
+ */
125
+ Renderer.prototype.getWidth = function() {
126
+ warning("getWidth", "width", "15.12.0");
127
+ return this.width;
128
+ };
129
+
130
+ /**
131
+ * return the height of the system Canvas
132
+ * @public
133
+ * @name getHeight
134
+ * @class
135
+ * @memberof Renderer#
136
+ * @deprecated since 15.12.0
137
+ * @see height
138
+ */
139
+ Renderer.prototype.getHeight = function() {
140
+ warning("getHeight", "height", "15.12.0");
141
+ return this.height;
142
+ };
143
+
144
+
@@ -44,7 +44,7 @@ class ProgressBar extends Renderable {
44
44
  draw(renderer, viewport) {
45
45
  // draw the progress bar
46
46
  renderer.setColor("black");
47
- renderer.fillRect(this.pos.x, viewport.centerY, renderer.getWidth(), this.barHeight / 2);
47
+ renderer.fillRect(this.pos.x, viewport.centerY, renderer.width, this.barHeight / 2);
48
48
 
49
49
  renderer.setColor("#55aa00");
50
50
  renderer.fillRect(this.pos.x, viewport.centerY, this.progress, this.barHeight / 2);
@@ -80,8 +80,8 @@ class DefaultLoadingScreen extends Stage {
80
80
  // progress bar
81
81
  game.world.addChild(new ProgressBar(
82
82
  0,
83
- renderer.getHeight() / 2,
84
- renderer.getWidth(),
83
+ renderer.height / 2,
84
+ renderer.width,
85
85
  barHeight
86
86
  ), 1);
87
87
 
@@ -89,8 +89,8 @@ class DefaultLoadingScreen extends Stage {
89
89
  load({name: "melonjs_logo", type: "image", src: logo_url}, () => {
90
90
  // melonJS logo
91
91
  game.world.addChild(new Sprite(
92
- renderer.getWidth() / 2,
93
- renderer.getHeight() / 2, {
92
+ renderer.width / 2,
93
+ renderer.height / 2, {
94
94
  image : "melonjs_logo",
95
95
  framewidth : 256,
96
96
  frameheight : 256