melonjs 13.4.0 → 14.0.1

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 (99) hide show
  1. package/README.md +4 -6
  2. package/dist/melonjs.module.d.ts +13108 -11652
  3. package/dist/melonjs.module.js +642 -187
  4. package/package.json +21 -21
  5. package/src/application/application.js +3 -3
  6. package/src/audio/audio.js +27 -27
  7. package/src/camera/camera2d.js +1 -2
  8. package/src/entity/entity.js +1 -2
  9. package/src/geometries/ellipse.js +1 -2
  10. package/src/geometries/line.js +2 -3
  11. package/src/geometries/poly.js +2 -2
  12. package/src/geometries/rectangle.js +1 -3
  13. package/src/geometries/roundrect.js +1 -2
  14. package/src/index.js +8 -4
  15. package/src/input/gamepad.js +12 -12
  16. package/src/input/keyboard.js +8 -8
  17. package/src/input/pointer.js +1 -1
  18. package/src/input/pointerevent.js +9 -9
  19. package/src/lang/deprecated.js +21 -2
  20. package/src/level/level.js +2 -2
  21. package/src/level/tiled/TMXGroup.js +1 -1
  22. package/src/level/tiled/TMXLayer.js +1 -1
  23. package/src/level/tiled/TMXTile.js +2 -2
  24. package/src/level/tiled/TMXTileMap.js +4 -4
  25. package/src/level/tiled/TMXTileset.js +2 -2
  26. package/src/level/tiled/TMXTilesetGroup.js +1 -1
  27. package/src/level/tiled/TMXUtils.js +7 -7
  28. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  29. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  30. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
  31. package/src/level/tiled/renderer/TMXRenderer.js +1 -1
  32. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
  33. package/src/loader/loader.js +9 -9
  34. package/src/loader/loadingscreen.js +2 -2
  35. package/src/math/color.js +3 -3
  36. package/src/math/math.js +10 -10
  37. package/src/math/matrix2.js +1 -1
  38. package/src/math/matrix3.js +1 -1
  39. package/src/math/observable_vector2.js +1 -1
  40. package/src/math/observable_vector3.js +1 -1
  41. package/src/math/vector2.js +1 -1
  42. package/src/math/vector3.js +1 -1
  43. package/src/particles/emitter.js +2 -2
  44. package/src/particles/particle.js +1 -1
  45. package/src/physics/body.js +2 -2
  46. package/src/physics/bounds.js +10 -7
  47. package/src/physics/detector.js +56 -55
  48. package/src/physics/quadtree.js +3 -3
  49. package/src/physics/world.js +2 -2
  50. package/src/polyfill/performance.js +1 -1
  51. package/src/polyfill/requestAnimationFrame.js +1 -1
  52. package/src/renderable/collectable.js +1 -1
  53. package/src/renderable/colorlayer.js +1 -1
  54. package/src/renderable/container.js +10 -6
  55. package/src/renderable/dragndrop.js +2 -2
  56. package/src/renderable/imagelayer.js +1 -2
  57. package/src/renderable/light2d.js +1 -1
  58. package/src/renderable/nineslicesprite.js +1 -2
  59. package/src/renderable/renderable.js +1 -3
  60. package/src/renderable/sprite.js +3 -4
  61. package/src/renderable/trigger.js +3 -4
  62. package/src/renderable/ui/uibaseelement.js +204 -0
  63. package/src/renderable/{GUI.js → ui/uispriteelement.js} +8 -35
  64. package/src/renderable/ui/uitextbutton.js +121 -0
  65. package/src/state/stage.js +4 -5
  66. package/src/system/device.js +27 -27
  67. package/src/system/dom.js +1 -1
  68. package/src/system/event.js +4 -4
  69. package/src/system/pooling.js +2 -3
  70. package/src/system/save.js +2 -2
  71. package/src/system/timer.js +1 -1
  72. package/src/text/bitmaptext.js +2 -3
  73. package/src/text/bitmaptextdata.js +4 -7
  74. package/src/text/glyph.js +1 -2
  75. package/src/text/text.js +2 -3
  76. package/src/text/textstyle.js +1 -1
  77. package/src/tweens/tween.js +2 -3
  78. package/src/utils/agent.js +4 -4
  79. package/src/utils/array.js +3 -3
  80. package/src/utils/file.js +2 -2
  81. package/src/utils/function.js +3 -3
  82. package/src/utils/string.js +5 -5
  83. package/src/utils/utils.js +2 -2
  84. package/src/video/canvas/canvas_renderer.js +1 -2
  85. package/src/video/renderer.js +2 -3
  86. package/src/video/texture/atlas.js +2 -2
  87. package/src/video/texture/cache.js +1 -2
  88. package/src/video/video.js +12 -14
  89. package/src/video/webgl/buffer/vertex.js +1 -2
  90. package/src/video/webgl/glshader.js +1 -2
  91. package/src/video/webgl/utils/attributes.js +1 -1
  92. package/src/video/webgl/utils/precision.js +1 -1
  93. package/src/video/webgl/utils/program.js +2 -2
  94. package/src/video/webgl/utils/string.js +1 -1
  95. package/src/video/webgl/utils/uniforms.js +3 -3
  96. package/src/video/webgl/webgl_compositor.js +1 -2
  97. package/src/video/webgl/webgl_renderer.js +1 -2
  98. package/dist/melonjs.js +0 -37922
  99. package/dist/melonjs.min.js +0 -29
