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
package/src/system/event.js
CHANGED
|
@@ -3,7 +3,7 @@ import EventEmitter from "eventemitter3";
|
|
|
3
3
|
/**
|
|
4
4
|
* an event system based on nodeJS EventEmitter interface
|
|
5
5
|
* @namespace event
|
|
6
|
-
* @
|
|
6
|
+
* @memberof me
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
// internal instance of the event emiter
|
|
@@ -15,7 +15,7 @@ var eventEmitter = new EventEmitter();
|
|
|
15
15
|
* @constant
|
|
16
16
|
* @type {string}
|
|
17
17
|
* @name BOOT
|
|
18
|
-
* @
|
|
18
|
+
* @memberof me.event
|
|
19
19
|
* @see me.event.on
|
|
20
20
|
*/
|
|
21
21
|
export const BOOT = "me.boot";
|
|
@@ -27,7 +27,7 @@ export const BOOT = "me.boot";
|
|
|
27
27
|
* @constant
|
|
28
28
|
* @type {string}
|
|
29
29
|
* @name STATE_PAUSE
|
|
30
|
-
* @
|
|
30
|
+
* @memberof me.event
|
|
31
31
|
* @see me.event.on
|
|
32
32
|
*/
|
|
33
33
|
export const STATE_PAUSE = "me.state.onPause";
|
|
@@ -39,7 +39,7 @@ export const STATE_PAUSE = "me.state.onPause";
|
|
|
39
39
|
* @constant
|
|
40
40
|
* @type {string}
|
|
41
41
|
* @name STATE_RESUME
|
|
42
|
-
* @
|
|
42
|
+
* @memberof me.event
|
|
43
43
|
* @see me.event.on
|
|
44
44
|
*/
|
|
45
45
|
export const STATE_RESUME = "me.state.onResume";
|
|
@@ -51,7 +51,7 @@ export const STATE_RESUME = "me.state.onResume";
|
|
|
51
51
|
* @constant
|
|
52
52
|
* @type {string}
|
|
53
53
|
* @name STATE_STOP
|
|
54
|
-
* @
|
|
54
|
+
* @memberof me.event
|
|
55
55
|
* @see me.event.on
|
|
56
56
|
*/
|
|
57
57
|
export const STATE_STOP = "me.state.onStop";
|
|
@@ -63,7 +63,7 @@ export const STATE_STOP = "me.state.onStop";
|
|
|
63
63
|
* @constant
|
|
64
64
|
* @type {string}
|
|
65
65
|
* @name STATE_RESTART
|
|
66
|
-
* @
|
|
66
|
+
* @memberof me.event
|
|
67
67
|
* @see me.event.on
|
|
68
68
|
*/
|
|
69
69
|
export const STATE_RESTART = "me.state.onRestart";
|
|
@@ -75,7 +75,7 @@ export const STATE_RESTART = "me.state.onRestart";
|
|
|
75
75
|
* @constant
|
|
76
76
|
* @type {string}
|
|
77
77
|
* @name VIDEO_INIT
|
|
78
|
-
* @
|
|
78
|
+
* @memberof me.event
|
|
79
79
|
* @see me.video.init
|
|
80
80
|
* @see me.event.on
|
|
81
81
|
*/
|
|
@@ -88,7 +88,7 @@ export const VIDEO_INIT = "me.video.onInit";
|
|
|
88
88
|
* @constant
|
|
89
89
|
* @type {string}
|
|
90
90
|
* @name GAME_INIT
|
|
91
|
-
* @
|
|
91
|
+
* @memberof me.event
|
|
92
92
|
* @see me.event.on
|
|
93
93
|
*/
|
|
94
94
|
export const GAME_INIT = "me.game.onInit";
|
|
@@ -100,7 +100,7 @@ export const GAME_INIT = "me.game.onInit";
|
|
|
100
100
|
* @constant
|
|
101
101
|
* @type {string}
|
|
102
102
|
* @name GAME_RESET
|
|
103
|
-
* @
|
|
103
|
+
* @memberof me.event
|
|
104
104
|
* @see me.event.on
|
|
105
105
|
*/
|
|
106
106
|
export const GAME_RESET = "me.game.onReset";
|
|
@@ -112,7 +112,7 @@ export const GAME_RESET = "me.game.onReset";
|
|
|
112
112
|
* @constant
|
|
113
113
|
* @type {string}
|
|
114
114
|
* @name GAME_BEFORE_UPDATE
|
|
115
|
-
* @
|
|
115
|
+
* @memberof me.event
|
|
116
116
|
* @see me.event.on
|
|
117
117
|
*/
|
|
118
118
|
export const GAME_BEFORE_UPDATE = "me.game.beforeUpdate";
|
|
@@ -124,7 +124,7 @@ export const GAME_BEFORE_UPDATE = "me.game.beforeUpdate";
|
|
|
124
124
|
* @constant
|
|
125
125
|
* @type {string}
|
|
126
126
|
* @name GAME_AFTER_UPDATE
|
|
127
|
-
* @
|
|
127
|
+
* @memberof me.event
|
|
128
128
|
* @see me.event.on
|
|
129
129
|
*/
|
|
130
130
|
export const GAME_AFTER_UPDATE = "me.game.afterUpdate";
|
|
@@ -136,7 +136,7 @@ export const GAME_AFTER_UPDATE = "me.game.afterUpdate";
|
|
|
136
136
|
* @constant
|
|
137
137
|
* @type {string}
|
|
138
138
|
* @name GAME_UPDATE
|
|
139
|
-
* @
|
|
139
|
+
* @memberof me.event
|
|
140
140
|
* @see me.event.on
|
|
141
141
|
*/
|
|
142
142
|
export const GAME_UPDATE = "me.game.onUpdate";
|
|
@@ -148,7 +148,7 @@ export const GAME_UPDATE = "me.game.onUpdate";
|
|
|
148
148
|
* @constant
|
|
149
149
|
* @type {string}
|
|
150
150
|
* @name GAME_BEFORE_DRAW
|
|
151
|
-
* @
|
|
151
|
+
* @memberof me.event
|
|
152
152
|
* @see me.event.on
|
|
153
153
|
*/
|
|
154
154
|
export const GAME_BEFORE_DRAW = "me.game.beforeDraw";
|
|
@@ -160,7 +160,7 @@ export const GAME_BEFORE_DRAW = "me.game.beforeDraw";
|
|
|
160
160
|
* @constant
|
|
161
161
|
* @type {string}
|
|
162
162
|
* @name GAME_AFTER_DRAW
|
|
163
|
-
* @
|
|
163
|
+
* @memberof me.event
|
|
164
164
|
* @see me.event.on
|
|
165
165
|
*/
|
|
166
166
|
export const GAME_AFTER_DRAW = "me.game.afterDraw";
|
|
@@ -172,7 +172,7 @@ export const GAME_AFTER_DRAW = "me.game.afterDraw";
|
|
|
172
172
|
* @constant
|
|
173
173
|
* @type {string}
|
|
174
174
|
* @name LEVEL_LOADED
|
|
175
|
-
* @
|
|
175
|
+
* @memberof me.event
|
|
176
176
|
* @see me.event.on
|
|
177
177
|
*/
|
|
178
178
|
export const LEVEL_LOADED = "me.game.onLevelLoaded";
|
|
@@ -184,7 +184,7 @@ export const LEVEL_LOADED = "me.game.onLevelLoaded";
|
|
|
184
184
|
* @constant
|
|
185
185
|
* @type {string}
|
|
186
186
|
* @name LOADER_COMPLETE
|
|
187
|
-
* @
|
|
187
|
+
* @memberof me.event
|
|
188
188
|
* @see me.event.on
|
|
189
189
|
*/
|
|
190
190
|
export const LOADER_COMPLETE = "me.loader.onload";
|
|
@@ -196,7 +196,7 @@ export const LOADER_COMPLETE = "me.loader.onload";
|
|
|
196
196
|
* @constant
|
|
197
197
|
* @type {string}
|
|
198
198
|
* @name LOADER_PROGRESS
|
|
199
|
-
* @
|
|
199
|
+
* @memberof me.event
|
|
200
200
|
* @see me.event.on
|
|
201
201
|
*/
|
|
202
202
|
export const LOADER_PROGRESS = "me.loader.onProgress";
|
|
@@ -213,7 +213,7 @@ export const LOADER_PROGRESS = "me.loader.onProgress";
|
|
|
213
213
|
* @constant
|
|
214
214
|
* @type {string}
|
|
215
215
|
* @name KEYDOWN
|
|
216
|
-
* @
|
|
216
|
+
* @memberof me.event
|
|
217
217
|
* @see me.event.on
|
|
218
218
|
* @example
|
|
219
219
|
* me.input.bindKey(me.input.KEY.X, "jump", true); // Edge-triggered
|
|
@@ -239,7 +239,7 @@ export const KEYDOWN = "me.input.keydown";
|
|
|
239
239
|
* @constant
|
|
240
240
|
* @type {string}
|
|
241
241
|
* @name KEYUP
|
|
242
|
-
* @
|
|
242
|
+
* @memberof me.event
|
|
243
243
|
* @see me.event.on
|
|
244
244
|
* @example
|
|
245
245
|
* me.event.on(me.event.KEYUP, (action, keyCode) => {
|
|
@@ -263,7 +263,7 @@ export const KEYUP = "me.input.keyup";
|
|
|
263
263
|
* @constant
|
|
264
264
|
* @type {string}
|
|
265
265
|
* @name GAMEPAD_CONNECTED
|
|
266
|
-
* @
|
|
266
|
+
* @memberof me.event
|
|
267
267
|
* @see me.event.on
|
|
268
268
|
*/
|
|
269
269
|
export const GAMEPAD_CONNECTED = "gamepad.connected";
|
|
@@ -275,7 +275,7 @@ export const GAMEPAD_CONNECTED = "gamepad.connected";
|
|
|
275
275
|
* @constant
|
|
276
276
|
* @type {string}
|
|
277
277
|
* @name GAMEPAD_DISCONNECTED
|
|
278
|
-
* @
|
|
278
|
+
* @memberof me.event
|
|
279
279
|
* @see me.event.on
|
|
280
280
|
*/
|
|
281
281
|
export const GAMEPAD_DISCONNECTED = "gamepad.disconnected";
|
|
@@ -291,7 +291,7 @@ export const GAMEPAD_DISCONNECTED = "gamepad.disconnected";
|
|
|
291
291
|
* @constant
|
|
292
292
|
* @type {string}
|
|
293
293
|
* @name GAMEPAD_UPDATE
|
|
294
|
-
* @
|
|
294
|
+
* @memberof me.event
|
|
295
295
|
* @see me.event.on
|
|
296
296
|
*/
|
|
297
297
|
export const GAMEPAD_UPDATE = "gamepad.update";
|
|
@@ -303,11 +303,23 @@ export const GAMEPAD_UPDATE = "gamepad.update";
|
|
|
303
303
|
* @constant
|
|
304
304
|
* @type {string}
|
|
305
305
|
* @name POINTERMOVE
|
|
306
|
-
* @
|
|
306
|
+
* @memberof me.event
|
|
307
307
|
* @see me.event.on
|
|
308
308
|
*/
|
|
309
309
|
export const POINTERMOVE = "me.event.pointermove";
|
|
310
310
|
|
|
311
|
+
/**
|
|
312
|
+
* Event for onPointerLockChange event <br>
|
|
313
|
+
* Data passed : {boolean} pointer lock status (true/false)
|
|
314
|
+
* @public
|
|
315
|
+
* @constant
|
|
316
|
+
* @type {string}
|
|
317
|
+
* @name POINTERLOCKCHANGE
|
|
318
|
+
* @memberof me.event
|
|
319
|
+
* @see me.event.on
|
|
320
|
+
*/
|
|
321
|
+
export const POINTERLOCKCHANGE = "me.event.pointerlockChange";
|
|
322
|
+
|
|
311
323
|
/**
|
|
312
324
|
* Event for dragstart events on a Draggable entity <br>
|
|
313
325
|
* Data passed:
|
|
@@ -317,7 +329,7 @@ export const POINTERMOVE = "me.event.pointermove";
|
|
|
317
329
|
* @constant
|
|
318
330
|
* @type {string}
|
|
319
331
|
* @name DRAGSTART
|
|
320
|
-
* @
|
|
332
|
+
* @memberof me.event
|
|
321
333
|
* @see me.event.on
|
|
322
334
|
*/
|
|
323
335
|
export const DRAGSTART = "me.game.dragstart";
|
|
@@ -331,7 +343,7 @@ export const DRAGSTART = "me.game.dragstart";
|
|
|
331
343
|
* @constant
|
|
332
344
|
* @type {string}
|
|
333
345
|
* @name DRAGEND
|
|
334
|
-
* @
|
|
346
|
+
* @memberof me.event
|
|
335
347
|
* @see me.event.on
|
|
336
348
|
*/
|
|
337
349
|
export const DRAGEND = "me.game.dragend";
|
|
@@ -343,7 +355,7 @@ export const DRAGEND = "me.game.dragend";
|
|
|
343
355
|
* @constant
|
|
344
356
|
* @type {string}
|
|
345
357
|
* @name WINDOW_ONRESIZE
|
|
346
|
-
* @
|
|
358
|
+
* @memberof me.event
|
|
347
359
|
* @see me.event.on
|
|
348
360
|
*/
|
|
349
361
|
export const WINDOW_ONRESIZE = "window.onresize";
|
|
@@ -357,7 +369,7 @@ export const WINDOW_ONRESIZE = "window.onresize";
|
|
|
357
369
|
* @constant
|
|
358
370
|
* @type {string}
|
|
359
371
|
* @name CANVAS_ONRESIZE
|
|
360
|
-
* @
|
|
372
|
+
* @memberof me.event
|
|
361
373
|
* @see me.event.on
|
|
362
374
|
*/
|
|
363
375
|
export const CANVAS_ONRESIZE = "canvas.onresize";
|
|
@@ -371,7 +383,7 @@ export const CANVAS_ONRESIZE = "canvas.onresize";
|
|
|
371
383
|
* @constant
|
|
372
384
|
* @type {string}
|
|
373
385
|
* @name VIEWPORT_ONRESIZE
|
|
374
|
-
* @
|
|
386
|
+
* @memberof me.event
|
|
375
387
|
* @see me.event.on
|
|
376
388
|
*/
|
|
377
389
|
export const VIEWPORT_ONRESIZE = "viewport.onresize";
|
|
@@ -383,7 +395,7 @@ export const VIEWPORT_ONRESIZE = "viewport.onresize";
|
|
|
383
395
|
* @constant
|
|
384
396
|
* @type {string}
|
|
385
397
|
* @name WINDOW_ONORIENTATION_CHANGE
|
|
386
|
-
* @
|
|
398
|
+
* @memberof me.event
|
|
387
399
|
* @see me.event.on
|
|
388
400
|
*/
|
|
389
401
|
export const WINDOW_ONORIENTATION_CHANGE = "window.orientationchange";
|
|
@@ -395,7 +407,7 @@ export const WINDOW_ONORIENTATION_CHANGE = "window.orientationchange";
|
|
|
395
407
|
* @constant
|
|
396
408
|
* @type {string}
|
|
397
409
|
* @name WINDOW_ONSCROLL
|
|
398
|
-
* @
|
|
410
|
+
* @memberof me.event
|
|
399
411
|
* @see me.event.on
|
|
400
412
|
*/
|
|
401
413
|
export const WINDOW_ONSCROLL = "window.onscroll";
|
|
@@ -407,7 +419,7 @@ export const WINDOW_ONSCROLL = "window.onscroll";
|
|
|
407
419
|
* @constant
|
|
408
420
|
* @type {string}
|
|
409
421
|
* @name VIEWPORT_ONCHANGE
|
|
410
|
-
* @
|
|
422
|
+
* @memberof me.event
|
|
411
423
|
* @see me.event.on
|
|
412
424
|
*/
|
|
413
425
|
export const VIEWPORT_ONCHANGE = "viewport.onchange";
|
|
@@ -419,7 +431,7 @@ export const VIEWPORT_ONCHANGE = "viewport.onchange";
|
|
|
419
431
|
* @constant
|
|
420
432
|
* @type {string}
|
|
421
433
|
* @name WEBGL_ONCONTEXT_LOST
|
|
422
|
-
* @
|
|
434
|
+
* @memberof me.event
|
|
423
435
|
* @see me.event.on
|
|
424
436
|
*/
|
|
425
437
|
export const WEBGL_ONCONTEXT_LOST = "renderer.webglcontextlost";
|
|
@@ -431,7 +443,7 @@ export const WEBGL_ONCONTEXT_LOST = "renderer.webglcontextlost";
|
|
|
431
443
|
* @constant
|
|
432
444
|
* @type {string}
|
|
433
445
|
* @name WEBGL_ONCONTEXT_RESTORED
|
|
434
|
-
* @
|
|
446
|
+
* @memberof me.event
|
|
435
447
|
* @see me.event.on
|
|
436
448
|
*/
|
|
437
449
|
export const WEBGL_ONCONTEXT_RESTORED = "renderer.webglcontextrestored";
|
package/src/system/pooling.js
CHANGED
package/src/system/save.js
CHANGED
|
@@ -30,7 +30,7 @@ import * as event from "./../system/event.js";
|
|
|
30
30
|
* // Remove "lives" from localStorage
|
|
31
31
|
* me.save.remove("lives");
|
|
32
32
|
* @namespace me.save
|
|
33
|
-
* @
|
|
33
|
+
* @memberof me
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
// Variable to hold the object data
|
|
@@ -65,7 +65,7 @@ var save = {
|
|
|
65
65
|
/**
|
|
66
66
|
* Add new keys to localStorage and set them to the given default values if they do not exist
|
|
67
67
|
* @name add
|
|
68
|
-
* @
|
|
68
|
+
* @memberof me.save
|
|
69
69
|
* @function
|
|
70
70
|
* @param {object} props key and corresponding values
|
|
71
71
|
* @example
|
|
@@ -119,7 +119,7 @@ var save = {
|
|
|
119
119
|
/**
|
|
120
120
|
* Remove a key from localStorage
|
|
121
121
|
* @name remove
|
|
122
|
-
* @
|
|
122
|
+
* @memberof me.save
|
|
123
123
|
* @function
|
|
124
124
|
* @param {string} key key to be removed
|
|
125
125
|
* @example
|
package/src/system/timer.js
CHANGED
|
@@ -88,7 +88,7 @@ event.on(event.BOOT, () => {
|
|
|
88
88
|
/**
|
|
89
89
|
* a Timer class to manage timing related function (FPS, Game Tick, Time...)
|
|
90
90
|
* @namespace me.timer
|
|
91
|
-
* @
|
|
91
|
+
* @memberof me
|
|
92
92
|
*/
|
|
93
93
|
var timer = {
|
|
94
94
|
|
|
@@ -102,7 +102,7 @@ var timer = {
|
|
|
102
102
|
* @see me.timer.interpolation
|
|
103
103
|
* @type {number}
|
|
104
104
|
* @name tick
|
|
105
|
-
* @
|
|
105
|
+
* @memberof me.timer
|
|
106
106
|
*/
|
|
107
107
|
tick : 1.0,
|
|
108
108
|
|
|
@@ -112,7 +112,7 @@ var timer = {
|
|
|
112
112
|
* @public
|
|
113
113
|
* @type {number}
|
|
114
114
|
* @name fps
|
|
115
|
-
* @
|
|
115
|
+
* @memberof me.timer
|
|
116
116
|
*/
|
|
117
117
|
fps : 0,
|
|
118
118
|
|
|
@@ -123,7 +123,7 @@ var timer = {
|
|
|
123
123
|
* @type {number}
|
|
124
124
|
* @name maxfps
|
|
125
125
|
* @default 60
|
|
126
|
-
* @
|
|
126
|
+
* @memberof me.timer
|
|
127
127
|
*/
|
|
128
128
|
maxfps : 60,
|
|
129
129
|
|
|
@@ -133,14 +133,14 @@ var timer = {
|
|
|
133
133
|
* @type {boolean}
|
|
134
134
|
* @default false
|
|
135
135
|
* @name interpolation
|
|
136
|
-
* @
|
|
136
|
+
* @memberof me.timer
|
|
137
137
|
*/
|
|
138
138
|
interpolation : false,
|
|
139
139
|
|
|
140
140
|
/**
|
|
141
141
|
* reset time (e.g. usefull in case of pause)
|
|
142
142
|
* @name reset
|
|
143
|
-
* @
|
|
143
|
+
* @memberof me.timer
|
|
144
144
|
* @ignore
|
|
145
145
|
* @function
|
|
146
146
|
*/
|
|
@@ -159,7 +159,7 @@ var timer = {
|
|
|
159
159
|
/**
|
|
160
160
|
* Calls a function once after a specified delay. See me.timer.setInterval to repeativly call a function.
|
|
161
161
|
* @name setTimeout
|
|
162
|
-
* @
|
|
162
|
+
* @memberof me.timer
|
|
163
163
|
* @param {Function} fn the function you want to execute after delay milliseconds.
|
|
164
164
|
* @param {number} delay the number of milliseconds (thousandths of a second) that the function call should be delayed by.
|
|
165
165
|
* @param {boolean} [pauseable=true] respects the pause state of the engine.
|
|
@@ -188,7 +188,7 @@ var timer = {
|
|
|
188
188
|
/**
|
|
189
189
|
* Calls a function continously at the specified interval. See setTimeout to call function a single time.
|
|
190
190
|
* @name setInterval
|
|
191
|
-
* @
|
|
191
|
+
* @memberof me.timer
|
|
192
192
|
* @param {Function} fn the function to execute
|
|
193
193
|
* @param {number} delay the number of milliseconds (thousandths of a second) on how often to execute the function
|
|
194
194
|
* @param {boolean} [pauseable=true] respects the pause state of the engine.
|
|
@@ -217,7 +217,7 @@ var timer = {
|
|
|
217
217
|
/**
|
|
218
218
|
* Clears the delay set by me.timer.setTimeout().
|
|
219
219
|
* @name clearTimeout
|
|
220
|
-
* @
|
|
220
|
+
* @memberof me.timer
|
|
221
221
|
* @function
|
|
222
222
|
* @param {number} timeoutID ID of the timeout to be cleared
|
|
223
223
|
*/
|
|
@@ -228,7 +228,7 @@ var timer = {
|
|
|
228
228
|
/**
|
|
229
229
|
* Clears the Interval set by me.timer.setInterval().
|
|
230
230
|
* @name clearInterval
|
|
231
|
-
* @
|
|
231
|
+
* @memberof me.timer
|
|
232
232
|
* @function
|
|
233
233
|
* @param {number} intervalID ID of the interval to be cleared
|
|
234
234
|
*/
|
|
@@ -240,7 +240,7 @@ var timer = {
|
|
|
240
240
|
* Return the current timestamp in milliseconds <br>
|
|
241
241
|
* since the game has started or since linux epoch (based on browser support for High Resolution Timer)
|
|
242
242
|
* @name getTime
|
|
243
|
-
* @
|
|
243
|
+
* @memberof me.timer
|
|
244
244
|
* @returns {number}
|
|
245
245
|
* @function
|
|
246
246
|
*/
|
|
@@ -251,7 +251,7 @@ var timer = {
|
|
|
251
251
|
/**
|
|
252
252
|
* Return elapsed time in milliseconds since the last update
|
|
253
253
|
* @name getDelta
|
|
254
|
-
* @
|
|
254
|
+
* @memberof me.timer
|
|
255
255
|
* @returns {number}
|
|
256
256
|
* @function
|
|
257
257
|
*/
|
|
@@ -263,7 +263,7 @@ var timer = {
|
|
|
263
263
|
* compute the actual frame time and fps rate
|
|
264
264
|
* @name computeFPS
|
|
265
265
|
* @ignore
|
|
266
|
-
* @
|
|
266
|
+
* @memberof me.timer
|
|
267
267
|
* @function
|
|
268
268
|
*/
|
|
269
269
|
countFPS() {
|
package/src/text/bitmaptext.js
CHANGED
|
@@ -35,9 +35,8 @@ var measureTextHeight = function(font) {
|
|
|
35
35
|
* @classdesc
|
|
36
36
|
* a bitmap font object
|
|
37
37
|
* @class BitmapText
|
|
38
|
-
* @
|
|
39
|
-
* @
|
|
40
|
-
* @constructor
|
|
38
|
+
* @augments me.Renderable
|
|
39
|
+
* @memberof me
|
|
41
40
|
* @param {number} x position of the text object
|
|
42
41
|
* @param {number} y position of the text object
|
|
43
42
|
* @param {object} settings the text configuration
|
|
@@ -80,7 +79,7 @@ class BitmapText extends Renderable {
|
|
|
80
79
|
* @type {string}
|
|
81
80
|
* @default "left"
|
|
82
81
|
* @name textAlign
|
|
83
|
-
* @
|
|
82
|
+
* @memberof me.BitmapText
|
|
84
83
|
*/
|
|
85
84
|
this.textAlign = settings.textAlign || "left";
|
|
86
85
|
|
|
@@ -91,7 +90,7 @@ class BitmapText extends Renderable {
|
|
|
91
90
|
* @type {string}
|
|
92
91
|
* @default "top"
|
|
93
92
|
* @name textBaseline
|
|
94
|
-
* @
|
|
93
|
+
* @memberof me.BitmapText
|
|
95
94
|
*/
|
|
96
95
|
this.textBaseline = settings.textBaseline || "top";
|
|
97
96
|
|
|
@@ -102,7 +101,7 @@ class BitmapText extends Renderable {
|
|
|
102
101
|
* @type {number}
|
|
103
102
|
* @default 1.0
|
|
104
103
|
* @name lineHeight
|
|
105
|
-
* @
|
|
104
|
+
* @memberof me.BitmapText
|
|
106
105
|
*/
|
|
107
106
|
this.lineHeight = settings.lineHeight || 1.0;
|
|
108
107
|
|
|
@@ -111,7 +110,7 @@ class BitmapText extends Renderable {
|
|
|
111
110
|
* @private
|
|
112
111
|
* @type {string[]}
|
|
113
112
|
* @name _text
|
|
114
|
-
* @
|
|
113
|
+
* @memberof me.BitmapText
|
|
115
114
|
*/
|
|
116
115
|
this._text = [];
|
|
117
116
|
|
|
@@ -166,7 +165,7 @@ class BitmapText extends Renderable {
|
|
|
166
165
|
/**
|
|
167
166
|
* change the font settings
|
|
168
167
|
* @name set
|
|
169
|
-
* @
|
|
168
|
+
* @memberof me.BitmapText.prototype
|
|
170
169
|
* @function
|
|
171
170
|
* @param {string} textAlign ("left", "center", "right")
|
|
172
171
|
* @param {number} [scale]
|
|
@@ -186,7 +185,7 @@ class BitmapText extends Renderable {
|
|
|
186
185
|
/**
|
|
187
186
|
* change the text to be displayed
|
|
188
187
|
* @name setText
|
|
189
|
-
* @
|
|
188
|
+
* @memberof me.BitmapText.prototype
|
|
190
189
|
* @function
|
|
191
190
|
* @param {number|string|string[]} value a string, or an array of strings
|
|
192
191
|
* @returns {me.BitmapText} this object for chaining
|
|
@@ -214,7 +213,7 @@ class BitmapText extends Renderable {
|
|
|
214
213
|
* @type {me.Color}
|
|
215
214
|
* @name fillStyle
|
|
216
215
|
* @see me.Renderable#tint
|
|
217
|
-
* @
|
|
216
|
+
* @memberof me.BitmapText
|
|
218
217
|
*/
|
|
219
218
|
get fillStyle() {
|
|
220
219
|
return this.tint;
|
|
@@ -226,7 +225,7 @@ class BitmapText extends Renderable {
|
|
|
226
225
|
/**
|
|
227
226
|
* change the font display size
|
|
228
227
|
* @name resize
|
|
229
|
-
* @
|
|
228
|
+
* @memberof me.BitmapText.prototype
|
|
230
229
|
* @function
|
|
231
230
|
* @param {number} scale ratio
|
|
232
231
|
* @returns {me.BitmapText} this object for chaining
|
|
@@ -242,7 +241,7 @@ class BitmapText extends Renderable {
|
|
|
242
241
|
/**
|
|
243
242
|
* measure the given text size in pixels
|
|
244
243
|
* @name measureText
|
|
245
|
-
* @
|
|
244
|
+
* @memberof me.BitmapText.prototype
|
|
246
245
|
* @function
|
|
247
246
|
* @param {string} [text]
|
|
248
247
|
* @param {me.Rect} [ret] a object in which to store the text metrics
|
|
@@ -277,7 +276,7 @@ class BitmapText extends Renderable {
|
|
|
277
276
|
/**
|
|
278
277
|
* draw the bitmap font
|
|
279
278
|
* @name draw
|
|
280
|
-
* @
|
|
279
|
+
* @memberof me.BitmapText.prototype
|
|
281
280
|
* @function
|
|
282
281
|
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer Reference to the destination renderer instance
|
|
283
282
|
* @param {string} [text]
|
|
@@ -20,7 +20,7 @@ function getValueFromPair(string, pattern) {
|
|
|
20
20
|
* Gets the first glyph in the map that is not a space character
|
|
21
21
|
* @ignore
|
|
22
22
|
* @name _getFirstGlyph
|
|
23
|
-
* @
|
|
23
|
+
* @memberof me.BitmapTextData
|
|
24
24
|
* @function
|
|
25
25
|
* @param {object} glyphs the map of glyphs, each key is a char code
|
|
26
26
|
* @returns {me.Glyph}
|
|
@@ -39,7 +39,7 @@ function getFirstGlyph(glyphs) {
|
|
|
39
39
|
* Creates a glyph to use for the space character
|
|
40
40
|
* @ignore
|
|
41
41
|
* @name createSpaceGlyph
|
|
42
|
-
* @
|
|
42
|
+
* @memberof me.BitmapTextData
|
|
43
43
|
* @function
|
|
44
44
|
* @param {object} glyphs the map of glyphs, each key is a char code
|
|
45
45
|
*/
|
|
@@ -59,10 +59,9 @@ function createSpaceGlyph(glyphs) {
|
|
|
59
59
|
/**
|
|
60
60
|
* Class for storing relevant data from the font file.
|
|
61
61
|
* @class me.BitmapTextData
|
|
62
|
-
* @
|
|
62
|
+
* @memberof me
|
|
63
63
|
* @ignore
|
|
64
64
|
* @param data {string} - The bitmap font data pulled from the resource loader using me.loader.getBinary()
|
|
65
|
-
* @constructor
|
|
66
65
|
*/
|
|
67
66
|
class BitmapTextData {
|
|
68
67
|
|
|
@@ -89,7 +88,7 @@ class BitmapTextData {
|
|
|
89
88
|
* The map of glyphs, each key is a char code.
|
|
90
89
|
* @name glyphs
|
|
91
90
|
* @type {object}
|
|
92
|
-
* @
|
|
91
|
+
* @memberof me.BitmapTextData
|
|
93
92
|
*/
|
|
94
93
|
this.glyphs = {};
|
|
95
94
|
|
|
@@ -100,7 +99,7 @@ class BitmapTextData {
|
|
|
100
99
|
/**
|
|
101
100
|
* This parses the font data text and builds a map of glyphs containing the data for each character
|
|
102
101
|
* @name parse
|
|
103
|
-
* @
|
|
102
|
+
* @memberof me.BitmapTextData
|
|
104
103
|
* @function
|
|
105
104
|
* @param {string} fontData
|
|
106
105
|
*/
|