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
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "melonjs",
3
- "version": "13.4.0",
3
+ "version": "14.0.1",
4
4
  "description": "melonJS Game Engine",
5
5
  "homepage": "http://www.melonjs.org/",
6
+ "type": "module",
6
7
  "keywords": [
7
8
  "2D",
8
9
  "HTML5",
@@ -37,11 +38,9 @@
37
38
  "node": ">= 16"
38
39
  },
39
40
  "main": "dist/melonjs.module.js",
40
- "type": "module",
41
41
  "module": "dist/melonjs.module.js",
42
+ "types": "dist/melonjs.module.d.ts",
42
43
  "files": [
43
- "dist/melonjs.js",
44
- "dist/melonjs.min.js",
45
44
  "dist/melonjs.module.js",
46
45
  "dist/melonjs.module.d.ts",
47
46
  "src/",
@@ -52,41 +51,42 @@
52
51
  ],
53
52
  "dependencies": {
54
53
  "@teppeis/multimaps": "^2.0.0",
55
- "core-js": "^3.25.3",
54
+ "core-js": "^3.25.5",
56
55
  "earcut": "2.2.4",
57
56
  "eventemitter3": "^4.0.7",
58
57
  "howler": "2.2.3"
59
58
  },
60
59
  "devDependencies": {
60
+ "@fastify/static": "^6.5.0",
61
61
  "@melonjs/webdoc-theme": "^1.1.1",
62
- "@rollup/plugin-buble": "^0.21.3",
63
- "@rollup/plugin-commonjs": "^22.0.2",
62
+ "@rollup/plugin-commonjs": "^23.0.0",
64
63
  "@rollup/plugin-image": "^2.1.1",
65
64
  "@rollup/plugin-node-resolve": "^14.1.0",
66
65
  "@rollup/plugin-replace": "^4.0.0",
67
66
  "@types/offscreencanvas": "^2019.7.0",
68
67
  "@webdoc/cli": "^2.1.2",
68
+ "chromedriver": "^106.0.1",
69
+ "cross-env": "^7.0.3",
69
70
  "del-cli": "^5.0.0",
70
- "eslint": "^8.24.0",
71
- "jasmine-core": "^4.4.0",
72
- "karma": "^6.4.1",
73
- "karma-chrome-launcher": "^3.1.1",
74
- "karma-coverage": "^2.2.0",
75
- "karma-html-detailed-reporter": "^2.1.0",
76
- "karma-jasmine": "^5.1.0",
77
- "karma-nyan-reporter": "0.2.5",
71
+ "eslint": "^8.25.0",
72
+ "expect": "^29.2.0",
73
+ "expect-mocha-image-snapshot": "^2.0.14",
74
+ "fastify": "^4.9.1",
75
+ "mocha": "^10.1.0",
76
+ "npm-self-link": "^1.1.7",
77
+ "puppeteer": "^19.0.0",
78
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.15.0",
82
- "typescript": "^4.8.3"
81
+ "terser": "^5.15.1",
82
+ "typescript": "^4.8.4"
83
83
  },
84
84
  "scripts": {
85
85
  "build": "npm run lint && rollup -c --silent",
86
- "dist": " npm run build && npm run minify && mkdirp dist && cp -f build/*.js dist/ && npm run types",
87
- "minify": "terser build/melonjs.js --compress --mangle --comments '/(?:^!|@(?:license|preserve|cc_on))/' --output build/melonjs.min.js",
86
+ "dist": " npm run build && mkdirp dist && cp -f build/*.js dist/ && npm run types",
88
87
  "lint": "eslint src rollup.config.js",
89
- "test": "npm run test-node && karma start tests/karma.conf.cjs",
88
+ "pretest": "cp -f ./build/melonjs.module.js ./tests/browser/public/lib",
89
+ "test": "npm run test-node && mocha ./tests/browser/spec/*.js --reporter spec --bail --timeout 10000",
90
90
  "test-node": "node build/melonjs.module.js",
91
91
  "doc-prod": "mkdirp docs && webdoc --quiet --site-root melonJS/docs -R README.md",
92
92
  "doc-local": "mkdirp docs && webdoc --quiet --site-root /docs -R README.md",
@@ -94,6 +94,6 @@
94
94
  "serve": "python3 -m http.server",
95
95
  "prepublishOnly": "npm run dist && npm run test",
96
96
  "clean": "del-cli --force build/*.js dist/*.js dist/*.d.ts docs src/**/*.d.ts",
97
- "types": "tsc dist/melonjs.module.js --declaration --allowJs --emitDeclarationOnly"
97
+ "types": "tsc src/index.js --declaration --allowJs --emitDeclarationOnly --outfile dist/melonjs.module.d.ts"
98
98
  }
