melonjs 14.4.0 → 14.5.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.
- package/README.md +11 -55
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/_virtual/index2.js +1 -1
- package/dist/melonjs.mjs/_virtual/multimap.js +1 -1
- package/dist/melonjs.mjs/_virtual/setmultimap.js +1 -1
- package/dist/melonjs.mjs/application/application.js +1 -1
- package/dist/melonjs.mjs/application/header.js +1 -1
- package/dist/melonjs.mjs/application/resize.js +1 -1
- package/dist/melonjs.mjs/application/settings.js +1 -1
- package/dist/melonjs.mjs/audio/audio.js +4 -4
- package/dist/melonjs.mjs/camera/camera2d.js +1 -1
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/entity/entity.js +43 -9
- package/dist/melonjs.mjs/geometries/ellipse.js +2 -3
- package/dist/melonjs.mjs/geometries/line.js +1 -1
- package/dist/melonjs.mjs/geometries/path2d.js +18 -42
- package/dist/melonjs.mjs/geometries/point.js +1 -6
- package/dist/melonjs.mjs/geometries/poly.js +2 -5
- package/dist/melonjs.mjs/geometries/rectangle.js +13 -9
- package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
- package/dist/melonjs.mjs/index.js +8 -6
- package/dist/melonjs.mjs/input/gamepad.js +10 -16
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +1 -1
- package/dist/melonjs.mjs/input/pointer.js +1 -1
- package/dist/melonjs.mjs/input/pointerevent.js +2 -16
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +1 -1
- package/dist/melonjs.mjs/level/level.js +3 -3
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +1 -8
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +8 -4
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +5 -5
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +1 -1
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +24 -0
- package/dist/melonjs.mjs/loader/loader.js +331 -716
- package/dist/melonjs.mjs/loader/loadingscreen.js +4 -4
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +281 -0
- package/dist/melonjs.mjs/loader/settings.js +91 -0
- package/dist/melonjs.mjs/math/color.js +1 -1
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +7 -9
- package/dist/melonjs.mjs/math/matrix3.js +18 -21
- package/dist/melonjs.mjs/math/observable_vector2.js +3 -3
- package/dist/melonjs.mjs/math/observable_vector3.js +3 -4
- package/dist/melonjs.mjs/math/vector2.js +3 -3
- package/dist/melonjs.mjs/math/vector3.js +3 -4
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +3 -3
- package/dist/melonjs.mjs/particles/particle.js +1 -1
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +18 -14
- package/dist/melonjs.mjs/physics/bounds.js +18 -70
- package/dist/melonjs.mjs/physics/collision.js +1 -1
- package/dist/melonjs.mjs/physics/detector.js +1 -1
- package/dist/melonjs.mjs/physics/quadtree.js +1 -1
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +1 -1
- package/dist/melonjs.mjs/physics/world.js +1 -1
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +1 -1
- package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
- package/dist/melonjs.mjs/renderable/container.js +25 -19
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +7 -1
- package/dist/melonjs.mjs/renderable/light2d.js +1 -1
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
- package/dist/melonjs.mjs/renderable/renderable.js +126 -105
- package/dist/melonjs.mjs/renderable/sprite.js +33 -54
- package/dist/melonjs.mjs/renderable/trigger.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -1
- package/dist/melonjs.mjs/state/stage.js +1 -1
- package/dist/melonjs.mjs/state/state.js +2 -2
- package/dist/melonjs.mjs/system/device.js +1 -1
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +1 -1
- package/dist/melonjs.mjs/system/platform.js +1 -1
- package/dist/melonjs.mjs/system/pooling.js +8 -18
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +66 -8
- package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +1 -1
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +1 -1
- package/dist/melonjs.mjs/utils/string.js +2 -2
- package/dist/melonjs.mjs/utils/utils.js +2 -4
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +1 -1
- package/dist/melonjs.mjs/video/renderer.js +1 -1
- package/dist/melonjs.mjs/video/texture/atlas.js +10 -9
- package/dist/melonjs.mjs/video/texture/cache.js +3 -3
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +1 -1
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +2 -2
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +235 -0
- package/{src/video/webgl → dist/melonjs.mjs/video/webgl/compositors}/webgl_compositor.js +28 -205
- package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +2 -2
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +2 -2
- package/dist/melonjs.module.js +17844 -17809
- package/dist/types/entity/entity.d.ts +2 -2
- package/dist/types/geometries/path2d.d.ts +5 -31
- package/dist/types/geometries/point.d.ts +2 -7
- package/dist/types/geometries/poly.d.ts +0 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/loader/cache.d.ts +7 -0
- package/dist/types/loader/loader.d.ts +166 -181
- package/dist/types/loader/parser.d.ts +41 -0
- package/dist/types/loader/settings.d.ts +57 -0
- package/dist/types/particles/emitter.d.ts +4 -4
- package/dist/types/physics/bounds.d.ts +29 -84
- package/dist/types/renderable/container.d.ts +0 -11
- package/dist/types/renderable/renderable.d.ts +37 -31
- package/dist/types/renderable/sprite.d.ts +3 -3
- package/dist/types/state/state.d.ts +1 -1
- package/dist/types/system/pooling.d.ts +2 -2
- package/dist/types/video/renderer.d.ts +1 -1
- package/dist/types/video/webgl/compositors/compositor.d.ts +101 -0
- package/dist/types/video/webgl/compositors/webgl_compositor.d.ts +86 -0
- package/dist/types/video/webgl/webgl_compositor.d.ts +2 -3
- package/dist/types/video/webgl/webgl_renderer.d.ts +1 -1
- package/package.json +16 -15
- package/src/audio/audio.js +3 -3
- package/src/entity/entity.js +42 -8
- package/src/geometries/ellipse.js +1 -2
- package/src/geometries/path2d.js +17 -41
- package/src/geometries/point.js +0 -5
- package/src/geometries/poly.js +1 -4
- package/src/geometries/rectangle.js +12 -8
- package/src/index.js +2 -2
- package/src/input/gamepad.js +9 -15
- package/src/input/pointerevent.js +1 -15
- package/src/level/level.js +2 -2
- package/src/level/tiled/TMXLayer.js +0 -7
- package/src/level/tiled/TMXTileMap.js +7 -3
- package/src/level/tiled/TMXTileset.js +4 -4
- package/src/loader/cache.js +16 -0
- package/src/loader/loader.js +339 -711
- package/src/loader/loadingscreen.js +3 -3
- package/src/loader/parser.js +279 -0
- package/src/loader/settings.js +85 -0
- package/src/math/matrix2.js +6 -8
- package/src/math/matrix3.js +17 -20
- package/src/math/observable_vector2.js +2 -2
- package/src/math/observable_vector3.js +2 -3
- package/src/math/vector2.js +2 -2
- package/src/math/vector3.js +2 -3
- package/src/particles/emitter.js +2 -2
- package/src/physics/body.js +17 -13
- package/src/physics/bounds.js +17 -69
- package/src/renderable/container.js +24 -18
- package/src/renderable/imagelayer.js +6 -0
- package/src/renderable/renderable.js +125 -104
- package/src/renderable/sprite.js +32 -53
- package/src/state/state.js +1 -1
- package/src/system/pooling.js +7 -17
- package/src/text/bitmaptext.js +65 -7
- package/src/utils/string.js +1 -1
- package/src/utils/utils.js +1 -3
- package/src/video/texture/atlas.js +9 -8
- package/src/video/texture/cache.js +2 -2
- package/src/video/video.js +1 -1
- package/src/video/webgl/compositors/compositor.js +227 -0
- package/src/video/webgl/compositors/webgl_compositor.js +300 -0
- package/src/video/webgl/webgl_renderer.js +1 -1
|
@@ -78,13 +78,13 @@ export default class Entity extends Renderable {
|
|
|
78
78
|
/** @ignore */
|
|
79
79
|
update(dt: any): boolean;
|
|
80
80
|
/**
|
|
81
|
-
* update the bounds
|
|
81
|
+
* update the bounds when the body is modified
|
|
82
82
|
* @ignore
|
|
83
83
|
* @name onBodyUpdate
|
|
84
84
|
* @memberof Entity
|
|
85
85
|
* @param {Body} body - the body whose bounds to update
|
|
86
86
|
*/
|
|
87
|
-
onBodyUpdate(
|
|
87
|
+
onBodyUpdate(): void;
|
|
88
88
|
preDraw(renderer: any): void;
|
|
89
89
|
/**
|
|
90
90
|
* onDeactivateEvent Notification function<br>
|
|
@@ -5,55 +5,39 @@
|
|
|
5
5
|
export default class Path2D {
|
|
6
6
|
/**
|
|
7
7
|
* the points defining the current path
|
|
8
|
-
* @
|
|
9
|
-
* @type {Vector2d[]}
|
|
10
|
-
* @name points
|
|
11
|
-
* @memberof Path2D#
|
|
8
|
+
* @type {Point[]}
|
|
12
9
|
*/
|
|
13
|
-
|
|
10
|
+
points: Point[];
|
|
14
11
|
/**
|
|
15
12
|
* space between interpolated points for quadratic and bezier curve approx. in pixels.
|
|
16
|
-
* @public
|
|
17
13
|
* @type {number}
|
|
18
|
-
* @name arcResolution
|
|
19
14
|
* @default 5
|
|
20
|
-
* @memberof Path2D#
|
|
21
15
|
*/
|
|
22
|
-
|
|
16
|
+
arcResolution: number;
|
|
23
17
|
vertices: any[];
|
|
24
18
|
/**
|
|
25
19
|
* begin a new path
|
|
26
|
-
* @name beginPath
|
|
27
|
-
* @memberof Path2D
|
|
28
20
|
*/
|
|
29
21
|
beginPath(): void;
|
|
30
22
|
/**
|
|
31
23
|
* causes the point of the pen to move back to the start of the current path.
|
|
32
24
|
* It tries to draw a straight line from the current point to the start.
|
|
33
25
|
* If the shape has already been closed or has only one point, this function does nothing.
|
|
34
|
-
* @name closePath
|
|
35
|
-
* @memberof Path2D
|
|
36
26
|
*/
|
|
37
27
|
closePath(): void;
|
|
38
28
|
/**
|
|
39
29
|
* triangulate the shape defined by this path into an array of triangles
|
|
40
|
-
* @
|
|
41
|
-
* @memberof Path2D
|
|
42
|
-
* @returns {Vector2d[]}
|
|
30
|
+
* @returns {Point[]}
|
|
43
31
|
*/
|
|
44
|
-
triangulatePath():
|
|
32
|
+
triangulatePath(): Point[];
|
|
45
33
|
/**
|
|
46
34
|
* moves the starting point of the current path to the (x, y) coordinates.
|
|
47
|
-
* @name moveTo
|
|
48
|
-
* @memberof Path2D
|
|
49
35
|
* @param {number} x - the x-axis (horizontal) coordinate of the point.
|
|
50
36
|
* @param {number} y - the y-axis (vertical) coordinate of the point.
|
|
51
37
|
*/
|
|
52
38
|
moveTo(x: number, y: number): void;
|
|
53
39
|
/**
|
|
54
40
|
* connects the last point in the current patch to the (x, y) coordinates with a straight line.
|
|
55
|
-
* @name lineTo
|
|
56
|
-
* @memberof Path2D
|
|
57
41
|
* @param {number} x - the x-axis coordinate of the line's end point.
|
|
58
42
|
* @param {number} y - the y-axis coordinate of the line's end point.
|
|
59
43
|
*/
|
|
@@ -61,8 +45,6 @@ export default class Path2D {
|
|
|
61
45
|
/**
|
|
62
46
|
* adds an arc to the current path which is centered at (x, y) position with the given radius,
|
|
63
47
|
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
|
|
64
|
-
* @name arc
|
|
65
|
-
* @memberof Path2D
|
|
66
48
|
* @param {number} x - the horizontal coordinate of the arc's center.
|
|
67
49
|
* @param {number} y - the vertical coordinate of the arc's center.
|
|
68
50
|
* @param {number} radius - the arc's radius. Must be positive.
|
|
@@ -73,8 +55,6 @@ export default class Path2D {
|
|
|
73
55
|
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean | undefined): void;
|
|
74
56
|
/**
|
|
75
57
|
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
76
|
-
* @name arcTo
|
|
77
|
-
* @memberof Path2D
|
|
78
58
|
* @param {number} x1 - the x-axis coordinate of the first control point.
|
|
79
59
|
* @param {number} y1 - the y-axis coordinate of the first control point.
|
|
80
60
|
* @param {number} x2 - the x-axis coordinate of the second control point.
|
|
@@ -85,8 +65,6 @@ export default class Path2D {
|
|
|
85
65
|
/**
|
|
86
66
|
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
87
67
|
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|
|
88
|
-
* @name ellipse
|
|
89
|
-
* @memberof Path2D
|
|
90
68
|
* @param {number} x - the x-axis (horizontal) coordinate of the ellipse's center.
|
|
91
69
|
* @param {number} y - the y-axis (vertical) coordinate of the ellipse's center.
|
|
92
70
|
* @param {number} radiusX - the ellipse's major-axis radius. Must be non-negative.
|
|
@@ -99,8 +77,6 @@ export default class Path2D {
|
|
|
99
77
|
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean | undefined): void;
|
|
100
78
|
/**
|
|
101
79
|
* creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
|
|
102
|
-
* @name rect
|
|
103
|
-
* @memberof Path2D
|
|
104
80
|
* @param {number} x - the x-axis coordinate of the rectangle's starting point.
|
|
105
81
|
* @param {number} y - the y-axis coordinate of the rectangle's starting point.
|
|
106
82
|
* @param {number} width - the rectangle's width. Positive values are to the right, and negative to the left.
|
|
@@ -109,8 +85,6 @@ export default class Path2D {
|
|
|
109
85
|
rect(x: number, y: number, width: number, height: number): void;
|
|
110
86
|
/**
|
|
111
87
|
* adds an rounded rectangle to the current path.
|
|
112
|
-
* @name roundRect
|
|
113
|
-
* @memberof Path2D
|
|
114
88
|
* @param {number} x - the x-axis coordinate of the rectangle's starting point.
|
|
115
89
|
* @param {number} y - the y-axis coordinate of the rectangle's starting point.
|
|
116
90
|
* @param {number} width - the rectangle's width. Positive values are to the right, and negative to the left.
|
|
@@ -6,18 +6,16 @@ export default class Point {
|
|
|
6
6
|
constructor(x?: number, y?: number);
|
|
7
7
|
/**
|
|
8
8
|
* the position of the point on the horizontal axis
|
|
9
|
-
* @public
|
|
10
9
|
* @type {Number}
|
|
11
10
|
* @default 0
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
x: number;
|
|
14
13
|
/**
|
|
15
14
|
* the position of the point on the vertical axis
|
|
16
|
-
* @public
|
|
17
15
|
* @type {Number}
|
|
18
16
|
* @default 0
|
|
19
17
|
*/
|
|
20
|
-
|
|
18
|
+
y: number;
|
|
21
19
|
/** @ignore */
|
|
22
20
|
onResetEvent(x?: number, y?: number): void;
|
|
23
21
|
/**
|
|
@@ -37,8 +35,6 @@ export default class Point {
|
|
|
37
35
|
*/
|
|
38
36
|
/**
|
|
39
37
|
* return true if this point is equal to the given values
|
|
40
|
-
* @name equals
|
|
41
|
-
* @memberof Point
|
|
42
38
|
* @param {number} x
|
|
43
39
|
* @param {number} y
|
|
44
40
|
* @returns {boolean}
|
|
@@ -46,7 +42,6 @@ export default class Point {
|
|
|
46
42
|
equals(...args: any[]): boolean;
|
|
47
43
|
/**
|
|
48
44
|
* clone this Point
|
|
49
|
-
* @name clone
|
|
50
45
|
* @returns {Point} new Point
|
|
51
46
|
*/
|
|
52
47
|
clone(): Point;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ import * as audio from "./audio/audio.js";
|
|
|
36
36
|
import collision from "./physics/collision.js";
|
|
37
37
|
import * as device from "./system/device.js";
|
|
38
38
|
import * as event from "./system/event.js";
|
|
39
|
-
import loader from "./loader/loader.js";
|
|
39
|
+
import * as loader from "./loader/loader.js";
|
|
40
40
|
import level from "./level/level.js";
|
|
41
41
|
import * as input from "./input/input.js";
|
|
42
42
|
import * as Math from "./math/math.js";
|
|
@@ -64,7 +64,7 @@ import RoundRect from "./geometries/roundrect.js";
|
|
|
64
64
|
import Tween from "./tweens/tween.js";
|
|
65
65
|
import QuadTree from "./physics/quadtree.js";
|
|
66
66
|
import GLShader from "./video/webgl/glshader.js";
|
|
67
|
-
import WebGLCompositor from "./video/webgl/webgl_compositor.js";
|
|
67
|
+
import WebGLCompositor from "./video/webgl/compositors/webgl_compositor.js";
|
|
68
68
|
import Renderer from "./video/renderer.js";
|
|
69
69
|
import WebGLRenderer from "./video/webgl/webgl_renderer.js";
|
|
70
70
|
import CanvasRenderer from "./video/canvas/canvas_renderer.js";
|
|
@@ -1,181 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
* @public
|
|
168
|
-
* @param {string} image - name of the Image element ("tileset-platformer");
|
|
169
|
-
* @returns {HTMLImageElement} requested element or null if not found
|
|
170
|
-
*/
|
|
171
|
-
function getImage(image: string): HTMLImageElement;
|
|
172
|
-
/**
|
|
173
|
-
* return the specified JSON Object
|
|
174
|
-
* @name getJSON
|
|
175
|
-
* @memberof loader
|
|
176
|
-
* @public
|
|
177
|
-
* @param {string} elt - name of the json file to load
|
|
178
|
-
* @returns {object}
|
|
179
|
-
*/
|
|
180
|
-
function getJSON(elt: string): object;
|
|
181
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* set all the specified game resources to be preloaded.
|
|
3
|
+
* @name preload
|
|
4
|
+
* @memberof loader
|
|
5
|
+
* @public
|
|
6
|
+
* @param {object[]} res
|
|
7
|
+
* @param {string} res.name - internal name of the resource
|
|
8
|
+
* @param {string} res.type - "audio", binary", "image", "json","js", "tmx", "tsx", "fontface"
|
|
9
|
+
* @param {string} res.src - path and/or file name of the resource (for audio assets only the path is required)
|
|
10
|
+
* @param {boolean} [res.stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
11
|
+
* @param {Function} [onload=loader.onload] - function to be called when all resources are loaded
|
|
12
|
+
* @param {boolean} [switchToLoadState=true] - automatically switch to the loading screen
|
|
13
|
+
* @example
|
|
14
|
+
* game_resources = [
|
|
15
|
+
* // PNG tileset
|
|
16
|
+
* {name: "tileset-platformer", type: "image", src: "data/map/tileset.png"},
|
|
17
|
+
* // PNG packed texture
|
|
18
|
+
* {name: "texture", type:"image", src: "data/gfx/texture.png"}
|
|
19
|
+
* // PNG base64 encoded image
|
|
20
|
+
* {name: "texture", type:"image", src: "data:image/png;base64,iVBORw0KAAAQAAAAEACA..."}
|
|
21
|
+
* // TSX file
|
|
22
|
+
* {name: "meta_tiles", type: "tsx", src: "data/map/meta_tiles.tsx"},
|
|
23
|
+
* // TMX level (XML & JSON)
|
|
24
|
+
* {name: "map1", type: "tmx", src: "data/map/map1.json"},
|
|
25
|
+
* {name: "map2", type: "tmx", src: "data/map/map2.tmx"},
|
|
26
|
+
* {name: "map3", type: "tmx", format: "json", data: {"height":15,"layers":[...],"tilewidth":32,"version":1,"width":20}},
|
|
27
|
+
* {name: "map4", type: "tmx", format: "xml", data: {xml representation of tmx}},
|
|
28
|
+
* // audio resources
|
|
29
|
+
* {name: "bgmusic", type: "audio", src: "data/audio/"},
|
|
30
|
+
* {name: "cling", type: "audio", src: "data/audio/"},
|
|
31
|
+
* // base64 encoded audio resources
|
|
32
|
+
* {name: "band", type: "audio", src: "data:audio/wav;base64,..."},
|
|
33
|
+
* // binary file
|
|
34
|
+
* {name: "ymTrack", type: "binary", src: "data/audio/main.ym"},
|
|
35
|
+
* // JSON file (used for texturePacker)
|
|
36
|
+
* {name: "texture", type: "json", src: "data/gfx/texture.json"},
|
|
37
|
+
* // JavaScript file
|
|
38
|
+
* {name: "plugin", type: "js", src: "data/js/plugin.js"},
|
|
39
|
+
* // Font Face
|
|
40
|
+
* { name: "'kenpixel'", type: "fontface", src: "url('data/font/kenvector_future.woff2')" }
|
|
41
|
+
* ];
|
|
42
|
+
* ...
|
|
43
|
+
* // set all resources to be loaded
|
|
44
|
+
* me.loader.preload(game.resources, this.loaded.bind(this));
|
|
45
|
+
*/
|
|
46
|
+
export function preload(res: {
|
|
47
|
+
name: string;
|
|
48
|
+
type: string;
|
|
49
|
+
src: string;
|
|
50
|
+
stream?: boolean;
|
|
51
|
+
}, onloadcb: any, switchToLoadState?: boolean | undefined): void;
|
|
52
|
+
/**
|
|
53
|
+
* Load a single resource (to be used if you need to load additional resource during the game)
|
|
54
|
+
* @name load
|
|
55
|
+
* @memberof loader
|
|
56
|
+
* @public
|
|
57
|
+
* @param {object} res
|
|
58
|
+
* @param {string} res.name - internal name of the resource
|
|
59
|
+
* @param {string} res.type - "audio", binary", "image", "json", "tmx", "tsx"
|
|
60
|
+
* @param {string} res.src - path and/or file name of the resource (for audio assets only the path is required)
|
|
61
|
+
* @param {boolean} [res.stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
62
|
+
* @param {Function} [onload] - function to be called when the resource is loaded
|
|
63
|
+
* @param {Function} [onerror] - function to be called in case of error
|
|
64
|
+
* @returns {number} the amount of corresponding resource to be preloaded
|
|
65
|
+
* @example
|
|
66
|
+
* // load an image asset
|
|
67
|
+
* me.loader.load({name: "avatar", type:"image", src: "data/avatar.png"}, this.onload.bind(this), this.onerror.bind(this));
|
|
68
|
+
* // load a base64 image asset
|
|
69
|
+
* me.loader.load({name: "avatar", type:"image", src: "data:image/png;base64,iVBORw0KAAAQAAAAEACA..."};
|
|
70
|
+
* // start loading music
|
|
71
|
+
* me.loader.load({
|
|
72
|
+
* name : "bgmusic",
|
|
73
|
+
* type : "audio",
|
|
74
|
+
* src : "data/audio/"
|
|
75
|
+
* }, function () {
|
|
76
|
+
* me.audio.play("bgmusic");
|
|
77
|
+
* });
|
|
78
|
+
*/
|
|
79
|
+
export function load(res: {
|
|
80
|
+
name: string;
|
|
81
|
+
type: string;
|
|
82
|
+
src: string;
|
|
83
|
+
stream?: boolean | undefined;
|
|
84
|
+
}, onload?: Function | undefined, onerror?: Function | undefined): number;
|
|
85
|
+
/**
|
|
86
|
+
* unload specified resource to free memory
|
|
87
|
+
* @name unload
|
|
88
|
+
* @memberof loader
|
|
89
|
+
* @public
|
|
90
|
+
* @param {object} res
|
|
91
|
+
* @param {string} res.name - internal name of the resource
|
|
92
|
+
* @param {string} res.type - "audio", binary", "image", "json", "tmx", "tsx"
|
|
93
|
+
* @returns {boolean} true if unloaded
|
|
94
|
+
* @example me.loader.unload({name: "avatar", type:"image"});
|
|
95
|
+
*/
|
|
96
|
+
export function unload(res: {
|
|
97
|
+
name: string;
|
|
98
|
+
type: string;
|
|
99
|
+
}): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* unload all resources to free memory
|
|
102
|
+
* @name unloadAll
|
|
103
|
+
* @memberof loader
|
|
104
|
+
* @public
|
|
105
|
+
* @example me.loader.unloadAll();
|
|
106
|
+
*/
|
|
107
|
+
export function unloadAll(): void;
|
|
108
|
+
/**
|
|
109
|
+
* return the specified TMX/TSX object
|
|
110
|
+
* @name getTMX
|
|
111
|
+
* @memberof loader
|
|
112
|
+
* @public
|
|
113
|
+
* @param {string} elt - name of the tmx/tsx element ("map1");
|
|
114
|
+
* @returns {object} requested element or null if not found
|
|
115
|
+
*/
|
|
116
|
+
export function getTMX(elt: string): object;
|
|
117
|
+
/**
|
|
118
|
+
* return the specified Binary object
|
|
119
|
+
* @name getBinary
|
|
120
|
+
* @memberof loader
|
|
121
|
+
* @public
|
|
122
|
+
* @param {string} elt - name of the binary object ("ymTrack");
|
|
123
|
+
* @returns {object} requested element or null if not found
|
|
124
|
+
*/
|
|
125
|
+
export function getBinary(elt: string): object;
|
|
126
|
+
/**
|
|
127
|
+
* return the specified Image Object
|
|
128
|
+
* @name getImage
|
|
129
|
+
* @memberof loader
|
|
130
|
+
* @public
|
|
131
|
+
* @param {string} image - name of the Image element ("tileset-platformer");
|
|
132
|
+
* @returns {HTMLImageElement} requested element or null if not found
|
|
133
|
+
*/
|
|
134
|
+
export function getImage(image: string): HTMLImageElement;
|
|
135
|
+
/**
|
|
136
|
+
* return the specified JSON Object
|
|
137
|
+
* @name getJSON
|
|
138
|
+
* @memberof loader
|
|
139
|
+
* @public
|
|
140
|
+
* @param {string} elt - name of the json file to load
|
|
141
|
+
* @returns {object}
|
|
142
|
+
*/
|
|
143
|
+
export function getJSON(elt: string): object;
|
|
144
|
+
export * from "./settings.js";
|
|
145
|
+
/**
|
|
146
|
+
* onload callback
|
|
147
|
+
* @name onload
|
|
148
|
+
* @default undefined
|
|
149
|
+
* @memberof loader
|
|
150
|
+
* @example
|
|
151
|
+
* // set a callback when everything is loaded
|
|
152
|
+
* me.loader.onload = this.loaded.bind(this);
|
|
153
|
+
*/
|
|
154
|
+
export let onload: any;
|
|
155
|
+
/**
|
|
156
|
+
* onProgress callback<br>
|
|
157
|
+
* each time a resource is loaded, the loader will fire the specified function,
|
|
158
|
+
* giving the actual progress [0 ... 1], as argument, and an object describing the resource loaded
|
|
159
|
+
* @name onProgress
|
|
160
|
+
* @default undefined
|
|
161
|
+
* @memberof loader
|
|
162
|
+
* @example
|
|
163
|
+
* // set a callback for progress notification
|
|
164
|
+
* me.loader.onProgress = this.updateProgress.bind(this);
|
|
165
|
+
*/
|
|
166
|
+
export let onProgress: any;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* load Images
|
|
3
|
+
* @example
|
|
4
|
+
* preloadImages([
|
|
5
|
+
* { name : 'image1', src : 'images/image1.png'},
|
|
6
|
+
* { name : 'image2', src : 'images/image2.png'},
|
|
7
|
+
* { name : 'image3', src : 'images/image3.png'},
|
|
8
|
+
* { name : 'image4', src : 'images/image4.png'}
|
|
9
|
+
* ]);
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
export function preloadImage(img: any, onload: any, onerror: any): void;
|
|
13
|
+
/**
|
|
14
|
+
* load a font face
|
|
15
|
+
* @example
|
|
16
|
+
* preloadFontFace(
|
|
17
|
+
* name: "'kenpixel'", type: "fontface", src: "url('data/font/kenvector_future.woff2')"
|
|
18
|
+
* ]);
|
|
19
|
+
* @ignore
|
|
20
|
+
*/
|
|
21
|
+
export function preloadFontFace(data: any, onload: any, onerror: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* preload TMX files
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
export function preloadTMX(tmxData: any, onload: any, onerror: any): void;
|
|
27
|
+
/**
|
|
28
|
+
* preload JSON files
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
export function preloadJSON(data: any, onload: any, onerror: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* preload Binary files
|
|
34
|
+
* @ignore
|
|
35
|
+
*/
|
|
36
|
+
export function preloadBinary(data: any, onload: any, onerror: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* preload Binary files
|
|
39
|
+
* @ignore
|
|
40
|
+
*/
|
|
41
|
+
export function preloadJavascript(data: any, onload: any, onerror: any): void;
|