melonjs 18.1.0 → 18.2.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 (96) hide show
  1. package/build/application/application.d.ts +29 -37
  2. package/build/application/application.d.ts.map +1 -1
  3. package/build/application/header.d.ts +3 -7
  4. package/build/application/header.d.ts.map +1 -1
  5. package/build/application/resize.d.ts +3 -4
  6. package/build/application/resize.d.ts.map +1 -1
  7. package/build/audio/audio.d.ts +145 -125
  8. package/build/audio/audio.d.ts.map +1 -1
  9. package/build/camera/camera2d.d.ts +192 -102
  10. package/build/camera/camera2d.d.ts.map +1 -1
  11. package/build/geometries/roundrect.d.ts +82 -17
  12. package/build/geometries/roundrect.d.ts.map +1 -1
  13. package/build/index.d.ts +12 -12
  14. package/build/index.js +2288 -842
  15. package/build/index.js.map +4 -4
  16. package/build/input/gamepad.d.ts +110 -61
  17. package/build/input/gamepad.d.ts.map +1 -1
  18. package/build/input/input.d.ts +3 -7
  19. package/build/input/input.d.ts.map +1 -1
  20. package/build/input/pointer.d.ts +25 -51
  21. package/build/input/pointer.d.ts.map +1 -1
  22. package/build/input/pointerevent.d.ts +51 -79
  23. package/build/input/pointerevent.d.ts.map +1 -1
  24. package/build/level/tiled/TMXGroup.d.ts +5 -0
  25. package/build/level/tiled/TMXGroup.d.ts.map +1 -1
  26. package/build/level/tiled/TMXLayer.d.ts.map +1 -1
  27. package/build/level/tiled/TMXObject.d.ts +21 -16
  28. package/build/level/tiled/TMXObject.d.ts.map +1 -1
  29. package/build/level/tiled/TMXTile.d.ts +16 -5
  30. package/build/level/tiled/TMXTile.d.ts.map +1 -1
  31. package/build/level/tiled/TMXTileMap.d.ts +15 -3
  32. package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
  33. package/build/level/tiled/TMXTileset.d.ts +136 -15
  34. package/build/level/tiled/TMXTileset.d.ts.map +1 -1
  35. package/build/level/tiled/TMXUtils.d.ts +31 -0
  36. package/build/level/tiled/TMXUtils.d.ts.map +1 -1
  37. package/build/level/tiled/constants.d.ts +1 -1
  38. package/build/level/tiled/constants.d.ts.map +1 -1
  39. package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts +42 -0
  40. package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -0
  41. package/build/level/tiled/renderer/autodetect.d.ts +2 -1
  42. package/build/level/tiled/renderer/autodetect.d.ts.map +1 -1
  43. package/build/loader/loadingscreen.d.ts +1 -0
  44. package/build/loader/loadingscreen.d.ts.map +1 -1
  45. package/build/particles/emitter.d.ts +38 -121
  46. package/build/particles/emitter.d.ts.map +1 -1
  47. package/build/particles/particle.d.ts +1 -4
  48. package/build/particles/particle.d.ts.map +1 -1
  49. package/build/physics/bounds.d.ts +1 -1
  50. package/build/physics/bounds.d.ts.map +1 -1
  51. package/build/physics/detector.d.ts.map +1 -1
  52. package/build/physics/world.d.ts +2 -2
  53. package/build/plugin/plugin.d.ts +36 -53
  54. package/build/plugin/plugin.d.ts.map +1 -1
  55. package/build/polyfill/ellipse.d.ts +2 -0
  56. package/build/polyfill/ellipse.d.ts.map +1 -0
  57. package/build/polyfill/index.d.ts +1 -0
  58. package/build/polyfill/index.d.ts.map +1 -1
  59. package/build/renderable/colorlayer.d.ts +2 -2
  60. package/build/renderable/container.d.ts +6 -6
  61. package/build/renderable/container.d.ts.map +1 -1
  62. package/build/renderable/imagelayer.d.ts.map +1 -1
  63. package/build/renderable/renderable.d.ts +11 -2
  64. package/build/renderable/renderable.d.ts.map +1 -1
  65. package/build/renderable/ui/uibaseelement.d.ts +46 -33
  66. package/build/renderable/ui/uibaseelement.d.ts.map +1 -1
  67. package/build/renderable/ui/uispriteelement.d.ts +53 -43
  68. package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
  69. package/build/renderable/ui/uitextbutton.d.ts +68 -74
  70. package/build/renderable/ui/uitextbutton.d.ts.map +1 -1
  71. package/build/state/stage.d.ts +1 -1
  72. package/build/state/state.d.ts +93 -90
  73. package/build/state/state.d.ts.map +1 -1
  74. package/build/system/event.d.ts +2 -2
  75. package/build/system/event.d.ts.map +1 -1
  76. package/build/utils/decode.d.ts +1 -0
  77. package/build/utils/decode.d.ts.map +1 -1
  78. package/build/utils/function.d.ts +1 -1
  79. package/build/utils/function.d.ts.map +1 -1
  80. package/build/utils/utils.d.ts +1 -1
  81. package/build/utils/utils.d.ts.map +1 -1
  82. package/build/video/canvas/canvas_renderer.d.ts +40 -13
  83. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  84. package/build/video/renderer.d.ts +12 -0
  85. package/build/video/renderer.d.ts.map +1 -1
  86. package/build/video/webgl/batchers/batcher.d.ts +43 -8
  87. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  88. package/build/video/webgl/batchers/quad_batcher.d.ts +0 -2
  89. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  90. package/build/video/webgl/buffer/index.d.ts +33 -8
  91. package/build/video/webgl/buffer/index.d.ts.map +1 -1
  92. package/build/video/webgl/buffer/vertex.d.ts +9 -1
  93. package/build/video/webgl/buffer/vertex.d.ts.map +1 -1
  94. package/build/video/webgl/webgl_renderer.d.ts +22 -20
  95. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  96. package/package.json +1 -1