99
99
  }
@@ -17,7 +17,7 @@ class Application {
17
17
  * @public
18
18
  * @type {Camera2d}
19
19
  */
20
- this.viewport = null;
20
+ this.viewport = undefined;
21
21
 
22
22
  /**
23
23
  * a reference to the game world, <br>
@@ -25,7 +25,7 @@ class Application {
25
25
  * @public
26
26
  * @type {World}
27
27
  */
28
- this.world = null;
28
+ this.world = undefined;
29
29
 
30
30
  /**
31
31
  * when true, all objects will be added under the root world container.<br>
@@ -117,7 +117,7 @@ class Application {
117
117
  * // call myFunction () everytime a level is loaded
118
118
  * me.game.onLevelLoaded = this.myFunction.bind(this);
119
119
  */
120
- onLevelLoaded() {};
120
+ onLevelLoaded() {}
121
121
 
122
122
  /**
123
123
  * Update the renderer framerate using the system config variables.
@@ -98,7 +98,7 @@ export let stopOnAudioError = true;
98
98
  audioExts = format.split(",");
99
99
 
100
100
  return !Howler.noAudio;
101
- };
101
+ }
102
102
 
103
103
  /**
104
104
  * check if the given audio format is supported
@@ -108,7 +108,7 @@ export let stopOnAudioError = true;
108
108
  */
109
109
  export function hasFormat(codec) {
110
110
  return hasAudio() && Howler.codecs(codec);
111
- };
111
+ }
112
112
 
113
113
  /**
114
114
  * check if audio (HTML5 or WebAudio) is supported
@@ -117,7 +117,7 @@ export function hasFormat(codec) {
117
117
  */
118
118
  export function hasAudio() {
119
119
  return !Howler.noAudio;
120
- };
120
+ }
121
121
 
122
122
  /**
123
123
  * enable audio output <br>
@@ -127,7 +127,7 @@ export function hasAudio() {
127
127
  */
128
128
  export function enable() {
129
129
  unmuteAll();
130
- };
130
+ }
131
131
 
132
132
  /**
133
133
  * disable audio output
@@ -135,7 +135,7 @@ export function enable() {
135
135
  */
136
136
  export function disable() {
137
137
  muteAll();
138
- };
138
+ }
139
139
 
