melonjs 10.2.0 → 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/README.md +1 -1
- package/dist/melonjs.js +4435 -4283
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +3348 -3833
- package/dist/melonjs.module.js +4025 -3920
- package/package.json +13 -14
- package/src/audio/audio.js +45 -45
- package/src/camera/camera2d.js +78 -101
- package/src/entity/draggable.js +21 -29
- package/src/entity/droptarget.js +24 -31
- package/src/entity/entity.js +34 -38
- package/src/game.js +8 -8
- package/src/{shapes → geometries}/ellipse.js +46 -46
- package/src/{shapes → geometries}/line.js +14 -14
- package/src/{shapes → geometries}/poly.js +103 -54
- package/src/{shapes → geometries}/rectangle.js +73 -120
- package/src/index.js +18 -19
- package/src/input/gamepad.js +20 -20
- package/src/input/input.js +3 -3
- package/src/input/keyboard.js +122 -124
- package/src/input/pointer.js +102 -62
- package/src/input/pointerevent.js +97 -42
- package/src/lang/deprecated.js +29 -18
- package/src/level/level.js +34 -26
- package/src/level/tiled/TMXGroup.js +12 -13
- package/src/level/tiled/TMXLayer.js +41 -42
- package/src/level/tiled/TMXObject.js +76 -70
- package/src/level/tiled/TMXTile.js +13 -15
- package/src/level/tiled/TMXTileMap.js +26 -25
- package/src/level/tiled/TMXTileset.js +14 -15
- package/src/level/tiled/TMXTilesetGroup.js +5 -6
- package/src/level/tiled/TMXUtils.js +13 -11
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXRenderer.js +18 -19
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
- package/src/loader/loader.js +46 -40
- package/src/loader/loadingscreen.js +7 -7
- package/src/math/color.js +68 -88
- package/src/math/math.js +33 -33
- package/src/math/matrix2.js +70 -71
- package/src/math/matrix3.js +90 -91
- package/src/math/observable_vector2.js +91 -92
- package/src/math/observable_vector3.js +110 -106
- package/src/math/vector2.js +116 -104
- package/src/math/vector3.js +129 -110
- package/src/particles/emitter.js +116 -126
- package/src/particles/particle.js +4 -5
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +82 -83
- package/src/physics/bounds.js +64 -66
- package/src/physics/collision.js +21 -22
- package/src/physics/detector.js +13 -13
- package/src/physics/quadtree.js +26 -25
- package/src/physics/sat.js +21 -21
- package/src/physics/world.js +23 -22
- package/src/plugin/plugin.js +12 -13
- package/src/renderable/GUI.js +20 -26
- package/src/renderable/collectable.js +6 -7
- package/src/renderable/colorlayer.js +11 -12
- package/src/renderable/container.js +98 -81
- package/src/renderable/imagelayer.js +33 -35
- package/src/renderable/nineslicesprite.js +15 -16
- package/src/renderable/renderable.js +112 -111
- package/src/renderable/sprite.js +71 -58
- package/src/renderable/trigger.js +17 -19
- package/src/state/stage.js +14 -15
- package/src/state/state.js +78 -78
- package/src/system/device.js +137 -180
- package/src/system/event.js +116 -104
- package/src/system/pooling.js +15 -15
- package/src/system/save.js +9 -6
- package/src/system/timer.js +33 -33
- package/src/text/bitmaptext.js +39 -46
- package/src/text/bitmaptextdata.js +14 -15
- package/src/text/text.js +55 -58
- package/src/tweens/easing.js +5 -5
- package/src/tweens/interpolation.js +5 -5
- package/src/tweens/tween.js +49 -40
- package/src/utils/agent.js +12 -11
- package/src/utils/array.js +8 -8
- package/src/utils/file.js +7 -7
- package/src/utils/function.js +8 -8
- package/src/utils/string.js +19 -19
- package/src/utils/utils.js +23 -23
- package/src/video/canvas/canvas_renderer.js +127 -128
- package/src/video/renderer.js +69 -69
- package/src/video/texture.js +80 -82
- package/src/video/texture_cache.js +2 -4
- package/src/video/video.js +38 -38
- package/src/video/webgl/buffer/vertex.js +11 -3
- package/src/video/webgl/glshader.js +31 -32
- package/src/video/webgl/webgl_compositor.js +145 -127
- package/src/video/webgl/webgl_renderer.js +196 -175
|
@@ -76,6 +76,9 @@ function setTMXValue(name, type, value) {
|
|
|
76
76
|
return value;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @ignore
|
|
81
|
+
*/
|
|
79
82
|
function parseAttributes(obj, elt) {
|
|
80
83
|
// do attributes
|
|
81
84
|
if (elt.attributes && elt.attributes.length > 0) {
|
|
@@ -97,9 +100,8 @@ function parseAttributes(obj, elt) {
|
|
|
97
100
|
* @ignore
|
|
98
101
|
* @function
|
|
99
102
|
* @name decompress
|
|
100
|
-
* @param {
|
|
101
|
-
* @param {
|
|
102
|
-
* @return {Number[]} Decompressed data
|
|
103
|
+
* @param {number[]} data Array of bytes
|
|
104
|
+
* @param {string} format compressed data format ("gzip","zlib")
|
|
103
105
|
*/
|
|
104
106
|
export function decompress() {
|
|
105
107
|
throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!");
|
|
@@ -110,8 +112,8 @@ export function decompress() {
|
|
|
110
112
|
* @ignore
|
|
111
113
|
* @function
|
|
112
114
|
* @name decodeCSV
|
|
113
|
-
* @param {
|
|
114
|
-
* @
|
|
115
|
+
* @param {string} input CSV formatted data (only numbers, everything else will be converted to NaN)
|
|
116
|
+
* @returns {number[]} Decoded data
|
|
115
117
|
*/
|
|
116
118
|
export function decodeCSV(input) {
|
|
117
119
|
var entries = input.replace("\n", "").trim().split(",");
|
|
@@ -128,9 +130,9 @@ export function decodeCSV(input) {
|
|
|
128
130
|
* @ignore
|
|
129
131
|
* @function
|
|
130
132
|
* @name decodeBase64AsArray
|
|
131
|
-
* @param {
|
|
132
|
-
* @param {
|
|
133
|
-
* @
|
|
133
|
+
* @param {string} input Base64 encoded data
|
|
134
|
+
* @param {number} [bytes] number of bytes per array entry
|
|
135
|
+
* @returns {Uint32Array} Decoded data
|
|
134
136
|
*/
|
|
135
137
|
export function decodeBase64AsArray(input, bytes) {
|
|
136
138
|
bytes = bytes || 1;
|
|
@@ -149,9 +151,9 @@ export function decodeBase64AsArray(input, bytes) {
|
|
|
149
151
|
};
|
|
150
152
|
|
|
151
153
|
/**
|
|
152
|
-
* Decode the given data
|
|
153
|
-
* @ignore
|
|
154
|
-
*/
|
|
154
|
+
* Decode the given data
|
|
155
|
+
* @ignore
|
|
156
|
+
*/
|
|
155
157
|
export function decode(data, encoding, compression) {
|
|
156
158
|
compression = compression || "none";
|
|
157
159
|
encoding = encoding || "none";
|
|
@@ -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 {
|
|
@@ -85,7 +84,7 @@ class TMXHexagonalRenderer extends TMXRenderer {
|
|
|
85
84
|
* @public
|
|
86
85
|
* @function
|
|
87
86
|
* @param {me.TMXLayer} [layer] calculate the bounding rect for a specific layer (will return a new bounds object)
|
|
88
|
-
* @
|
|
87
|
+
* @returns {me.Bounds}
|
|
89
88
|
*/
|
|
90
89
|
getBounds(layer) {
|
|
91
90
|
var bounds = layer instanceof TMXLayer ? pool.pull("Bounds") : this.bounds;
|
|
@@ -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 {
|
|
@@ -45,7 +44,7 @@ class TMXIsometricRenderer extends TMXRenderer {
|
|
|
45
44
|
* @public
|
|
46
45
|
* @function
|
|
47
46
|
* @param {me.TMXLayer} [layer] calculate the bounding rect for a specific layer (will return a new bounds object)
|
|
48
|
-
* @
|
|
47
|
+
* @returns {me.Bounds}
|
|
49
48
|
*/
|
|
50
49
|
getBounds(layer) {
|
|
51
50
|
var bounds = layer instanceof TMXLayer ? pool.pull("Bounds") : this.bounds;
|
|
@@ -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,12 +8,11 @@ import Bounds from "./../../../physics/Bounds.js";
|
|
|
8
8
|
* @classdesc
|
|
9
9
|
* The map renderer base class
|
|
10
10
|
* @class TMXRenderer
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {Number} tileheight height of each tile in pixels
|
|
11
|
+
* @memberof me
|
|
12
|
+
* @param {number} cols width of the tilemap in tiles
|
|
13
|
+
* @param {number} rows height of the tilemap in tiles
|
|
14
|
+
* @param {number} tilewidth width of each tile in pixels
|
|
15
|
+
* @param {number} tileheight height of each tile in pixels
|
|
17
16
|
*/
|
|
18
17
|
class TMXRenderer {
|
|
19
18
|
|
|
@@ -31,7 +30,7 @@ class TMXRenderer {
|
|
|
31
30
|
* @public
|
|
32
31
|
* @function
|
|
33
32
|
* @param {me.TMXTileMap|me.TMXLayer} component TMX Map or Layer
|
|
34
|
-
* @
|
|
33
|
+
* @returns {boolean}
|
|
35
34
|
*/
|
|
36
35
|
canRender(component) {
|
|
37
36
|
return (
|
|
@@ -52,7 +51,7 @@ class TMXRenderer {
|
|
|
52
51
|
* @public
|
|
53
52
|
* @function
|
|
54
53
|
* @param {me.TMXLayer} [layer] calculate the bounding rect for a specific layer (will return a new bounds object)
|
|
55
|
-
* @
|
|
54
|
+
* @returns {me.Bounds}
|
|
56
55
|
*/
|
|
57
56
|
getBounds(layer) {
|
|
58
57
|
var bounds = layer instanceof TMXLayer ? pool.pull("Bounds") : this.bounds;
|
|
@@ -69,10 +68,10 @@ class TMXRenderer {
|
|
|
69
68
|
* @name me.TMXRenderer#pixelToTileCoords
|
|
70
69
|
* @public
|
|
71
70
|
* @function
|
|
72
|
-
* @param {
|
|
73
|
-
* @param {
|
|
74
|
-
* @param {me.Vector2d} [
|
|
75
|
-
* @
|
|
71
|
+
* @param {number} x X coordinate
|
|
72
|
+
* @param {number} y Y coordinate
|
|
73
|
+
* @param {me.Vector2d} [v] an optional vector object where to put the return values
|
|
74
|
+
* @returns {me.Vector2d}
|
|
76
75
|
*/
|
|
77
76
|
pixelToTileCoords(x, y, v) {
|
|
78
77
|
return v;
|
|
@@ -83,12 +82,12 @@ class TMXRenderer {
|
|
|
83
82
|
* @name me.TMXRenderer#tileToPixelCoords
|
|
84
83
|
* @public
|
|
85
84
|
* @function
|
|
86
|
-
* @param {
|
|
87
|
-
* @param {
|
|
88
|
-
* @param {me.Vector2d} [
|
|
89
|
-
* @
|
|
85
|
+
* @param {number} col tile horizontal position
|
|
86
|
+
* @param {number} row tile vertical position
|
|
87
|
+
* @param {me.Vector2d} [v] an optional vector object where to put the return values
|
|
88
|
+
* @returns {me.Vector2d}
|
|
90
89
|
*/
|
|
91
|
-
tileToPixelCoords(
|
|
90
|
+
tileToPixelCoords(col, row, v) {
|
|
92
91
|
return v;
|
|
93
92
|
}
|
|
94
93
|
|
|
@@ -98,8 +97,8 @@ class TMXRenderer {
|
|
|
98
97
|
* @public
|
|
99
98
|
* @function
|
|
100
99
|
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
|
|
101
|
-
* @param {
|
|
102
|
-
* @param {
|
|
100
|
+
* @param {number} x X coordinate where to draw the tile
|
|
101
|
+
* @param {number} y Y coordinate where to draw the tile
|
|
103
102
|
* @param {me.Tile} tile the tile object to draw
|
|
104
103
|
*/
|
|
105
104
|
drawTile(renderer, x, y, tile) {
|
|
@@ -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
|
@@ -102,6 +102,9 @@ function preloadFontFace(data, onload, onerror) {
|
|
|
102
102
|
* @ignore
|
|
103
103
|
*/
|
|
104
104
|
function preloadTMX(tmxData, onload, onerror) {
|
|
105
|
+
/**
|
|
106
|
+
* @ignore
|
|
107
|
+
*/
|
|
105
108
|
function addToTMXList(data) {
|
|
106
109
|
// set the TMX content
|
|
107
110
|
tmxList[tmxData.name] = data;
|
|
@@ -291,7 +294,7 @@ function preloadJavascript(data, onload, onerror) {
|
|
|
291
294
|
/**
|
|
292
295
|
* a small class to manage loading of stuff and manage resources
|
|
293
296
|
* @namespace loader
|
|
294
|
-
* @
|
|
297
|
+
* @memberof me
|
|
295
298
|
*/
|
|
296
299
|
var loader = {
|
|
297
300
|
|
|
@@ -310,7 +313,7 @@ var loader = {
|
|
|
310
313
|
* @public
|
|
311
314
|
* @function
|
|
312
315
|
* @name onload
|
|
313
|
-
* @
|
|
316
|
+
* @memberof me.loader
|
|
314
317
|
* @example
|
|
315
318
|
* // set a callback when everything is loaded
|
|
316
319
|
* me.loader.onload = this.loaded.bind(this);
|
|
@@ -324,7 +327,7 @@ var loader = {
|
|
|
324
327
|
* @public
|
|
325
328
|
* @function
|
|
326
329
|
* @name onProgress
|
|
327
|
-
* @
|
|
330
|
+
* @memberof me.loader
|
|
328
331
|
* @example
|
|
329
332
|
* // set a callback for progress notification
|
|
330
333
|
* me.loader.onProgress = this.updateProgress.bind(this);
|
|
@@ -337,10 +340,10 @@ var loader = {
|
|
|
337
340
|
* The "anonymous" keyword means that there will be no exchange of user credentials via cookies,
|
|
338
341
|
* client-side SSL certificates or HTTP authentication as described in the Terminology section of the CORS specification.<br>
|
|
339
342
|
* @public
|
|
340
|
-
* @type
|
|
343
|
+
* @type {string}
|
|
341
344
|
* @name crossOrigin
|
|
342
345
|
* @default undefined
|
|
343
|
-
* @
|
|
346
|
+
* @memberof me.loader
|
|
344
347
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes
|
|
345
348
|
* @example
|
|
346
349
|
* // allow for cross-origin texture loading in WebGL
|
|
@@ -355,10 +358,10 @@ var loader = {
|
|
|
355
358
|
* indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies,
|
|
356
359
|
* authorization headers or TLS client certificates. Setting withCredentials has no effect on same-site requests.
|
|
357
360
|
* @public
|
|
358
|
-
* @type
|
|
361
|
+
* @type {boolean}
|
|
359
362
|
* @name withCredentials
|
|
360
363
|
* @default false
|
|
361
|
-
* @
|
|
364
|
+
* @memberof me.loader
|
|
362
365
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
|
|
363
366
|
* @example
|
|
364
367
|
* // enable withCredentials
|
|
@@ -408,11 +411,11 @@ var loader = {
|
|
|
408
411
|
* change the default baseURL for the given asset type.<br>
|
|
409
412
|
* (this will prepend the asset URL and must finish with a '/')
|
|
410
413
|
* @name setBaseURL
|
|
411
|
-
* @
|
|
414
|
+
* @memberof me.loader
|
|
412
415
|
* @public
|
|
413
416
|
* @function
|
|
414
|
-
* @param {
|
|
415
|
-
* @param {
|
|
417
|
+
* @param {string} type "*", "audio", binary", "image", "json", "js", "tmx", "tsx"
|
|
418
|
+
* @param {string} [url="./"] default base URL
|
|
416
419
|
* @example
|
|
417
420
|
* // change the base URL relative address for audio assets
|
|
418
421
|
* me.loader.setBaseURL("audio", "data/audio/");
|
|
@@ -439,15 +442,15 @@ var loader = {
|
|
|
439
442
|
/**
|
|
440
443
|
* set all the specified game resources to be preloaded.
|
|
441
444
|
* @name preload
|
|
442
|
-
* @
|
|
445
|
+
* @memberof me.loader
|
|
443
446
|
* @public
|
|
444
447
|
* @function
|
|
445
|
-
* @param {
|
|
446
|
-
* @param {
|
|
447
|
-
* @param {
|
|
448
|
-
* @param {
|
|
449
|
-
* @param {
|
|
450
|
-
* @param {
|
|
448
|
+
* @param {object[]} res
|
|
449
|
+
* @param {string} res.name internal name of the resource
|
|
450
|
+
* @param {string} res.type "audio", binary", "image", "json","js", "tmx", "tsx", "fontface"
|
|
451
|
+
* @param {string} res.src path and/or file name of the resource (for audio assets only the path is required)
|
|
452
|
+
* @param {boolean} [res.stream] Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
453
|
+
* @param {Function} [onload=me.loader.onload] function to be called when all resources are loaded
|
|
451
454
|
* @param {boolean} [switchToLoadState=true] automatically switch to the loading screen
|
|
452
455
|
* @example
|
|
453
456
|
* game_resources = [
|
|
@@ -504,16 +507,17 @@ var loader = {
|
|
|
504
507
|
/**
|
|
505
508
|
* Load a single resource (to be used if you need to load additional resource during the game)
|
|
506
509
|
* @name load
|
|
507
|
-
* @
|
|
510
|
+
* @memberof me.loader
|
|
508
511
|
* @public
|
|
509
512
|
* @function
|
|
510
|
-
* @param {
|
|
511
|
-
* @param {
|
|
512
|
-
* @param {
|
|
513
|
-
* @param {
|
|
514
|
-
* @param {
|
|
513
|
+
* @param {object} res
|
|
514
|
+
* @param {string} res.name internal name of the resource
|
|
515
|
+
* @param {string} res.type "audio", binary", "image", "json", "tmx", "tsx"
|
|
516
|
+
* @param {string} res.src path and/or file name of the resource (for audio assets only the path is required)
|
|
517
|
+
* @param {boolean} [res.stream] Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
515
518
|
* @param {Function} onload function to be called when the resource is loaded
|
|
516
519
|
* @param {Function} onerror function to be called in case of error
|
|
520
|
+
* @returns {number} the amount of corresponding resource to be preloaded
|
|
517
521
|
* @example
|
|
518
522
|
* // load an image asset
|
|
519
523
|
* me.loader.load({name: "avatar", type:"image", src: "data/avatar.png"}, this.onload.bind(this), this.onerror.bind(this));
|
|
@@ -573,12 +577,14 @@ var loader = {
|
|
|
573
577
|
/**
|
|
574
578
|
* unload specified resource to free memory
|
|
575
579
|
* @name unload
|
|
576
|
-
* @
|
|
580
|
+
* @memberof me.loader
|
|
577
581
|
* @public
|
|
578
582
|
* @function
|
|
579
|
-
* @param {
|
|
580
|
-
* @
|
|
581
|
-
* @
|
|
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"
|
|
586
|
+
* @returns {boolean} true if unloaded
|
|
587
|
+
* @example me.loader.unload({name: "avatar", type:"image"});
|
|
582
588
|
*/
|
|
583
589
|
unload(res) {
|
|
584
590
|
switch (res.type) {
|
|
@@ -633,7 +639,7 @@ var loader = {
|
|
|
633
639
|
/**
|
|
634
640
|
* unload all resources to free memory
|
|
635
641
|
* @name unloadAll
|
|
636
|
-
* @
|
|
642
|
+
* @memberof me.loader
|
|
637
643
|
* @public
|
|
638
644
|
* @function
|
|
639
645
|
* @example me.loader.unloadAll();
|
|
@@ -688,11 +694,11 @@ var loader = {
|
|
|
688
694
|
/**
|
|
689
695
|
* return the specified TMX/TSX object
|
|
690
696
|
* @name getTMX
|
|
691
|
-
* @
|
|
697
|
+
* @memberof me.loader
|
|
692
698
|
* @public
|
|
693
699
|
* @function
|
|
694
|
-
* @param {
|
|
695
|
-
* @
|
|
700
|
+
* @param {string} elt name of the tmx/tsx element ("map1");
|
|
701
|
+
* @returns {object} requested element or null if not found
|
|
696
702
|
*/
|
|
697
703
|
getTMX(elt) {
|
|
698
704
|
// force as string
|
|
@@ -706,11 +712,11 @@ var loader = {
|
|
|
706
712
|
/**
|
|
707
713
|
* return the specified Binary object
|
|
708
714
|
* @name getBinary
|
|
709
|
-
* @
|
|
715
|
+
* @memberof me.loader
|
|
710
716
|
* @public
|
|
711
717
|
* @function
|
|
712
|
-
* @param {
|
|
713
|
-
* @
|
|
718
|
+
* @param {string} elt name of the binary object ("ymTrack");
|
|
719
|
+
* @returns {object} requested element or null if not found
|
|
714
720
|
*/
|
|
715
721
|
getBinary(elt) {
|
|
716
722
|
// force as string
|
|
@@ -724,11 +730,11 @@ var loader = {
|
|
|
724
730
|
/**
|
|
725
731
|
* return the specified Image Object
|
|
726
732
|
* @name getImage
|
|
727
|
-
* @
|
|
733
|
+
* @memberof me.loader
|
|
728
734
|
* @public
|
|
729
735
|
* @function
|
|
730
|
-
* @param {
|
|
731
|
-
* @
|
|
736
|
+
* @param {string} image name of the Image element ("tileset-platformer");
|
|
737
|
+
* @returns {HTMLImageElement} requested element or null if not found
|
|
732
738
|
*/
|
|
733
739
|
getImage(image) {
|
|
734
740
|
// force as string and extract the base name
|
|
@@ -743,11 +749,11 @@ var loader = {
|
|
|
743
749
|
/**
|
|
744
750
|
* return the specified JSON Object
|
|
745
751
|
* @name getJSON
|
|
746
|
-
* @
|
|
752
|
+
* @memberof me.loader
|
|
747
753
|
* @public
|
|
748
754
|
* @function
|
|
749
|
-
* @param {
|
|
750
|
-
* @
|
|
755
|
+
* @param {string} elt name of the json file to load
|
|
756
|
+
* @returns {object}
|
|
751
757
|
*/
|
|
752
758
|
getJSON(elt) {
|
|
753
759
|
// force as string
|
|
@@ -71,9 +71,10 @@ class IconLogo extends Renderable {
|
|
|
71
71
|
super(x, y, 100, 85);
|
|
72
72
|
|
|
73
73
|
this.iconCanvas = createCanvas(
|
|
74
|
-
nextPowerOfTwo(this.width),
|
|
75
|
-
nextPowerOfTwo(this.height),
|
|
76
|
-
|
|
74
|
+
renderer.WebGLVersion > 1 ? this.width : nextPowerOfTwo(this.width),
|
|
75
|
+
renderer.WebGLVersion > 1 ? this.height : nextPowerOfTwo(this.height),
|
|
76
|
+
false
|
|
77
|
+
);
|
|
77
78
|
|
|
78
79
|
var context = renderer.getContext2d(this.iconCanvas);
|
|
79
80
|
|
|
@@ -117,9 +118,8 @@ class IconLogo extends Renderable {
|
|
|
117
118
|
|
|
118
119
|
/**
|
|
119
120
|
* a default loading screen
|
|
120
|
-
* @
|
|
121
|
+
* @memberof me
|
|
121
122
|
* @ignore
|
|
122
|
-
* @constructor
|
|
123
123
|
*/
|
|
124
124
|
class DefaultLoadingScreen extends Stage {
|
|
125
125
|
/**
|
|
@@ -156,7 +156,7 @@ class DefaultLoadingScreen extends Stage {
|
|
|
156
156
|
textAlign: "left",
|
|
157
157
|
textBaseline : "top",
|
|
158
158
|
text: "melon",
|
|
159
|
-
offScreenCanvas:
|
|
159
|
+
offScreenCanvas: renderer.WebGLVersion >= 1
|
|
160
160
|
}
|
|
161
161
|
);
|
|
162
162
|
logo1.anchorPoint.set(0, 0);
|
|
@@ -171,7 +171,7 @@ class DefaultLoadingScreen extends Stage {
|
|
|
171
171
|
textBaseline : "top",
|
|
172
172
|
bold: true,
|
|
173
173
|
text: "JS",
|
|
174
|
-
offScreenCanvas:
|
|
174
|
+
offScreenCanvas: renderer.WebGLVersion >= 1
|
|
175
175
|
}
|
|
176
176
|
);
|
|
177
177
|
logo2.anchorPoint.set(0, 0);
|