@@ -1,46 +1,33 @@
1
- /**
2
- * additional import for TypeScript
3
- * @import WebGLRenderer from "./../video/webgl/webgl_renderer.js";
4
- * @import Camera2d from "./../camera/camera2d.js";
5
- */
1
+ import type Camera2d from "./../camera/camera2d.ts";
2
+ import World from "../physics/world.js";
3
+ import type Renderer from "./../video/renderer.js";
4
+ import type { ApplicationSettings } from "./settings.ts";
6
5
  /**
7
6
  * An Application represents a single melonJS game, and is responsible for updating (each frame) all the related object status and draw them.
8
7
  * @category Application
9
8
  * @see {@link game}
10
9
  */
11
10
  export default class Application {
12
- /**
13
- * @param {number} width - The width of the canvas viewport
14
- * @param {number} height - The height of the canvas viewport
15
- * @param {ApplicationSettings} [options] - The optional parameters for the application and default renderer
16
- * @throws Will throw an exception if it fails to instantiate a renderer
17
- */
18
- constructor(width: number, height: number, options?: ApplicationSettings);
19
11
  /**
20
12
  * the parent HTML element holding the main canvas of this application
21
- * @type {HTMLElement}
22
13
  */
23
14
  parentElement: HTMLElement;
24
15
  /**
25
16
  * a reference to the active Canvas or WebGL renderer
26
- * @type {CanvasRenderer|WebGLRenderer}
27
17
  */
28
- renderer: CanvasRenderer | WebGLRenderer;
18
+ renderer: Renderer;
29
19
  /**
30
20
  * the active stage "default" camera
31
- * @type {Camera2d}
32
21
  */
33
22
  viewport: Camera2d;
34
23
  /**
35
24
  * a reference to the game world, <br>
36
25
  * a world is a virtual environment containing all the game objects
37
- * @type {World}
38
26
  */
39
27
  world: World;
40
28
  /**
41
29
  * when true, all objects will be added under the root world container.<br>
42
30
  * When false, a `me.Container` object will be created for each corresponding groups
43
- * @type {boolean}
44
31
  * @default true
45
32
  */
46
33
  mergeGroup: boolean;
@@ -49,23 +36,26 @@ export default class Application {
49
36
  * Use this value to implement frame prediction in drawing events,
50
37
  * for creating smooth motion while running game update logic at
51
38
  * a lower fps.
52
- * @type {DOMHighResTimeStamp}
53
39
  */
54
40
  lastUpdate: DOMHighResTimeStamp;
55
41
  /**
56
42
  * true when this app instance has been initialized
57
- * @type {boolean}
58
43
  * @default false
59
44
  */
60
45
  isInitialized: boolean;
61
46
  /**
62
47
  * the given settings used when creating this application
63
- * @type {ApplicationSettings}
64
48
  */
65
- settings: ApplicationSettings;
49
+ settings: ApplicationSettings & {
50
+ width: number;
51
+ height: number;
52
+ autoScale: boolean;
53
+ zoomX: number;
54
+ zoomY: number;
55
+ scale: number | "auto";
56
+ };
66
57
  /**
67
58
  * Specify whether to pause this app when losing focus
68
- * @type {boolean}
69
59
  * @default true
70
60
  * @example
71
61
  * // keep the default game instance running even when losing focus
@@ -74,13 +64,11 @@ export default class Application {
74
64
  pauseOnBlur: boolean;
75
65
  /**
76
66
  * Specify whether to unpause this app when gaining back focus
77
- * @type {boolean}
78
67
  * @default true
79
68
  */
80
69
  resumeOnFocus: boolean;
81
70
  /**
82
71
  * Specify whether to stop this app when losing focus
83
- * @type {boolean}
84
72
  * @default false
85
73
  */
86
74
  stopOnBlur: boolean;
@@ -95,26 +83,34 @@ export default class Application {
95
83
  updateDelta: number;
96
84
  lastUpdateStart: number | null;
97
85
  updateAverageDelta: number;
86
+ /**
87
+ * @param width - The width of the canvas viewport
88
+ * @param height - The height of the canvas viewport
89
+ * @param options - The optional parameters for the application and default renderer
90
+ * @throws {Error} Will throw an exception if it fails to instantiate a renderer
91
+ */
92
+ constructor(width: number, height: number, options?: Partial<ApplicationSettings> & {
93
+ legacy?: boolean;
94
+ });
98
95
  /**
99
96
  * init the game instance (create a physic world, update starting time, etc..)
100
- * @param {number} width - The width of the canvas viewport
101
- * @param {number} height - The height of the canvas viewport
102
- * @param {ApplicationSettings} [options] - The optional parameters for the application and default renderer
97
+ * @param width - The width of the canvas viewport
98
+ * @param height - The height of the canvas viewport
99
+ * @param options - The optional parameters for the application and default renderer
103
100
  */
104
- init(width: number, height: number, options?: ApplicationSettings): void;
101
+ init(width: number, height: number, options?: Partial<ApplicationSettings>): void;
105
102
  /**
106
103
  * reset the game Object manager
107
104
  * destroy all current objects
108
105
  */
109
106
  reset(): void;
110
- set sortOn(value: string);
111
107
  /**
112
108
  * Specify the property to be used when sorting renderables for this application game world.
113
109
  * Accepted values : "x", "y", "z", "depth"
114
- * @type {string}
115
110
  * @see {@link World.sortOn}
116
111
  */
117
112
  get sortOn(): string;
113
+ set sortOn(value: string);
118
114
  /**
119
115
  * Fired when a level is fully loaded and all renderable instantiated. <br>
120
116
  * Additionally the level id will also be passed to the called function.
@@ -131,7 +127,7 @@ export default class Application {
131
127
  updateFrameRate(): void;
132
128
  /**
133
129
  * Returns the parent HTML Element holding the main canvas of this application
134
- * @returns {HTMLElement} the parent HTML element
130
+ * @returns the parent HTML element
135
131
  */
136
132
  getParentElement(): HTMLElement;
137
133
  /**
@@ -140,7 +136,7 @@ export default class Application {
140
136
  repaint(): void;
141
137
  /**
142
138
  * update all objects related to this game active scene/stage
143
- * @param {number} time - current timestamp as provided by the RAF callback
139
+ * @param time - current timestamp as provided by the RAF callback
144
140
  */
145
141
  update(time: number): void;
146
142
  /**
@@ -148,8 +144,4 @@ export default class Application {
148
144
  */
149
145
  draw(): void;
150
146
  }
151
- import CanvasRenderer from "../video/canvas/canvas_renderer.js";
152
- import type WebGLRenderer from "./../video/webgl/webgl_renderer.js";
153
- import type Camera2d from "./../camera/camera2d.js";
154
- import World from "../physics/world.js";
155
147
  //# sourceMappingURL=application.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/application/application.js"],"names":[],"mappings":"AAgCA;;;;GAIG;AAEH;;;;GAIG;AACH;IACC;;;;;OAKG;IACH,mBALW,MAAM,UACN,MAAM,YACN,mBAAmB,EA8G7B;IA1GA;;;OAGG;IACH,eAFU,WAAW,CAES;IAE9B;;;OAGG;IACH,UAFU,cAAc,GAAC,aAAa,CAEb;IAEzB;;;OAGG;IACH,UAFU,QAAQ,CAEO;IAEzB;;;;OAIG;IACH,OAFU,KAAK,CAEO;IAEtB;;;;;OAKG;IACH,YAHU,OAAO,CAGK;IAEtB;;;;;;OAMG;IACH,YAFU,mBAAmB,CAEV;IAEnB;;;;OAIG;IACH,eAHU,OAAO,CAGS;IAE1B;;;OAGG;IACH,UAFU,mBAAmB,CAEJ;IAEzB;;;;;;;OAOG;IACH,aANU,OAAO,CAMM;IAEvB;;;;OAIG;IACH,eAHU,OAAO,CAGQ;IAEzB;;;;OAIG;IACH,YAHU,OAAO,CAGM;IAGvB,iBAAmB;IAGnB,uBAA0B;IAI1B,qBAAqB;IACrB,kBAAkB;IAGlB,oBAAsB;IACtB,uBAAyB;IACzB,+BAA+B;IAG/B,iBAAyB;IACzB,oBAAoB;IACpB,+BAA2B;IAC3B,2BAA2B;IAS5B;;;;;OAKG;IACH,YAJW,MAAM,UACN,MAAM,YACN,mBAAmB,QA6J7B;IAED;;;OAGG;IACH,cAYC;IAWD,kBANU,MAAM,EAQf;IAXD;;;;;OAKG;IACH,cAHU,MAAM,CAKf;IAKD;;;;;;OAMG;IACH,sBAAkB;IAElB;;;;OAIG;IACH,wBAaC;IAED;;;OAGG;IACH,oBAFa,WAAW,CAIvB;IAED;;OAEG;IACH,gBAEC;IAED;;;OAGG;IACH,aAFW,MAAM,QA8ChB;IAED;;OAEG;IACH,aAuBC;CACD;2BAjc0B,oCAAoC;+BASjC,oCAAoC;0BACzC,yBAAyB;kBAlChC,qBAAqB"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AAyBxC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAMnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC/B;;OAEG;IACH,aAAa,EAAG,WAAW,CAAC;IAE5B;;OAEG;IACH,QAAQ,EAAG,QAAQ,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAG,QAAQ,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAG,KAAK,CAAC;IAEd;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,EAAE,mBAAmB,CAAC;IAEhC;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAG,mBAAmB,GAAG;QAChC,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC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Script
3
- * @import Application from "./application.js";
4
- */
1
+ import type Application from "./application.ts";
5
2
  /**
6
3
  * display information
7
- * @param {Application} app - the game application instance calling this function
4
+ * @param app - the game application instance calling this function
8
5
  */
9
- export function consoleHeader(app: Application): void;
10
- import type Application from "./application.js";
6
+ export declare function consoleHeader(app: Application): void;
11
7
  //# sourceMappingURL=header.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/application/header.js"],"names":[],"mappings":"AAEA;;;GAGG;AAEH;;;GAGG;AACH,mCAFW,WAAW,QAgDrB;6BArD2B,kBAAkB"}
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/application/header.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CA8BpD"}
@@ -1,8 +1,7 @@
1
+ import type Application from "./application.ts";
1
2
  /**
2
3
  * callback for window resize event
3
- * @private
4
- * @param {Application} game - the game application instance triggering the resize
4
+ * @param game - the game application instance triggering the resize
5
5
  */
6
- export function onresize(game: Application): void;
7
- import type Application from "./application.js";
6
+ export declare function onresize(game: Application): void;
8
7
  //# sourceMappingURL=resize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../src/application/resize.js"],"names":[],"mappings":"AAyCA;;;;GAIG;AACH,+BAFW,WAAW,QA8ErB;6BAtH2B,kBAAkB"}
1
+ {"version":3,"file":"resize.d.ts","sourceRoot":"","sources":["../../src/application/resize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAkChD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CA4EhD"}