@@ -1,24 +1,20 @@
1
- import timer from "./../system/timer.js";
2
- import Sprite from "./sprite.js";
3
- import { registerPointerEvent, releasePointerEvent} from "./../input/input.js";
4
-
1
+ import timer from "./../../system/timer.js";
2
+ import Sprite from "./../sprite.js";
3
+ import { registerPointerEvent, releasePointerEvent} from "./../../input/input.js";
5
4
 
6
5
  /**
7
6
  * @classdesc
8
- * GUI Object<br>
9
- * A very basic object to manage GUI elements <br>
10
- * The object simply register on the "pointerdown" <br>
11
- * or "touchstart" event and call the onClick function"
7
+ * This is a basic sprite based button which you can use in your Game UI.
12
8
  * @augments Sprite
13
9
  */
14
- class GUI_Object extends Sprite {
10
+ class UISpriteElement extends Sprite {
15
11
  /**
16
12
  * @param {number} x the x coordinate of the GUI Object
17
13
  * @param {number} y the y coordinate of the GUI Object
18
14
  * @param {object} settings See {@link Sprite}
19
15
  * @example
20
16
  * // create a basic GUI Object
21
- * class myButton extends GUI_Object {
17
+ * class myButton extends UISpriteElement {
22
18
  * constructor(x, y) {
23
19
  * var settings = {}
24
20
  * settings.image = "button";
@@ -49,10 +45,8 @@ class GUI_Object extends Sprite {
49
45
 
50
46
  /**
51
47
  * object can be clicked or not
52
- * @public
53
48
  * @type {boolean}
54
49
  * @default true
55
- * @name GUI_Object#isClickable
56
50
  */
57
51
  this.isClickable = true;
58
52
 
@@ -60,25 +54,20 @@ class GUI_Object extends Sprite {
60
54
  * Tap and hold threshold timeout in ms
61
55
  * @type {number}
62
56
  * @default 250
63
- * @name GUI_Object#holdThreshold
64
57
  */
65
58
  this.holdThreshold = 250;
66
59
 
67
60
  /**
68
61
  * object can be tap and hold
69
- * @public
70
62
  * @type {boolean}
71
63
  * @default false
72
- * @name GUI_Object#isHoldable
73
64
  */
74
65
  this.isHoldable = false;
75
66
 
76
67
  /**
77
68
  * true if the pointer is over the object
78
- * @public
79
69
  * @type {boolean}
80
70
  * @default false
81
- * @name GUI_Object#hover
82
71
  */
83
72
  this.hover = false;
84
73
 
@@ -115,9 +104,6 @@ class GUI_Object extends Sprite {
115
104
 
116
105
  /**
117
106
  * function called when the object is pressed (to be extended)
118
- * @name onClick
119
- * @memberof GUI_Object
120
- * @public
121
107
  * @param {Pointer} event the event object
122
108
  * @returns {boolean} return false if we need to stop propagating the event
123
109
  */
@@ -137,9 +123,6 @@ class GUI_Object extends Sprite {
137
123
 
138
124
  /**
139
125
  * function called when the pointer is over the object
140
- * @name onOver
141
- * @memberof GUI_Object
142
- * @public
143
126
  * @param {Pointer} event the event object
144
127
  */
145
128
  onOver(event) { // eslint-disable-line no-unused-vars
@@ -159,9 +142,6 @@ class GUI_Object extends Sprite {
159
142
 
160
143
  /**
161
144
  * function called when the pointer is leaving the object area
162
- * @name onOut
163
- * @memberof GUI_Object
164
- * @public
165
145
  * @param {Pointer} event the event object
166
146
  */
167
147
  onOut(event) { // eslint-disable-line no-unused-vars
@@ -183,9 +163,6 @@ class GUI_Object extends Sprite {
183
163
 
184
164
  /**
185
165
  * function called when the object is pressed and released (to be extended)
186
- * @name onRelease
187
- * @memberof GUI_Object
188
- * @public
189
166
  * @returns {boolean} return false if we need to stop propagating the event
190
167
  */
191
168
  onRelease() {
@@ -207,9 +184,6 @@ class GUI_Object extends Sprite {
207
184
  /**
208
185
  * function called when the object is pressed and held<br>
209
186
  * to be extended <br>
210
- * @name onHold
211
- * @memberof GUI_Object
212
- * @public
213
187
  */
214
188
  onHold() {}
215
189
 
@@ -239,6 +213,5 @@ class GUI_Object extends Sprite {
239
213
  releasePointerEvent("pointerleave", this);
240
214
  timer.clearTimeout(this.holdTimeout);
241
215
  }
242
- };
243
-
244
- export default GUI_Object;
216
+ }
217
+ export default UISpriteElement;
@@ -0,0 +1,121 @@
1
+ import Vector2d from "../../math/vector2.js";
2
+ import BitmapText from "../../text/bitmaptext.js";
3
+ import RoundRect from "../../geometries/roundrect.js";
4
+ import UIBaseElement from "./uibaseelement.js";
5
+
6
+
7
+ /**
8
+ * @classdesc
9
+ * This is a basic base text button which you can use in your Game UI.
10
+ * @augments UIBaseElement
11
+ */
12
+ class UITextButton extends UIBaseElement {
13
+ /**
14
+ * A Text Button with an outlined background border, filled with background color.
15
+ * It uses a RoundRect as background and changes the background color on hovering over.
16
+ * The background will be drawn with 0.5 opacity, so that the background of the button is
17
+ * slightly shining through.
18
+ * @param {number} x x pos of the button
19
+ * @param {number} y y pos of the button
20
+ * @param {string} [settings.font] The name of the BitmapText font to use
21
+ * @param {number} [settings.size] The scale factor of the font (default: 1)
22
+ * @param {string} [settings.text] The text to display (default: 'click me')
23
+ * @param {string} [settings.bindKey] The key to bind the action to (default: none)
24
+ * @param {string} [settings.backgroundColor] The css value of a background color
25
+ * @param {string} [settings.hoverColor] The css value of a color to be used if the pointer hovers over the button
26
+ * @param {string} [settings.borderStrokeColor] The css value of a color to be used to draw the border
27
+ * @param {boolean} [settings.offScreenCanvas] Weather to use an offScreen canvas or not
28
+ * @param {string} [settings.fillStyle] The css value of a tint color to be used to tint the text
29
+ * @param {number} [settings.borderWidth] Width of the button
30
+ * @param {number} [settings.borderHeight] Height of the button
31
+ * @example
32
+ * // Create a new Button
33
+ * class PlayButton extends BaseTextButton {
34
+ * constructor(x,y) {
35
+ * super(x,y, {
36
+ * font: 'my-font',
37
+ * text: 'Play',
38
+ * // if you omit the next two, size is calculated by the size of the text
39
+ * borderWidth: 200,
40
+ * borderHeight: 20,
41
+ * });
42
+ * }
43
+ *
44
+ * onClick(){
45
+ * state.change(state.PLAY);
46
+ * }
47
+ * }
48
+ *
49
+ * game.world.addChild(new PlayButton(15,200));
50
+ */
51
+ constructor(x, y, settings) {
52
+ super(x, y);
53
+ settings.font = settings.font || "24Outline";
54
+ settings.size = settings.size || 1;
55
+ settings.text = settings.text || "<Click Me>";
56
+ settings.bindKey = settings.bindKey || -1;
57
+ settings.backgroundColor = settings.backgroundColor || "#00aa00";
58
+ settings.hoverColor = settings.hoverColor || "#00ff00";
59
+ settings.borderStrokeColor = settings.borderStrokeColor || "#000000";
60
+ settings.offScreenCanvas = settings.offScreenCanvas || false;
61
+ settings.fillStyle = settings.fillStyle || "#ffffff";
62
+ settings.lineWidth = settings.lineWidth || 1;
63
+ settings.anchorPoint = settings.anchorPoint || new Vector2d(0, 0);
64
+
65
+ let font = new BitmapText(x, y, settings);
66
+ let dimensions = font.measureText();
67
+ settings.borderWidth = settings.borderWidth || dimensions.width + 16;
68
+ settings.borderHeight = settings.borderHeight || dimensions.height + 16;
69
+
70
+ let border = new RoundRect(
71
+ x,
72
+ y,
73
+ settings.borderWidth,
74
+ settings.borderHeight
75
+ );
76
+ super.setShape(
77
+ x,
78
+ y,
79
+ border.getBounds().width,
80
+ border.getBounds().height
81
+ );
82
+
83
+ // build up
84
+ this.font = font;
85
+ this.dimensions = dimensions;
86
+ this.border = border;
87
+ this.settings = settings;
88
+
89
+ // adjust text position
90
+ this.font.pos.set(
91
+ Math.round((border.width - dimensions.width) / 2) + this.font.pos.x,
92
+ Math.round((border.height - dimensions.height) / 2) +
93
+ this.font.pos.y
94
+ );
95
+ }
96
+
97
+ draw(renderer) {
98
+ renderer.setGlobalAlpha(0.5);
99
+ if (!this.hover) {
100
+ renderer.setColor(this.settings.backgroundColor);
101
+ } else {
102
+ renderer.setColor(this.settings.hoverColor);
103
+ }
104
+
105
+ renderer.fill(this.border);
106
+ renderer.setGlobalAlpha(1);
107
+ renderer.setColor(this.settings.borderStrokeColor);
108
+ renderer.stroke(this.border);
109
+
110
+ // fix: supporting tint
111
+ renderer.setTint(this.font.tint, this.font.getOpacity());
112
+ this.font.draw(
113
+ renderer,
114
+ this.settings.text,
115
+ this.font.pos.x,
116
+ this.font.pos.y
117
+ );
118
+ }
119
+ }
120
+ export default UITextButton;
121
+
@@ -125,17 +125,17 @@ class Stage {
125
125
 
126
126
  // update the camera/viewport
127
127
  // iterate through all cameras
128
- this.cameras.forEach(function(camera) {
128
+ this.cameras.forEach((camera) => {
129
129
  if (camera.update(dt) === true) {
130
130
  isDirty = true;
131
- };
131
+ }
132
132
  });
133
133
 
134
134
  // update all lights
135
135
  this.lights.forEach((light) => {
136
136
  if (light.update(dt) === true) {
137
137
  isDirty = true;
138
- };
138
+ }
139
139
  });
140
140
 
141
141
  return isDirty;
@@ -224,6 +224,5 @@ class Stage {
224
224
  this.settings.onDestroyEvent.apply(this, arguments);
225
225
  }
226
226
  }
227
- };
228
-
227
+ }
229
228
  export default Stage;
@@ -22,7 +22,7 @@ function disableSwipeFn(e) {
22
22
  globalThis.scroll(0, 0);
23
23
  }
24
24
  return false;
25
- };
25
+ }
26
26
 
27
27
  function hasLocalStorage() {
28
28
  try {
@@ -51,7 +51,7 @@ function onDeviceMotion(e) {
51
51
  accelerationX = e.accelerationIncludingGravity.x;
52
52
  accelerationY = e.accelerationIncludingGravity.y;
53
53
  accelerationZ = e.accelerationIncludingGravity.z;
54
- };
54
+ }
55
55
 
56
56
  /**
57
57
  * used by [un]watchDeviceOrientation()
@@ -60,7 +60,7 @@ export function onDeviceRotate(e) {
60
60
  gamma = e.gamma;
61
61
  beta = e.beta;
62
62
  alpha = e.alpha;
63
- };
63
+ }
64
64
 
65
65
  /**
66
66
  * the device platform type
@@ -431,7 +431,7 @@ export let stopOnBlur = false;
431
431
  */
432
432
  export function onReady(fn) {
433
433
  DOMContentLoaded(fn);
434
- };
434
+ }
435
435
 
436
436
  /**
437
437
  * enable/disable swipe on WebView.
@@ -451,7 +451,7 @@ export function enableSwipe(enable) {
451
451
  globalThis.document.addEventListener(moveEvent, disableSwipeFn, { passive: false });
452
452
  swipeEnabled = false;
453
453
  }
454
- };
454
+ }
455
455
 
456
456
  /**
457
457
  * Returns true if the browser/device is in full screen mode.
@@ -466,7 +466,7 @@ export function isFullscreen() {
466
466
  } else {
467
467
  return false;
468
468
  }
469
- };
469
+ }
470
470
 
471
471
  /**
472
472
  * Triggers a fullscreen request. Requires fullscreen support from the browser/device.
@@ -492,7 +492,7 @@ export function requestFullscreen(element) {
492
492
  element.requestFullscreen = prefixed("requestFullscreen", element) || element.mozRequestFullScreen;
493
493
  element.requestFullscreen();
494
494
  }
495
- };
495
+ }
496
496
 
497
497
  /**
498
498
  * Exit fullscreen mode. Requires fullscreen support from the browser/device.
@@ -504,7 +504,7 @@ export function exitFullscreen() {
504
504
  if (hasFullscreenSupport && isFullscreen()) {
505
505
  document.exitFullscreen();
506
506
  }
507
- };
507
+ }
508
508
 
509
509
  /**
510
510
  * Return a string representing the orientation of the device screen.
@@ -540,7 +540,7 @@ export function getScreenOrientation() {
540
540
 
541
541
  // fallback to window size check
542
542
  return (globalThis.outerWidth > globalThis.outerHeight) ? LANDSCAPE : PORTRAIT;
543
- };
543
+ }
544
544
 
545
545
  /**
546
546
  * locks the device screen into the specified orientation.<br>
@@ -561,7 +561,7 @@ export function lockOrientation(orientation) {
561
561
  }
562
562
  }
563
563
  return false;
564
- };
564
+ }
565
565
 
566
566
  /**
567
567
  * unlocks the device screen into the specified orientation.<br>
@@ -581,7 +581,7 @@ export function unlockOrientation() {
581
581
  }
582
582
  }
583
583
  return false;
584
- };
584
+ }
585
585
 
586
586
  /**
587
587
  * return true if the device screen orientation is in Portrait mode
@@ -592,7 +592,7 @@ export function unlockOrientation() {
592
592
  */
593
593
  export function isPortrait() {
594
594
  return getScreenOrientation().includes("portrait");
595
- };
595
+ }
596
596
 
597
597
  /**
598
598
  * return true if the device screen orientation is in Portrait mode
@@ -603,7 +603,7 @@ export function isPortrait() {
603
603
  */
604
604
  export function isLandscape() {
605
605
  return getScreenOrientation().includes("landscape");
606
- };
606
+ }
607
607
 
608
608
  /**
609
609
  * return the device storage
@@ -622,7 +622,7 @@ export function getStorage(type = "local") {
622
622
  default :
623
623
  throw new Error("storage type " + type + " not supported");
624
624
  }
625
- };
625
+ }
626
626
 
627
627
  /**
628
628
  * return the parent DOM element for the given parent name or HTMLElement object
@@ -640,7 +640,7 @@ export function getParentElement(element) {
640
640
  }
641
641
 
642
642
  return target;
643
- };
643
+ }
644
644
 
645
645
  /**
646
646
  * return the DOM element for the given element name or HTMLElement object
@@ -668,7 +668,7 @@ export function getElement(element) {
668
668
  }
669
669
 
670
670
  return target;
671
- };
671
+ }
672
672
 
673
673
  /**
674
674
  * returns the size of the given HTMLElement and its position relative to the viewport
@@ -687,8 +687,8 @@ export function getElementBounds(element) {
687
687
  domRect.width = domRect.right = globalThis.innerWidth;
688
688
  domRect.height = domRect.bottom = globalThis.innerHeight;
689
689
  return domRect;
690
- };
691
- };
690
+ }
691
+ }
692
692
 
693
693
  /**
694
694
  * returns the size of the given HTMLElement Parent and its position relative to the viewport
@@ -702,7 +702,7 @@ export function getElementBounds(element) {
702
702
  */
703
703
  export function getParentBounds(element) {
704
704
  return getElementBounds(getParentElement(element));
705
- };
705
+ }
706
706
 
707
707
  /**
708
708
  * returns true if the device supports WebGL
@@ -727,7 +727,7 @@ export function isWebGLSupported(options) {
727
727
  }
728
728
 
729
729
  return _supported;
730
- };
730
+ }
731
731
 
732
732
  /**
733
733
  * return the highest precision format supported by this device for GL Shaders
@@ -747,7 +747,7 @@ export function getMaxShaderPrecision(gl) {
747
747
  return "mediump";
748
748
  }
749
749
  return "lowp";
750
- };
750
+ }
751
751
 
752
752
  /**
753
753
  * Makes a request to bring this device window to the front.
@@ -763,7 +763,7 @@ export function focus() {
763
763
  if (typeof (globalThis.focus) === "function") {
764
764
  globalThis.focus();
765
765
  }
766
- };
766
+ }
767
767
 
768
768
  /**
769
769
  * Enable monitor of the device accelerator to detect the amount of physical force of acceleration the device is receiving.
@@ -806,7 +806,7 @@ export function watchAccelerometer() {
806
806
  }
807
807
  }
808
808
  return accelInitialized;
809
- };
809
+ }
810
810
 
811
811
  /**
812
812
  * unwatch Accelerometor event
@@ -820,7 +820,7 @@ export function unwatchAccelerometer() {
820
820
  globalThis.removeEventListener("devicemotion", onDeviceMotion, false);
821
821
  accelInitialized = false;
822
822
  }
823
- };
823
+ }
824
824
 
825
825
  /**
826
826
  * Enable monitor of the device orientation to detect the current orientation of the device as compared to the Earth coordinate frame.
@@ -859,7 +859,7 @@ export function watchDeviceOrientation() {
859
859
  }
860
860
  }
861
861
  return deviceOrientationInitialized;
862
- };
862
+ }
863
863
 
864
864
  /**
865
865
  * unwatch Device orientation event
@@ -872,7 +872,7 @@ export function unwatchDeviceOrientation() {
872
872
  globalThis.removeEventListener("deviceorientation", onDeviceRotate, false);
873
873
  deviceOrientationInitialized = false;
874
874
  }
875
- };
875
+ }
876
876
 
877
877
  /**
878
878
  * the vibrate method pulses the vibration hardware on the device, <br>
@@ -897,4 +897,4 @@ export function vibrate(pattern) {
897
897
  if (typeof globalThis.navigator !== "undefined" && typeof globalThis.navigator.vibrate === "function") {
898
898
  globalThis.navigator.vibrate(pattern);
899
899
  }
900
- };
900
+ }
package/src/system/dom.js CHANGED
@@ -36,7 +36,7 @@ function _domReady() {
36
36
  // Remember that the DOM is ready
37
37
  isDOMReady = true;
38
38
  }
39
- };
39
+ }
40
40
 
41
41
  // https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event
42
42
  export function DOMContentLoaded(fn) {
@@ -481,7 +481,7 @@ export const ONCONTEXT_RESTORED = "renderer.contextrestored";
481
481
  */
482
482
  export function emit(eventName, ...args) {
483
483
  return eventEmitter.emit(eventName, ...args);
484
- };
484
+ }
485
485
 
486
486
  /**
487
487
  * Add a listener for a given event.
@@ -496,7 +496,7 @@ export function emit(eventName, ...args) {
496
496
  */
497
497
  export function on(eventName, listener, context) {
498
498
  return eventEmitter.on(eventName, listener, context);
499
- };
499
+ }
500
500
 
