melonjs 10.2.3 → 10.3.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/dist/melonjs.js +1741 -1558
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +1256 -1758
- package/dist/melonjs.module.js +1734 -1582
- package/package.json +12 -12
- package/src/audio/audio.js +3 -3
- package/src/camera/camera2d.js +26 -27
- package/src/entity/draggable.js +10 -19
- package/src/entity/droptarget.js +12 -20
- package/src/entity/entity.js +13 -13
- package/src/game.js +6 -6
- package/src/{shapes → geometries}/ellipse.js +19 -20
- package/src/{shapes → geometries}/line.js +6 -7
- package/src/{shapes → geometries}/poly.js +70 -23
- package/src/{shapes → geometries}/rectangle.js +23 -24
- package/src/index.js +8 -9
- package/src/input/gamepad.js +7 -7
- package/src/input/input.js +2 -2
- package/src/input/keyboard.js +108 -108
- package/src/input/pointer.js +61 -28
- package/src/input/pointerevent.js +79 -16
- package/src/lang/deprecated.js +26 -15
- package/src/level/level.js +10 -10
- package/src/level/tiled/TMXGroup.js +6 -7
- package/src/level/tiled/TMXLayer.js +10 -11
- package/src/level/tiled/TMXObject.js +57 -51
- package/src/level/tiled/TMXTile.js +2 -3
- package/src/level/tiled/TMXTileMap.js +3 -4
- package/src/level/tiled/TMXTileset.js +1 -2
- package/src/level/tiled/TMXTilesetGroup.js +1 -2
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
- package/src/loader/loader.js +17 -15
- package/src/loader/loadingscreen.js +1 -2
- package/src/math/color.js +23 -24
- package/src/math/math.js +16 -16
- package/src/math/matrix2.js +24 -25
- package/src/math/matrix3.js +26 -27
- package/src/math/observable_vector2.js +46 -35
- package/src/math/observable_vector3.js +54 -36
- package/src/math/vector2.js +58 -47
- package/src/math/vector3.js +66 -48
- package/src/particles/emitter.js +64 -72
- package/src/particles/particle.js +3 -4
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +38 -39
- package/src/physics/bounds.js +30 -32
- package/src/physics/collision.js +6 -6
- package/src/physics/detector.js +3 -3
- package/src/physics/quadtree.js +8 -9
- package/src/physics/sat.js +4 -4
- package/src/physics/world.js +11 -12
- package/src/plugin/plugin.js +6 -7
- package/src/renderable/GUI.js +7 -8
- package/src/renderable/collectable.js +3 -4
- package/src/renderable/colorlayer.js +7 -8
- package/src/renderable/container.js +36 -37
- package/src/renderable/imagelayer.js +4 -5
- package/src/renderable/nineslicesprite.js +2 -3
- package/src/renderable/renderable.js +45 -46
- package/src/renderable/sprite.js +16 -17
- package/src/renderable/trigger.js +4 -5
- package/src/state/stage.js +8 -9
- package/src/state/state.js +24 -24
- package/src/system/device.js +41 -97
- package/src/system/event.js +45 -33
- package/src/system/pooling.js +1 -1
- package/src/system/save.js +3 -3
- package/src/system/timer.js +13 -13
- package/src/text/bitmaptext.js +12 -13
- package/src/text/bitmaptextdata.js +5 -6
- package/src/text/text.js +16 -17
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +1 -1
- package/src/tweens/tween.js +14 -15
- package/src/utils/agent.js +3 -3
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +3 -3
- package/src/utils/function.js +3 -3
- package/src/utils/string.js +7 -7
- package/src/utils/utils.js +4 -4
- package/src/video/canvas/canvas_renderer.js +39 -40
- package/src/video/renderer.js +29 -30
- package/src/video/texture.js +8 -9
- package/src/video/texture_cache.js +2 -4
- package/src/video/video.js +7 -7
- package/src/video/webgl/buffer/vertex.js +2 -2
- package/src/video/webgl/glshader.js +11 -12
- package/src/video/webgl/webgl_compositor.js +118 -90
- package/src/video/webgl/webgl_renderer.js +95 -74
|
@@ -66,9 +66,8 @@ function preRenderLayer(layer, renderer) {
|
|
|
66
66
|
* a TMX Tile Layer Object
|
|
67
67
|
* Tiled QT 0.7.x format
|
|
68
68
|
* @class
|
|
69
|
-
* @
|
|
70
|
-
* @
|
|
71
|
-
* @constructor
|
|
69
|
+
* @augments me.Renderable
|
|
70
|
+
* @memberof me
|
|
72
71
|
* @param {object} map layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
73
72
|
* @param {object} data layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
74
73
|
* @param {number} tilewidth width of each tile in pixels
|
|
@@ -243,7 +242,7 @@ class TMXLayer extends Renderable {
|
|
|
243
242
|
/**
|
|
244
243
|
* Set the TMX renderer for this layer object
|
|
245
244
|
* @name setRenderer
|
|
246
|
-
* @
|
|
245
|
+
* @memberof me.TMXLayer
|
|
247
246
|
* @public
|
|
248
247
|
* @function
|
|
249
248
|
* @param {me.TMXRenderer} renderer
|
|
@@ -259,7 +258,7 @@ class TMXLayer extends Renderable {
|
|
|
259
258
|
/**
|
|
260
259
|
* Return the layer current renderer object
|
|
261
260
|
* @name getRenderer
|
|
262
|
-
* @
|
|
261
|
+
* @memberof me.TMXLayer
|
|
263
262
|
* @public
|
|
264
263
|
* @function
|
|
265
264
|
* @returns {me.TMXRenderer} renderer
|
|
@@ -272,7 +271,7 @@ class TMXLayer extends Renderable {
|
|
|
272
271
|
/**
|
|
273
272
|
* Return the TileId of the Tile at the specified position
|
|
274
273
|
* @name getTileId
|
|
275
|
-
* @
|
|
274
|
+
* @memberof me.TMXLayer
|
|
276
275
|
* @public
|
|
277
276
|
* @function
|
|
278
277
|
* @param {number} x X coordinate (in world/pixels coordinates)
|
|
@@ -287,7 +286,7 @@ class TMXLayer extends Renderable {
|
|
|
287
286
|
/**
|
|
288
287
|
* Return the Tile object at the specified position
|
|
289
288
|
* @name getTile
|
|
290
|
-
* @
|
|
289
|
+
* @memberof me.TMXLayer
|
|
291
290
|
* @public
|
|
292
291
|
* @function
|
|
293
292
|
* @param {number} x X coordinate (in world/pixels coordinates)
|
|
@@ -313,7 +312,7 @@ class TMXLayer extends Renderable {
|
|
|
313
312
|
/**
|
|
314
313
|
* assign the given Tile object to the specified position
|
|
315
314
|
* @name getTile
|
|
316
|
-
* @
|
|
315
|
+
* @memberof me.TMXLayer
|
|
317
316
|
* @public
|
|
318
317
|
* @function
|
|
319
318
|
* @param {me.Tile} tile the tile object to be assigned
|
|
@@ -329,7 +328,7 @@ class TMXLayer extends Renderable {
|
|
|
329
328
|
/**
|
|
330
329
|
* return a new the Tile object corresponding to the given tile id
|
|
331
330
|
* @name setTile
|
|
332
|
-
* @
|
|
331
|
+
* @memberof me.TMXLayer
|
|
333
332
|
* @public
|
|
334
333
|
* @function
|
|
335
334
|
* @param {number} tileId tileId
|
|
@@ -348,7 +347,7 @@ class TMXLayer extends Renderable {
|
|
|
348
347
|
/**
|
|
349
348
|
* Return the Tile object at the specified tile coordinates
|
|
350
349
|
* @name cellAt
|
|
351
|
-
* @
|
|
350
|
+
* @memberof me.TMXLayer
|
|
352
351
|
* @public
|
|
353
352
|
* @function
|
|
354
353
|
* @param {number} x x position of the tile (in Tile unit)
|
|
@@ -375,7 +374,7 @@ class TMXLayer extends Renderable {
|
|
|
375
374
|
/**
|
|
376
375
|
* clear the tile at the specified position
|
|
377
376
|
* @name clearTile
|
|
378
|
-
* @
|
|
377
|
+
* @memberof me.TMXLayer
|
|
379
378
|
* @public
|
|
380
379
|
* @function
|
|
381
380
|
* @param {number} x X coordinate (in map coordinates: row/column)
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import Vector2d from "./../../math/vector2.js";
|
|
2
2
|
import { applyTMXProperties } from "./TMXUtils.js";
|
|
3
3
|
import Tile from "./TMXTile.js";
|
|
4
|
-
import Ellipse from "./../../
|
|
5
|
-
import Polygon from "./../../
|
|
6
|
-
import Line from "./../../
|
|
4
|
+
import Ellipse from "./../../geometries/ellipse.js";
|
|
5
|
+
import Polygon from "./../../geometries/poly.js";
|
|
6
|
+
import Line from "./../../geometries/line.js";
|
|
7
7
|
import { degToRad } from "./../../math/math.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* a TMX Object defintion, as defined in Tiled
|
|
11
11
|
* (Object definition is translated into the virtual `me.game.world` using `me.Renderable`)
|
|
12
12
|
* @class TMXObject
|
|
13
|
-
* @constructor
|
|
14
13
|
* @ignore
|
|
15
14
|
*/
|
|
16
15
|
export default class TMXObject {
|
|
@@ -22,7 +21,7 @@ export default class TMXObject {
|
|
|
22
21
|
* @public
|
|
23
22
|
* @type {object[]}
|
|
24
23
|
* @name points
|
|
25
|
-
* @
|
|
24
|
+
* @memberof me.TMXObject
|
|
26
25
|
*/
|
|
27
26
|
this.points = undefined;
|
|
28
27
|
|
|
@@ -31,7 +30,7 @@ export default class TMXObject {
|
|
|
31
30
|
* @public
|
|
32
31
|
* @type {string}
|
|
33
32
|
* @name name
|
|
34
|
-
* @
|
|
33
|
+
* @memberof me.TMXObject
|
|
35
34
|
*/
|
|
36
35
|
this.name = settings.name;
|
|
37
36
|
|
|
@@ -40,7 +39,7 @@ export default class TMXObject {
|
|
|
40
39
|
* @public
|
|
41
40
|
* @type {number}
|
|
42
41
|
* @name x
|
|
43
|
-
* @
|
|
42
|
+
* @memberof me.TMXObject
|
|
44
43
|
*/
|
|
45
44
|
this.x = +settings.x;
|
|
46
45
|
|
|
@@ -49,7 +48,7 @@ export default class TMXObject {
|
|
|
49
48
|
* @public
|
|
50
49
|
* @type {number}
|
|
51
50
|
* @name y
|
|
52
|
-
* @
|
|
51
|
+
* @memberof me.TMXObject
|
|
53
52
|
*/
|
|
54
53
|
this.y = +settings.y;
|
|
55
54
|
|
|
@@ -58,7 +57,7 @@ export default class TMXObject {
|
|
|
58
57
|
* @public
|
|
59
58
|
* @type {number}
|
|
60
59
|
* @name z
|
|
61
|
-
* @
|
|
60
|
+
* @memberof me.TMXObject
|
|
62
61
|
*/
|
|
63
62
|
this.z = +z;
|
|
64
63
|
|
|
@@ -67,7 +66,7 @@ export default class TMXObject {
|
|
|
67
66
|
* @public
|
|
68
67
|
* @type {number}
|
|
69
68
|
* @name width
|
|
70
|
-
* @
|
|
69
|
+
* @memberof me.TMXObject
|
|
71
70
|
*/
|
|
72
71
|
this.width = +settings.width || 0;
|
|
73
72
|
|
|
@@ -76,7 +75,7 @@ export default class TMXObject {
|
|
|
76
75
|
* @public
|
|
77
76
|
* @type {number}
|
|
78
77
|
* @name height
|
|
79
|
-
* @
|
|
78
|
+
* @memberof me.TMXObject
|
|
80
79
|
*/
|
|
81
80
|
this.height = +settings.height || 0;
|
|
82
81
|
|
|
@@ -86,7 +85,7 @@ export default class TMXObject {
|
|
|
86
85
|
* @public
|
|
87
86
|
* @type {number}
|
|
88
87
|
* @name gid
|
|
89
|
-
* @
|
|
88
|
+
* @memberof me.TMXObject
|
|
90
89
|
*/
|
|
91
90
|
this.gid = +settings.gid || null;
|
|
92
91
|
|
|
@@ -95,7 +94,7 @@ export default class TMXObject {
|
|
|
95
94
|
* @public
|
|
96
95
|
* @type {string}
|
|
97
96
|
* @name tintcolor
|
|
98
|
-
* @
|
|
97
|
+
* @memberof me.TMXObject
|
|
99
98
|
*/
|
|
100
99
|
this.tintcolor = settings.tintcolor;
|
|
101
100
|
|
|
@@ -104,7 +103,7 @@ export default class TMXObject {
|
|
|
104
103
|
* @public
|
|
105
104
|
* @type {string}
|
|
106
105
|
* @name type
|
|
107
|
-
* @
|
|
106
|
+
* @memberof me.TMXObject
|
|
108
107
|
*/
|
|
109
108
|
this.type = settings.type;
|
|
110
109
|
|
|
@@ -114,7 +113,7 @@ export default class TMXObject {
|
|
|
114
113
|
* @type {object}
|
|
115
114
|
* @see http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#text
|
|
116
115
|
* @name type
|
|
117
|
-
* @
|
|
116
|
+
* @memberof me.TMXObject
|
|
118
117
|
*/
|
|
119
118
|
this.type = settings.type;
|
|
120
119
|
|
|
@@ -123,7 +122,7 @@ export default class TMXObject {
|
|
|
123
122
|
* @public
|
|
124
123
|
* @type {number}
|
|
125
124
|
* @name rotation
|
|
126
|
-
* @
|
|
125
|
+
* @memberof me.TMXObject
|
|
127
126
|
*/
|
|
128
127
|
this.rotation = degToRad(+settings.rotation || 0);
|
|
129
128
|
|
|
@@ -132,7 +131,7 @@ export default class TMXObject {
|
|
|
132
131
|
* @public
|
|
133
132
|
* @type {number}
|
|
134
133
|
* @name id
|
|
135
|
-
* @
|
|
134
|
+
* @memberof me.TMXObject
|
|
136
135
|
*/
|
|
137
136
|
this.id = +settings.id || undefined;
|
|
138
137
|
|
|
@@ -141,7 +140,7 @@ export default class TMXObject {
|
|
|
141
140
|
* @public
|
|
142
141
|
* @type {string}
|
|
143
142
|
* @name orientation
|
|
144
|
-
* @
|
|
143
|
+
* @memberof me.TMXObject
|
|
145
144
|
*/
|
|
146
145
|
this.orientation = map.orientation;
|
|
147
146
|
|
|
@@ -150,7 +149,7 @@ export default class TMXObject {
|
|
|
150
149
|
* @public
|
|
151
150
|
* @type {object[]}
|
|
152
151
|
* @name shapes
|
|
153
|
-
* @
|
|
152
|
+
* @memberof me.TMXObject
|
|
154
153
|
*/
|
|
155
154
|
this.shapes = undefined;
|
|
156
155
|
|
|
@@ -159,7 +158,7 @@ export default class TMXObject {
|
|
|
159
158
|
* @public
|
|
160
159
|
* @type {boolean}
|
|
161
160
|
* @name isEllipse
|
|
162
|
-
* @
|
|
161
|
+
* @memberof me.TMXObject
|
|
163
162
|
*/
|
|
164
163
|
this.isEllipse = false;
|
|
165
164
|
|
|
@@ -168,7 +167,7 @@ export default class TMXObject {
|
|
|
168
167
|
* @public
|
|
169
168
|
* @type {boolean}
|
|
170
169
|
* @name isPolygon
|
|
171
|
-
* @
|
|
170
|
+
* @memberof me.TMXObject
|
|
172
171
|
*/
|
|
173
172
|
this.isPolygon = false;
|
|
174
173
|
|
|
@@ -177,7 +176,7 @@ export default class TMXObject {
|
|
|
177
176
|
* @public
|
|
178
177
|
* @type {boolean}
|
|
179
178
|
* @name isPolyLine
|
|
180
|
-
* @
|
|
179
|
+
* @memberof me.TMXObject
|
|
181
180
|
*/
|
|
182
181
|
this.isPolyLine = false;
|
|
183
182
|
|
|
@@ -249,7 +248,7 @@ export default class TMXObject {
|
|
|
249
248
|
/**
|
|
250
249
|
* parses the TMX shape definition and returns a corresponding array of me.Shape object
|
|
251
250
|
* @name parseTMXShapes
|
|
252
|
-
* @
|
|
251
|
+
* @memberof me.TMXObject
|
|
253
252
|
* @private
|
|
254
253
|
* @function
|
|
255
254
|
* @returns {me.Polygon[]|me.Line[]|me.Ellipse[]} an array of shape objects
|
|
@@ -267,39 +266,46 @@ export default class TMXObject {
|
|
|
267
266
|
this.width,
|
|
268
267
|
this.height
|
|
269
268
|
)).rotate(this.rotation));
|
|
270
|
-
}
|
|
269
|
+
} else {
|
|
271
270
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
271
|
+
// add a polygon
|
|
272
|
+
if (this.isPolygon === true) {
|
|
273
|
+
var _polygon = new Polygon(0, 0, this.points);
|
|
274
|
+
// make sure it's a convex polygon
|
|
275
|
+
if (_polygon.isConvex() === false ) {
|
|
276
|
+
throw new Error("collision polygones in Tiled should be defined as Convex");
|
|
277
|
+
}
|
|
278
|
+
shapes.push(_polygon.rotate(this.rotation));
|
|
279
|
+
}
|
|
276
280
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
281
|
+
// add a polyline
|
|
282
|
+
else if (this.isPolyLine === true) {
|
|
283
|
+
var p = this.points;
|
|
284
|
+
var p1, p2;
|
|
285
|
+
var segments = p.length - 1;
|
|
286
|
+
for (i = 0; i < segments; i++) {
|
|
287
|
+
// clone the value before, as [i + 1]
|
|
288
|
+
// is reused later by the next segment
|
|
289
|
+
p1 = new Vector2d(p[i].x, p[i].y);
|
|
290
|
+
p2 = new Vector2d(p[i + 1].x, p[i + 1].y);
|
|
291
|
+
if (this.rotation !== 0) {
|
|
292
|
+
p1 = p1.rotate(this.rotation);
|
|
293
|
+
p2 = p2.rotate(this.rotation);
|
|
294
|
+
}
|
|
295
|
+
shapes.push(new Line(0, 0, [ p1, p2 ]));
|
|
290
296
|
}
|
|
291
|
-
shapes.push(new Line(0, 0, [ p1, p2 ]));
|
|
292
297
|
}
|
|
293
|
-
}
|
|
294
298
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
// it's a rectangle, returns a polygon object anyway
|
|
300
|
+
else {
|
|
301
|
+
shapes.push((new Polygon(
|
|
302
|
+
0, 0, [
|
|
303
|
+
new Vector2d(), new Vector2d(this.width, 0),
|
|
304
|
+
new Vector2d(this.width, this.height), new Vector2d(0, this.height)
|
|
305
|
+
]
|
|
306
|
+
)).rotate(this.rotation));
|
|
307
|
+
}
|
|
308
|
+
|
|
303
309
|
}
|
|
304
310
|
|
|
305
311
|
// Apply isometric projection
|
|
@@ -11,9 +11,8 @@ var TMX_FLIP_H = 0x80000000,
|
|
|
11
11
|
/**
|
|
12
12
|
* a basic tile object
|
|
13
13
|
* @class
|
|
14
|
-
* @
|
|
15
|
-
* @
|
|
16
|
-
* @constructor
|
|
14
|
+
* @augments me.Bounds
|
|
15
|
+
* @memberof me
|
|
17
16
|
* @param {number} x x index of the Tile in the map
|
|
18
17
|
* @param {number} y y index of the Tile in the map
|
|
19
18
|
* @param {number} gid tile gid
|
|
@@ -14,7 +14,7 @@ import TMXLayer from "./TMXLayer.js";
|
|
|
14
14
|
import { applyTMXProperties } from "./TMXUtils.js";
|
|
15
15
|
import Renderable from "./../../renderable/renderable.js";
|
|
16
16
|
import Container from "./../../renderable/container.js";
|
|
17
|
-
import Rect from "./../../
|
|
17
|
+
import Rect from "./../../geometries/rectangle.js";
|
|
18
18
|
|
|
19
19
|
// constant to identify the collision object layer
|
|
20
20
|
var COLLISION_GROUP = "collision";
|
|
@@ -104,8 +104,7 @@ function readObjectGroup(map, data, z) {
|
|
|
104
104
|
* a TMX Tile Map Object
|
|
105
105
|
* Tiled QT +0.7.x format
|
|
106
106
|
* @class TMXTileMap
|
|
107
|
-
* @
|
|
108
|
-
* @constructor
|
|
107
|
+
* @memberof me
|
|
109
108
|
* @param {string} levelId name of TMX map
|
|
110
109
|
* @param {object} data TMX map in JSON format
|
|
111
110
|
* @example
|
|
@@ -258,7 +257,7 @@ export default class TMXTileMap {
|
|
|
258
257
|
/**
|
|
259
258
|
* Return the map default renderer
|
|
260
259
|
* @name getRenderer
|
|
261
|
-
* @
|
|
260
|
+
* @memberof me.TMXTileMap
|
|
262
261
|
* @public
|
|
263
262
|
* @function
|
|
264
263
|
* @returns {me.TMXRenderer} a TMX renderer
|
|
@@ -8,8 +8,7 @@ import loader from "./../../loader/loader.js";
|
|
|
8
8
|
* @classdesc
|
|
9
9
|
* a TMX Tile Set Object
|
|
10
10
|
* @class TMXTileset
|
|
11
|
-
* @
|
|
12
|
-
* @constructor
|
|
11
|
+
* @memberof me
|
|
13
12
|
* @param {object} tileset tileset data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#tileset})
|
|
14
13
|
*/
|
|
15
14
|
export default class TMXTileset {
|
|
@@ -23,9 +23,8 @@ var offsetsStaggerY = [
|
|
|
23
23
|
* @classdesc
|
|
24
24
|
* an Hexagonal Map Renderder
|
|
25
25
|
* @class TMXHexagonalRenderer
|
|
26
|
-
* @
|
|
27
|
-
* @
|
|
28
|
-
* @constructor
|
|
26
|
+
* @memberof me
|
|
27
|
+
* @augments me.TMXRenderer
|
|
29
28
|
* @param {me.TMXTileMap} map the TMX map
|
|
30
29
|
*/
|
|
31
30
|
class TMXHexagonalRenderer extends TMXRenderer {
|
|
@@ -8,9 +8,8 @@ import TMXLayer from "./../TMXLayer.js";
|
|
|
8
8
|
* @classdesc
|
|
9
9
|
* an Isometric Map Renderder
|
|
10
10
|
* @class TMXIsometricRenderer
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @constructor
|
|
11
|
+
* @memberof me
|
|
12
|
+
* @augments me.TMXRenderer
|
|
14
13
|
* @param {me.TMXTileMap} map the TMX map
|
|
15
14
|
*/
|
|
16
15
|
class TMXIsometricRenderer extends TMXRenderer {
|
|
@@ -6,9 +6,8 @@ import TMXRenderer from "./TMXRenderer.js";
|
|
|
6
6
|
* @classdesc
|
|
7
7
|
* an Orthogonal Map Renderder
|
|
8
8
|
* @class TMXOrthogonalRenderer
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
11
|
-
* @constructor
|
|
9
|
+
* @memberof me
|
|
10
|
+
* @augments me.TMXRenderer
|
|
12
11
|
* @param {me.TMXTileMap} map the TMX map
|
|
13
12
|
*/
|
|
14
13
|
class TMXOrthogonalRenderer extends TMXRenderer {
|
|
@@ -8,8 +8,7 @@ import Bounds from "./../../../physics/Bounds.js";
|
|
|
8
8
|
* @classdesc
|
|
9
9
|
* The map renderer base class
|
|
10
10
|
* @class TMXRenderer
|
|
11
|
-
* @
|
|
12
|
-
* @constructor
|
|
11
|
+
* @memberof me
|
|
13
12
|
* @param {number} cols width of the tilemap in tiles
|
|
14
13
|
* @param {number} rows height of the tilemap in tiles
|
|
15
14
|
* @param {number} tilewidth width of each tile in pixels
|
|
@@ -8,9 +8,8 @@ import { degToRad } from "./../../../math/math.js";
|
|
|
8
8
|
* @classdesc
|
|
9
9
|
* a Staggered Map Renderder
|
|
10
10
|
* @class TMXStaggeredRenderer
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @constructor
|
|
11
|
+
* @memberof me
|
|
12
|
+
* @augments me.TMXHexagonalRenderer
|
|
14
13
|
* @param {me.TMXTileMap} map the TMX map
|
|
15
14
|
*/
|
|
16
15
|
class TMXStaggeredRenderer extends TMXHexagonalRenderer {
|
package/src/loader/loader.js
CHANGED
|
@@ -294,7 +294,7 @@ function preloadJavascript(data, onload, onerror) {
|
|
|
294
294
|
/**
|
|
295
295
|
* a small class to manage loading of stuff and manage resources
|
|
296
296
|
* @namespace loader
|
|
297
|
-
* @
|
|
297
|
+
* @memberof me
|
|
298
298
|
*/
|
|
299
299
|
var loader = {
|
|
300
300
|
|
|
@@ -313,7 +313,7 @@ var loader = {
|
|
|
313
313
|
* @public
|
|
314
314
|
* @function
|
|
315
315
|
* @name onload
|
|
316
|
-
* @
|
|
316
|
+
* @memberof me.loader
|
|
317
317
|
* @example
|
|
318
318
|
* // set a callback when everything is loaded
|
|
319
319
|
* me.loader.onload = this.loaded.bind(this);
|
|
@@ -327,7 +327,7 @@ var loader = {
|
|
|
327
327
|
* @public
|
|
328
328
|
* @function
|
|
329
329
|
* @name onProgress
|
|
330
|
-
* @
|
|
330
|
+
* @memberof me.loader
|
|
331
331
|
* @example
|
|
332
332
|
* // set a callback for progress notification
|
|
333
333
|
* me.loader.onProgress = this.updateProgress.bind(this);
|
|
@@ -343,7 +343,7 @@ var loader = {
|
|
|
343
343
|
* @type {string}
|
|
344
344
|
* @name crossOrigin
|
|
345
345
|
* @default undefined
|
|
346
|
-
* @
|
|
346
|
+
* @memberof me.loader
|
|
347
347
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes
|
|
348
348
|
* @example
|
|
349
349
|
* // allow for cross-origin texture loading in WebGL
|
|
@@ -361,7 +361,7 @@ var loader = {
|
|
|
361
361
|
* @type {boolean}
|
|
362
362
|
* @name withCredentials
|
|
363
363
|
* @default false
|
|
364
|
-
* @
|
|
364
|
+
* @memberof me.loader
|
|
365
365
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
|
|
366
366
|
* @example
|
|
367
367
|
* // enable withCredentials
|
|
@@ -411,7 +411,7 @@ var loader = {
|
|
|
411
411
|
* change the default baseURL for the given asset type.<br>
|
|
412
412
|
* (this will prepend the asset URL and must finish with a '/')
|
|
413
413
|
* @name setBaseURL
|
|
414
|
-
* @
|
|
414
|
+
* @memberof me.loader
|
|
415
415
|
* @public
|
|
416
416
|
* @function
|
|
417
417
|
* @param {string} type "*", "audio", binary", "image", "json", "js", "tmx", "tsx"
|
|
@@ -442,7 +442,7 @@ var loader = {
|
|
|
442
442
|
/**
|
|
443
443
|
* set all the specified game resources to be preloaded.
|
|
444
444
|
* @name preload
|
|
445
|
-
* @
|
|
445
|
+
* @memberof me.loader
|
|
446
446
|
* @public
|
|
447
447
|
* @function
|
|
448
448
|
* @param {object[]} res
|
|
@@ -507,7 +507,7 @@ var loader = {
|
|
|
507
507
|
/**
|
|
508
508
|
* Load a single resource (to be used if you need to load additional resource during the game)
|
|
509
509
|
* @name load
|
|
510
|
-
* @
|
|
510
|
+
* @memberof me.loader
|
|
511
511
|
* @public
|
|
512
512
|
* @function
|
|
513
513
|
* @param {object} res
|
|
@@ -577,12 +577,14 @@ var loader = {
|
|
|
577
577
|
/**
|
|
578
578
|
* unload specified resource to free memory
|
|
579
579
|
* @name unload
|
|
580
|
-
* @
|
|
580
|
+
* @memberof me.loader
|
|
581
581
|
* @public
|
|
582
582
|
* @function
|
|
583
583
|
* @param {object} res
|
|
584
|
+
* @param {string} res.name internal name of the resource
|
|
585
|
+
* @param {string} res.type "audio", binary", "image", "json", "tmx", "tsx"
|
|
584
586
|
* @returns {boolean} true if unloaded
|
|
585
|
-
* @example me.loader.unload({name: "avatar", type:"image"
|
|
587
|
+
* @example me.loader.unload({name: "avatar", type:"image"});
|
|
586
588
|
*/
|
|
587
589
|
unload(res) {
|
|
588
590
|
switch (res.type) {
|
|
@@ -637,7 +639,7 @@ var loader = {
|
|
|
637
639
|
/**
|
|
638
640
|
* unload all resources to free memory
|
|
639
641
|
* @name unloadAll
|
|
640
|
-
* @
|
|
642
|
+
* @memberof me.loader
|
|
641
643
|
* @public
|
|
642
644
|
* @function
|
|
643
645
|
* @example me.loader.unloadAll();
|
|
@@ -692,7 +694,7 @@ var loader = {
|
|
|
692
694
|
/**
|
|
693
695
|
* return the specified TMX/TSX object
|
|
694
696
|
* @name getTMX
|
|
695
|
-
* @
|
|
697
|
+
* @memberof me.loader
|
|
696
698
|
* @public
|
|
697
699
|
* @function
|
|
698
700
|
* @param {string} elt name of the tmx/tsx element ("map1");
|
|
@@ -710,7 +712,7 @@ var loader = {
|
|
|
710
712
|
/**
|
|
711
713
|
* return the specified Binary object
|
|
712
714
|
* @name getBinary
|
|
713
|
-
* @
|
|
715
|
+
* @memberof me.loader
|
|
714
716
|
* @public
|
|
715
717
|
* @function
|
|
716
718
|
* @param {string} elt name of the binary object ("ymTrack");
|
|
@@ -728,7 +730,7 @@ var loader = {
|
|
|
728
730
|
/**
|
|
729
731
|
* return the specified Image Object
|
|
730
732
|
* @name getImage
|
|
731
|
-
* @
|
|
733
|
+
* @memberof me.loader
|
|
732
734
|
* @public
|
|
733
735
|
* @function
|
|
734
736
|
* @param {string} image name of the Image element ("tileset-platformer");
|
|
@@ -747,7 +749,7 @@ var loader = {
|
|
|
747
749
|
/**
|
|
748
750
|
* return the specified JSON Object
|
|
749
751
|
* @name getJSON
|
|
750
|
-
* @
|
|
752
|
+
* @memberof me.loader
|
|
751
753
|
* @public
|
|
752
754
|
* @function
|
|
753
755
|
* @param {string} elt name of the json file to load
|