140
140
  /**
141
141
  * Load an audio file.<br>
@@ -181,7 +181,7 @@ export function load(sound, html5, onload_cb, onerror_cb) {
181
181
  });
182
182
 
183
183
  return 1;
184
- };
184
+ }
185
185
 
186
186
  /**
187
187
  * play the specified sound
@@ -222,7 +222,7 @@ export function play(sound_name, loop = false, onend, volume) {
222
222
  } else {
223
223
  throw new Error("audio clip " + sound_name + " does not exist");
224
224
  }
225
- };
225
+ }
226
226
 
227
227
  /**
228
228
  * Fade a currently playing sound between two volumee.
@@ -240,7 +240,7 @@ export function fade(sound_name, from, to, duration, id) {
240
240
  } else {
241
241
  throw new Error("audio clip " + sound_name + " does not exist");
242
242
  }
243
- };
243
+ }
244
244
 
245
245
  /**
246
246
  * get/set the position of playback for a sound.
@@ -262,7 +262,7 @@ export function seek(sound_name, ...args) {
262
262
  } else {
263
263
  throw new Error("audio clip " + sound_name + " does not exist");
264
264
  }
265
- };
265
+ }
266
266
 
267
267
  /**
268
268
  * get or set the rate of playback for a sound.
@@ -284,7 +284,7 @@ export function rate(sound_name, ...args) {
284
284
  } else {
285
285
  throw new Error("audio clip " + sound_name + " does not exist");
286
286
  }
287
- };
287
+ }
288
288
 
289
289
  /**
290
290
  * stop the specified sound on all channels
@@ -307,7 +307,7 @@ export function stop(sound_name, id) {
307
307
  } else {
308
308
  Howler.stop();
309
309
  }
310
- };
310
+ }
311
311
 
312
312
  /**
313
313
  * pause the specified sound on all channels<br>
@@ -325,7 +325,7 @@ export function pause(sound_name, id) {
325
325
  } else {
326
326
  throw new Error("audio clip " + sound_name + " does not exist");
327
327
  }
328
- };
328
+ }
329
329
 
330
330
  /**
331
331
  * resume the specified sound on all channels<br>
@@ -349,7 +349,7 @@ export function resume(sound_name, id) {
349
349
  } else {
350
350
  throw new Error("audio clip " + sound_name + " does not exist");
351
351
  }
352
- };
352
+ }
353
353
 
354
354
  /**
355
355
  * play the specified audio track<br>
@@ -370,7 +370,7 @@ export function playTrack(sound_name, volume) {
370
370
  null,
371
371
  volume
372
372
  );
373
- };
373
+ }
374
374
 
375
375
  /**
376
376
  * stop the current audio track
@@ -387,7 +387,7 @@ export function stopTrack() {
387
387
  audioTracks[current_track_id].stop();
388
388
  current_track_id = null;
389
389
  }
390
- };
390
+ }
391
391
 
392
392
  /**
393
393
  * pause the current audio track
@@ -399,7 +399,7 @@ export function pauseTrack() {
399
399
  if (current_track_id !== null) {
400
400
  audioTracks[current_track_id].pause();
401
401
  }
402
- };
402
+ }
403
403
 
404
404
  /**
405
405
  * resume the previously paused audio track
@@ -416,7 +416,7 @@ export function resumeTrack() {
416
416
  if (current_track_id !== null) {
417
417
  audioTracks[current_track_id].play();
418
418
  }
419
- };
419
+ }
420
420
 
421
421
  /**
422
422
  * returns the current track Id
@@ -425,7 +425,7 @@ export function resumeTrack() {
425
425
  */
426
426
  export function getCurrentTrack() {
427
427
  return current_track_id;
428
- };
428
+ }
429
429
 
430
430
  /**
431
431
  * set the default global volume
@@ -434,7 +434,7 @@ export function getCurrentTrack() {
434
434
  */
435
435
  export function setVolume(volume) {
436
436
  Howler.volume(volume);
437
- };
437
+ }
438
438
 
439
439
  /**
440
440
  * get the default global volume
@@ -443,7 +443,7 @@ export function setVolume(volume) {
443
443
  */
444
444
  export function getVolume() {
445
445
  return Howler.volume();
446
- };
446
+ }
447
447
 
448
448
  /**
449
449
  * mute or unmute the specified sound, but does not pause the playback.
@@ -464,7 +464,7 @@ export function mute(sound_name, id, mute) {
464
464
  } else {
465
465
  throw new Error("audio clip " + sound_name + " does not exist");
466
466
  }
467
- };
467
+ }
468
468
 
469
469
  /**
470
470
  * unmute the specified sound
@@ -474,7 +474,7 @@ export function mute(sound_name, id, mute) {
474
474
  */
475
475
  export function unmute(sound_name, id) {
476
476
  mute(sound_name, id, false);
477
- };
477
+ }
478
478
 
479
479
  /**
480
480
  * mute all audio
@@ -482,7 +482,7 @@ export function unmute(sound_name, id) {
482
482
  */