501
501
  /**
502
502
  * Add a one-time listener for a given event.
@@ -511,7 +511,7 @@ export function on(eventName, listener, context) {
511
511
  */
512
512
  export function once(eventName, listener, context) {
513
513
  return eventEmitter.once(eventName, listener, context);
514
- };
514
+ }
515
515
 
516
516
  /**
517
517
  * remove the given listener for a given event.
@@ -525,4 +525,4 @@ export function once(eventName, listener, context) {
525
525
  */
526
526
  export function off(eventName, listener) {
527
527
  return eventEmitter.off(eventName, listener);
528
- };
528
+ }
@@ -149,7 +149,7 @@ class ObjectPool {
149
149
  */
150
150
  exists(name) {
151
151
  return name in this.objectClass;
152
- };
152
+ }
153
153
 
154
154
  /**
155
155
  * Check if an object is poolable
@@ -178,8 +178,7 @@ class ObjectPool {
178
178
  getInstanceCount() {
179
179
  return this.instance_counter;
180
180
  }
181
- };
182
-
181
+ }
183
182
 
184
183
  var pool = new ObjectPool();
185
184
 
@@ -61,7 +61,7 @@ event.on(event.BOOT, () => {
61
61
 
62
62
  if (typeof me_save_content === "string" && me_save_content.length > 0) {
63
63
  var keys = JSON.parse(me_save_content) || [];
64
- keys.forEach(function (key) {
64
+ keys.forEach((key) => {
65
65
  data[key] = JSON.parse(globalThis.localStorage.getItem("me.save." + key));
66
66
  });
67
67
  }
@@ -84,7 +84,7 @@ var save = {
84
84
  add(props) {
85
85
  var obj = save;
86
86
 
87
- Object.keys(props).forEach(function (key) {
87
+ Object.keys(props).forEach((key) => {
88
88
  if (isReserved(key)) {
89
89
  return;
90
90
  }
@@ -256,7 +256,7 @@ class Timer {
256
256
  }
257
257
  }
258
258
  }
259
- };
259
+ }
260
260
 
261
261
  const timer = new Timer();
262
262
 
@@ -109,7 +109,7 @@ class BitmapText extends Renderable {
109
109
  // if starting/includes "info face" the whole data string was passed as parameter
110
110
  (settings.fontData.includes("info face")) ? settings.fontData : loader.getBinary(settings.fontData)
111
111
  );
112
- };
112
+ }
113
113
 
114
114
  // if floating was specified through settings
115
115
  if (typeof settings.floating !== "undefined") {
@@ -357,6 +357,5 @@ class BitmapText extends Renderable {
357
357
  super.destroy();
358
358
  }
359
359
 
360
- };
361
-
360
+ }
362
361
  export default BitmapText;
@@ -14,7 +14,7 @@ function getValueFromPair(string, pattern) {
14
14
  }
15
15
 
16
16
  return value[0].split("=")[1];
17
- };
17
+ }
18
18
 
19
19
  /**
20
20
  * Gets the first glyph in the map that is not a space character
@@ -32,7 +32,7 @@ function getFirstGlyph(glyphs) {
32
32
  }
33
33
  }
34
34
  return null;
35
- };
35
+ }
36
36
 
37
37
  /**
38
38
  * Creates a glyph to use for the space character
@@ -50,9 +50,7 @@ function createSpaceGlyph(glyphs) {
50
50
  glyph.xadvance = getFirstGlyph(glyphs).xadvance;
51
51
  glyphs[spaceCharCode] = glyph;
52
52
  }
53
- };
54
-
55
-
53
+ }
56
54
 
57
55
  /**
58
56
  * Class for storing relevant data from the font file.
@@ -188,6 +186,5 @@ class BitmapTextData {
188
186
  }
189
187
  this.capHeight -= padY;
190
188
  }
191
- };
192
-
189
+ }
193
190
  export default BitmapTextData;
package/src/text/glyph.js CHANGED
@@ -54,6 +54,5 @@ class Glyph {
54
54
  }
55
55
  page[ch & PAGE_SIZE - 1] = value;
56
56
  }
57
- };
58
-
57
+ }
59
58
  export default Glyph;
package/src/text/text.js CHANGED
@@ -235,7 +235,7 @@ class Text extends Renderable {
235
235
  */
236
236
  setFont(font, size = 10) {
237
237
  // font name and type
238
- var font_names = font.split(",").map(function (value) {
238
+ var font_names = font.split(",").map((value) => {
239
239
  value = value.trim();
240
240
  return (
241
241
  !/(^".*"$)|(^'.*'$)/.test(value)
@@ -440,6 +440,5 @@ class Text extends Renderable {
440
440
  this._text.length = 0;
441
441
  super.destroy();
442
442
  }
443
- };
444
-
443
+ }
445
444
  export default Text;
@@ -11,4 +11,4 @@ export default function setContextStyle(context, style, stroke = false) {
11
11
  }
12
12
  context.textAlign = style.textAlign;
13
13
  context.textBaseline = style.textBaseline;
14
- };
14
+ }
@@ -342,7 +342,7 @@ class Tween {
342
342
  onComplete( onCompleteCallback ) {
343
343
  this._onCompleteCallback = onCompleteCallback;
344
344
  return this;
345
- };
345
+ }
346
346
 
347
347
  /** @ignore */
348
348
  update( dt ) {
@@ -467,6 +467,5 @@ class Tween {
467
467
  // export easing function as static class property
468
468
  static get Easing() { return Easing; }
469
469
  static get Interpolation() { return Interpolation; }
470
- };
471
-
470
+ }
472
471
  export default Tween;