483
483
  export function muteAll() {
484
484
  Howler.mute(true);
485
- };
485
+ }
486
486
 
487
487
  /**
488
488
  * unmute all audio
@@ -490,7 +490,7 @@ export function muteAll() {
490
490
  */
491
491
  export function unmuteAll() {
492
492
  Howler.mute(false);
493
- };
493
+ }
494
494
 
495
495
  /**
496
496
  * Returns true if audio is muted globally.
@@ -499,7 +499,7 @@ export function unmuteAll() {
499
499
  */
500
500
  export function muted() {
501
501
  return Howler._muted;
502
- };
502
+ }
503
503
 
504
504
  /**
505
505
  * unload specified audio track to free memory
@@ -518,7 +518,7 @@ export function unload(sound_name) {
518
518
  audioTracks[sound_name].unload();
519
519
  delete audioTracks[sound_name];
520
520
  return true;
521
- };
521
+ }
522
522
 
523
523
  /**
524
524
  * unload all audio to free memory
@@ -532,4 +532,4 @@ export function unloadAll() {
532
532
  unload(sound_name);
533
533
  }
534
534
  }
535
- };
535
+ }
@@ -723,6 +723,5 @@ class Camera2d extends Renderable {
723
723
  container.currentTransform.translate(translateX, translateY);
724
724
  }
725
725
 
726
- };
727
-
726
+ }
728
727
  export default Camera2d;
@@ -236,6 +236,5 @@ class Entity extends Renderable {
236
236
  }
237
237
  }
238
238
 
239
- };
240
-
239
+ }
241
240
  export default Entity;
@@ -262,6 +262,5 @@ class Ellipse {
262
262
  this.radiusV.y * 2
263
263
  );
264
264
  }
265
- };
266
-
265
+ }
267
266
  export default Ellipse;
@@ -97,12 +97,11 @@ class Line extends Polygon {
97
97
  */
98
98
  clone() {
99
99
  var copy = [];
100
- this.points.forEach(function (point) {
100
+ this.points.forEach((point) => {
101
101
  copy.push(point.clone());
102
102
  });
103
103
  return new Line(this.pos.x, this.pos.y, copy);
104
104
  }
105
105
 
106
- };
107
-
106
+ }
108
107
  export default Line;
@@ -480,11 +480,11 @@ class Polygon {
480
480
  */
481
481
  clone() {
482
482
  var copy = [];
483
- this.points.forEach(function (point) {
483
+ this.points.forEach((point) => {
484
484
  copy.push(point.clone());
485
485
  });
486
486
  return new Polygon(this.pos.x, this.pos.y, copy);
487
487
  }
488
- };
488
+ }
489
489
 
490
490
  export default Polygon;
@@ -362,7 +362,5 @@ class Rect extends Polygon {
362
362
  this.pos.x, this.pos.y, this.points
363
363
  );
364
364
  }
365
- };
366
-
367
-
365
+ }
368
366
  export default Rect;
@@ -155,6 +155,5 @@ class RoundRect extends Rect {
155
155
  clone() {
156
156
  return new RoundRect(this.pos.x, this.pos.y, this.width, this.height, this.radius);
157
157
  }
158
- };
159
-
158
+ }
160
159
  export default RoundRect;
package/src/index.js CHANGED
@@ -52,7 +52,9 @@ import ColorLayer from "./renderable/colorlayer.js";
52
52
  import ImageLayer from "./renderable/imagelayer.js";
53
53
  import Sprite from "./renderable/sprite.js";
54
54
  import NineSliceSprite from "./renderable/nineslicesprite.js";
55
- import GUI_Object from "./renderable/GUI.js";
55
+ import UIBaseElement from "./renderable/ui/uibaseelement.js";
56
+ import UITextButton from "./renderable/ui/uitextbutton.js";
57
+ import UISpriteElement from "./renderable/ui/uispriteelement.js";
56
58
  import Collectable from "./renderable/collectable.js";
57
59
  import Trigger from "./renderable/trigger.js";
58
60
  import Light2d from "./renderable/light2d.js";
@@ -141,7 +143,9 @@ export {
141
143
  ImageLayer,
142
144
  Sprite,
143
145
  NineSliceSprite,
144
- GUI_Object,
146
+ UIBaseElement,
147
+ UITextButton,
148
+ UISpriteElement,
145
149
  Collectable,
146
150
  Trigger,
147
151
  Light2d,
@@ -279,10 +283,10 @@ export function boot() {
279
283
  if (skipAutoInit === true) {
280
284
  event.emit(event.DOM_READY);
281
285
  }
282
- };
286
+ }
283
287
 
284
288
  // call the library init function when ready
285
- device.onReady(function () {
289
+ device.onReady(() => {
286
290
  if (skipAutoInit === false) {
287
291
  boot();
288
292
  }
@@ -55,13 +55,13 @@ var leadingZeroRE = /^0+/;
55
55
  * @ignore
56
56
  */
57
57
  function addMapping(id, mapping) {
58
- var expanded_id = id.replace(vendorProductRE, function (_, a, b) {
58
+ var expanded_id = id.replace(vendorProductRE, (_, a, b) => {
59
59
  return (
60
60
  "000".slice(a.length - 1) + a + "-" +
61
61
  "000".slice(b.length - 1) + b + "-"
62
62
  );
63
63
  });
64
- var sparse_id = id.replace(vendorProductRE, function (_, a, b) {
64
+ var sparse_id = id.replace(vendorProductRE, (_, a, b) => {
65
65
  return (
66
66
  a.replace(leadingZeroRE, "") + "-" +
67
67
  b.replace(leadingZeroRE, "") + "-"
@@ -69,7 +69,7 @@ function addMapping(id, mapping) {
69
69
  });
70
70
 
71
71
  // Normalize optional parameters
72
- mapping.analog = mapping.analog || mapping.buttons.map(function () {
72
+ mapping.analog = mapping.analog || mapping.buttons.map(() => {
73
73
  return -1;
74
74
  });
75
75
  mapping.normalize_fn = mapping.normalize_fn || function (value) { return value; };
@@ -132,7 +132,7 @@ var updateEventHandler;
132
132
  "normalize_fn" : ouyaNormalizeFn
133
133
  }
134
134
  ]
135
- ].forEach(function (value) {
135
+ ].forEach((value) => {
136
136
  addMapping(value[0], value[1]);
137
137
  });
138
138
 
@@ -144,7 +144,7 @@ var updateGamepads = function () {
144
144
  var gamepads = navigator.getGamepads();
145
145
 
146
146
  // Trigger button bindings
147
- Object.keys(bindings).forEach(function (index) {
147
+ Object.keys(bindings).forEach((index) => {
148
148
  var gamepad = gamepads[index];
149
149
  if (!gamepad) {
150
150
  return;
@@ -158,7 +158,7 @@ var updateGamepads = function () {
158
158
  var binding = bindings[index];
159
159
 
160
160
  // Iterate all buttons that have active bindings
161
- Object.keys(binding.buttons).forEach(function (button) {
161
+ Object.keys(binding.buttons).forEach((button) => {
162
162
  var last = binding.buttons[button];
163
163
  var mapped_button = button;
164
164
  var mapped_axis = -1;
@@ -205,7 +205,7 @@ var updateGamepads = function () {
205
205
  });
206
206
 
207
207
  // Iterate all axes that have active bindings
208
- Object.keys(binding.axes).forEach(function (axis) {
208
+ Object.keys(binding.axes).forEach((axis) => {
209
209
  var last = binding.axes[axis];
210
210
  var mapped_axis = axis;
211
211
 
@@ -260,14 +260,14 @@ var updateGamepads = function () {
260
260
 
261
261
  // gamepad connected callback
262
262
  if (globalThis.navigator && typeof globalThis.navigator.getGamepads === "function") {
263
- globalThis.addEventListener("gamepadconnected", function (e) {
263
+ globalThis.addEventListener("gamepadconnected", (e) => {
264
264
  event.emit(event.GAMEPAD_CONNECTED, e.gamepad);
265
265
  }, false);
266
266
 
267
267
  /*
268
268
  * gamepad disconnected callback
269
269
  */
270
- globalThis.addEventListener("gamepaddisconnected", function (e) {
270
+ globalThis.addEventListener("gamepaddisconnected", (e) => {
271
271
  event.emit(event.GAMEPAD_DISCONNECTED, e.gamepad);
272
272
  }, false);
273
273
  }
@@ -422,7 +422,7 @@ export function bindGamepad(index, button, keyCode) {
422
422
  };
423
423
  }
424
424
  }
425
- };
425
+ }
426
426
 
427
427
  /**
428
428
  * unbind the defined keycode
@@ -439,7 +439,7 @@ export function unbindGamepad(index, button) {
439
439
  throw new Error("no bindings for gamepad " + index);
440
440
  }
441
441
  bindings[index].buttons[button] = {};
442
- };
442
+ }
443
443
 
444
444
  /**
445
445
  * Set deadzone for analog gamepad inputs<br>
@@ -451,7 +451,7 @@ export function unbindGamepad(index, button) {
451
451
  */
452
452
  export function setGamepadDeadzone(value) {
453
453
  deadzone = value;
454
- };
454
+ }
455
455
 
456
456
  /**
457
457
  * specify a custom mapping for a specific gamepad id<br>
@@ -324,7 +324,7 @@ export function initKeyboardEvent() {
324
324
  keyBoardEventTarget.addEventListener("keyup", keyUpEvent, false);
325
325
  }
326
326
  }
327
- };
327
+ }
328
328
 
329
329
  /**
330
330
  * return the key press status of the specified action
@@ -349,7 +349,7 @@ export function isKeyPressed(action) {
349
349
  return true;
350
350
  }
351
351
  return false;
352
- };
352
+ }
353
353
 
354
354
  /**
355
355
  * return the key status of the specified action
@@ -361,7 +361,7 @@ export function isKeyPressed(action) {
361
361
  */
362
362
  export function keyStatus(action) {
363
363
  return (_keyStatus[action] > 0);
364
- };
364
+ }
365
365
 
366
366
 
367
367
  /**
@@ -383,7 +383,7 @@ export function triggerKeyEvent(keycode, status, mouseButton) {
383
383
  else {
384
384
  keyUpEvent({}, keycode, mouseButton);
385
385
  }
386
- };
386
+ }
387
387
 
388
388
 
389
389
  /**
@@ -410,7 +410,7 @@ export function bindKey(keycode, action, lock, preventDefault = preventDefaultAc
410
410
  _keyLock[action] = lock ? lock : false;
411
411
  _keyLocked[action] = false;
412
412
  _keyRefs[action] = {};
413
- };
413
+ }
414
414
 
415
415
  /**
416
416
  * return the action associated with the given keycode
@@ -422,7 +422,7 @@ export function bindKey(keycode, action, lock, preventDefault = preventDefaultAc
422
422
  */
423
423
  export function getBindingKey(keycode) {
424
424
  return _keyBindings[keycode];
425
- };
425
+ }
426
426
 
427
427
  /**
428
428
  * unlock a key manually
@@ -438,7 +438,7 @@ export function getBindingKey(keycode) {
438
438
  */
439
439
  export function unlockKey(action) {
440
440
  _keyLocked[action] = false;
441
- };
441
+ }
442
442
 
443
443
  /**
444
444
  * unbind the defined keycode
@@ -458,4 +458,4 @@ export function unbindKey(keycode) {
458
458
  // remove the key binding
459
459
  _keyBindings[keycode] = null;
460
460
  _preventDefaultForKeys[keycode] = null;
461
- };
461
+ }
@@ -381,6 +381,6 @@ class Pointer extends Bounds {
381
381
  this.width = this.height = 1;
382
382
  }
383
383
  }
384
- };
384
+ }
385
385
 
386
386
  export default Pointer;