melonjs 11.0.0 → 13.1.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/LICENSE.md +1 -1
- package/README.md +6 -6
- package/dist/melonjs.js +22854 -22604
- package/dist/melonjs.min.js +5 -6
- package/dist/melonjs.module.d.ts +289 -284
- package/dist/melonjs.module.js +22427 -22175
- package/package.json +16 -16
- package/src/application/application.js +231 -0
- package/src/audio/audio.js +13 -7
- package/src/camera/camera2d.js +6 -6
- package/src/game.js +9 -232
- package/src/index.js +3 -3
- package/src/input/keyboard.js +2 -2
- package/src/input/pointer.js +4 -5
- package/src/input/pointerevent.js +10 -10
- package/src/lang/deprecated.js +27 -30
- package/src/level/level.js +2 -2
- package/src/level/tiled/TMXGroup.js +10 -0
- package/src/level/tiled/TMXLayer.js +11 -2
- package/src/level/tiled/TMXObject.js +13 -2
- package/src/level/tiled/TMXTileMap.js +15 -3
- package/src/level/tiled/TMXTileset.js +8 -0
- package/src/loader/loader.js +64 -28
- package/src/loader/loadingscreen.js +28 -115
- package/src/loader/melonjs_logo.png +0 -0
- package/src/math/color.js +62 -42
- package/src/math/observable_vector2.js +26 -2
- package/src/math/observable_vector3.js +32 -4
- package/src/math/vector2.js +23 -0
- package/src/math/vector3.js +26 -0
- package/src/physics/body.js +27 -51
- package/src/physics/detector.js +3 -3
- package/src/physics/quadtree.js +58 -29
- package/src/physics/world.js +32 -3
- package/src/polyfill/index.js +4 -0
- package/src/renderable/container.js +2 -2
- package/src/renderable/imagelayer.js +8 -8
- package/src/renderable/nineslicesprite.js +27 -1
- package/src/renderable/trigger.js +4 -4
- package/src/state/stage.js +1 -1
- package/src/state/state.js +50 -3
- package/src/system/device.js +814 -981
- package/src/system/event.js +2 -1
- package/src/system/platform.js +32 -0
- package/src/system/save.js +23 -14
- package/src/system/timer.js +12 -35
- package/src/text/bitmaptext.js +1 -2
- package/src/text/text.js +10 -14
- package/src/text/textmetrics.js +1 -2
- package/src/tweens/tween.js +6 -6
- package/src/utils/string.js +13 -24
- package/src/video/canvas/canvas_renderer.js +30 -65
- package/src/video/renderer.js +23 -30
- package/src/video/texture/canvas_texture.js +39 -3
- package/src/video/video.js +27 -25
- package/src/video/webgl/glshader.js +1 -1
- package/src/video/webgl/webgl_compositor.js +2 -2
- package/src/video/webgl/webgl_renderer.js +8 -20
package/dist/melonjs.module.d.ts
CHANGED
|
@@ -234,22 +234,24 @@ export class Body {
|
|
|
234
234
|
*/
|
|
235
235
|
public collisionType: number;
|
|
236
236
|
/**
|
|
237
|
-
*
|
|
237
|
+
* The current velocity of the body.
|
|
238
|
+
* See to apply a force if you need to modify a body velocity
|
|
239
|
+
* @see Body.force
|
|
238
240
|
* @public
|
|
239
241
|
* @type {Vector2d}
|
|
240
242
|
* @default <0,0>
|
|
241
243
|
*/
|
|
242
244
|
public vel: Vector2d;
|
|
243
245
|
/**
|
|
244
|
-
* body force
|
|
245
|
-
*
|
|
246
|
+
* body force to apply to this the body in the current step.
|
|
247
|
+
* (any positive or negative force will be cancelled after every world/body update cycle)
|
|
246
248
|
* @public
|
|
247
249
|
* @type {Vector2d}
|
|
248
250
|
* @default <0,0>
|
|
249
251
|
* @see Body.setMaxVelocity
|
|
250
252
|
* @example
|
|
251
253
|
* // define a default maximum acceleration, initial force and friction
|
|
252
|
-
* this.body.force.set(
|
|
254
|
+
* this.body.force.set(1, 0);
|
|
253
255
|
* this.body.friction.set(0.4, 0);
|
|
254
256
|
* this.body.setMaxVelocity(3, 15);
|
|
255
257
|
*
|
|
@@ -259,8 +261,6 @@ export class Body {
|
|
|
259
261
|
* this.body.force.x = -this.body.maxVel.x;
|
|
260
262
|
* } else if (me.input.isKeyPressed("right")) {
|
|
261
263
|
* this.body.force.x = this.body.maxVel.x;
|
|
262
|
-
* } else {
|
|
263
|
-
* this.body.force.x = 0;
|
|
264
264
|
* }
|
|
265
265
|
* }
|
|
266
266
|
*/
|
|
@@ -486,23 +486,14 @@ export class Body {
|
|
|
486
486
|
* @param {number} y vertical friction
|
|
487
487
|
*/
|
|
488
488
|
setFriction(x?: number, y?: number): void;
|
|
489
|
-
/**
|
|
490
|
-
* compute the new velocity value
|
|
491
|
-
* @ignore
|
|
492
|
-
*/
|
|
493
|
-
computeVelocity(): void;
|
|
494
489
|
/**
|
|
495
490
|
* Updates the parent's position as well as computes the new body's velocity based
|
|
496
|
-
* on the values of force/friction
|
|
491
|
+
* on the values of force/friction. Velocity chages are proportional to the
|
|
497
492
|
* me.timer.tick value (which can be used to scale velocities). The approach to moving the
|
|
498
493
|
* parent renderable is to compute new values of the Body.vel property then add them to
|
|
499
494
|
* the parent.pos value thus changing the postion the amount of Body.vel each time the
|
|
500
495
|
* update call is made. <br>
|
|
501
496
|
* Updates to Body.vel are bounded by maxVel (which defaults to viewport size if not set) <br>
|
|
502
|
-
*
|
|
503
|
-
* In addition, when the gravity calcuation is made, if the Body.vel.y > 0 then the Body.falling
|
|
504
|
-
* property is set to true and Body.jumping is set to !Body.falling.
|
|
505
|
-
*
|
|
506
497
|
* At this time a call to Body.Update does not call the onBodyUpdate callback that is listed in the constructor arguments.
|
|
507
498
|
* @protected
|
|
508
499
|
* @param {number} dt time since the last update in milliseconds.
|
|
@@ -1058,7 +1049,6 @@ export class CanvasRenderer extends Renderer {
|
|
|
1058
1049
|
* @param {number} options.width The width of the canvas without scaling
|
|
1059
1050
|
* @param {number} options.height The height of the canvas without scaling
|
|
1060
1051
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
1061
|
-
* @param {boolean} [options.doubleBuffering=false] Whether to enable double buffering
|
|
1062
1052
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
|
|
1063
1053
|
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
|
|
1064
1054
|
* @param {boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
|
|
@@ -1070,7 +1060,6 @@ export class CanvasRenderer extends Renderer {
|
|
|
1070
1060
|
width: number;
|
|
1071
1061
|
height: number;
|
|
1072
1062
|
canvas?: HTMLCanvasElement;
|
|
1073
|
-
doubleBuffering?: boolean;
|
|
1074
1063
|
antiAlias?: boolean;
|
|
1075
1064
|
transparent?: boolean;
|
|
1076
1065
|
subPixel?: boolean;
|
|
@@ -1079,8 +1068,6 @@ export class CanvasRenderer extends Renderer {
|
|
|
1079
1068
|
zoomY?: number;
|
|
1080
1069
|
});
|
|
1081
1070
|
context: CanvasRenderingContext2D;
|
|
1082
|
-
backBufferCanvas: HTMLCanvasElement | OffscreenCanvas;
|
|
1083
|
-
backBufferContext2D: CanvasRenderingContext2D;
|
|
1084
1071
|
cache: TextureCache;
|
|
1085
1072
|
/**
|
|
1086
1073
|
* Reset the canvas transform to identity
|
|
@@ -1106,12 +1093,6 @@ export class CanvasRenderer extends Renderer {
|
|
|
1106
1093
|
* @param {CanvasRenderingContext2D} [context]
|
|
1107
1094
|
*/
|
|
1108
1095
|
setBlendMode(mode?: string, context?: CanvasRenderingContext2D): void;
|
|
1109
|
-
/**
|
|
1110
|
-
* render the main framebuffer on screen
|
|
1111
|
-
* @name flush
|
|
1112
|
-
* @memberof CanvasRenderer
|
|
1113
|
-
*/
|
|
1114
|
-
flush(): void;
|
|
1115
1096
|
/**
|
|
1116
1097
|
* Clears the main framebuffer with the given color
|
|
1117
1098
|
* @name clearColor
|
|
@@ -1304,18 +1285,11 @@ export class CanvasRenderer extends Renderer {
|
|
|
1304
1285
|
* @param {number} radius
|
|
1305
1286
|
*/
|
|
1306
1287
|
fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
1307
|
-
/**
|
|
1308
|
-
* return a reference to the system 2d Context
|
|
1309
|
-
* @name getContext
|
|
1310
|
-
* @memberof CanvasRenderer
|
|
1311
|
-
* @returns {CanvasRenderingContext2D}
|
|
1312
|
-
*/
|
|
1313
|
-
getContext(): CanvasRenderingContext2D;
|
|
1314
1288
|
/**
|
|
1315
1289
|
* return a reference to the font 2d Context
|
|
1316
1290
|
* @ignore
|
|
1317
1291
|
*/
|
|
1318
|
-
getFontContext(): CanvasRenderingContext2D;
|
|
1292
|
+
getFontContext(): CanvasRenderingContext2D | WebGLRenderingContext;
|
|
1319
1293
|
/**
|
|
1320
1294
|
* save the canvas context
|
|
1321
1295
|
* @name save
|
|
@@ -1458,34 +1432,28 @@ export class Color {
|
|
|
1458
1432
|
/**
|
|
1459
1433
|
* Color Red Component [0 .. 255]
|
|
1460
1434
|
* @type {number}
|
|
1461
|
-
* @memberof Color
|
|
1462
1435
|
*/
|
|
1463
1436
|
get r(): number;
|
|
1464
1437
|
set g(arg: number);
|
|
1465
1438
|
/**
|
|
1466
1439
|
* Color Green Component [0 .. 255]
|
|
1467
1440
|
* @type {number}
|
|
1468
|
-
* @memberof Color
|
|
1469
1441
|
*/
|
|
1470
1442
|
get g(): number;
|
|
1471
1443
|
set b(arg: number);
|
|
1472
1444
|
/**
|
|
1473
1445
|
* Color Blue Component [0 .. 255]
|
|
1474
1446
|
* @type {number}
|
|
1475
|
-
* @memberof Color
|
|
1476
1447
|
*/
|
|
1477
1448
|
get b(): number;
|
|
1478
1449
|
set alpha(arg: number);
|
|
1479
1450
|
/**
|
|
1480
1451
|
* Color Alpha Component [0.0 .. 1.0]
|
|
1481
1452
|
* @type {number}
|
|
1482
|
-
* @memberof Color
|
|
1483
1453
|
*/
|
|
1484
1454
|
get alpha(): number;
|
|
1485
1455
|
/**
|
|
1486
1456
|
* Set this color to the specified value.
|
|
1487
|
-
* @name setColor
|
|
1488
|
-
* @memberof Color
|
|
1489
1457
|
* @param {number} r red component [0 .. 255]
|
|
1490
1458
|
* @param {number} g green component [0 .. 255]
|
|
1491
1459
|
* @param {number} b blue component [0 .. 255]
|
|
@@ -1493,41 +1461,47 @@ export class Color {
|
|
|
1493
1461
|
* @returns {Color} Reference to this object for method chaining
|
|
1494
1462
|
*/
|
|
1495
1463
|
setColor(r: number, g: number, b: number, alpha?: number): Color;
|
|
1464
|
+
/**
|
|
1465
|
+
* set this color to the specified HSV value
|
|
1466
|
+
* @param {number} h hue (a value from 0 to 1)
|
|
1467
|
+
* @param {number} s saturation (a value from 0 to 1)
|
|
1468
|
+
* @param {number} v value (a value from 0 to 1)
|
|
1469
|
+
* @returns {Color} Reference to this object for method chaining
|
|
1470
|
+
*/
|
|
1471
|
+
setHSV(h: number, s: number, v: number): Color;
|
|
1472
|
+
/**
|
|
1473
|
+
* set this color to the specified HSL value
|
|
1474
|
+
* @param {number} h hue (a value from 0 to 1)
|
|
1475
|
+
* @param {number} s saturation (a value from 0 to 1)
|
|
1476
|
+
* @param {number} l lightness (a value from 0 to 1)
|
|
1477
|
+
* @returns {Color} Reference to this object for method chaining
|
|
1478
|
+
*/
|
|
1479
|
+
setHSL(h: number, s: number, l: number): Color;
|
|
1496
1480
|
/**
|
|
1497
1481
|
* Create a new copy of this color object.
|
|
1498
|
-
* @name clone
|
|
1499
|
-
* @memberof Color
|
|
1500
1482
|
* @returns {Color} Reference to the newly cloned object
|
|
1501
1483
|
*/
|
|
1502
1484
|
clone(): Color;
|
|
1503
1485
|
/**
|
|
1504
1486
|
* Copy a color object or CSS color into this one.
|
|
1505
|
-
* @name copy
|
|
1506
|
-
* @memberof Color
|
|
1507
1487
|
* @param {Color|string} color
|
|
1508
1488
|
* @returns {Color} Reference to this object for method chaining
|
|
1509
1489
|
*/
|
|
1510
1490
|
copy(color: Color | string): Color;
|
|
1511
1491
|
/**
|
|
1512
1492
|
* Blend this color with the given one using addition.
|
|
1513
|
-
* @name add
|
|
1514
|
-
* @memberof Color
|
|
1515
1493
|
* @param {Color} color
|
|
1516
1494
|
* @returns {Color} Reference to this object for method chaining
|
|
1517
1495
|
*/
|
|
1518
1496
|
add(color: Color): Color;
|
|
1519
1497
|
/**
|
|
1520
1498
|
* Darken this color value by 0..1
|
|
1521
|
-
* @name darken
|
|
1522
|
-
* @memberof Color
|
|
1523
1499
|
* @param {number} scale
|
|
1524
1500
|
* @returns {Color} Reference to this object for method chaining
|
|
1525
1501
|
*/
|
|
1526
1502
|
darken(scale: number): Color;
|
|
1527
1503
|
/**
|
|
1528
1504
|
* Linearly interpolate between this color and the given one.
|
|
1529
|
-
* @name lerp
|
|
1530
|
-
* @memberof Color
|
|
1531
1505
|
* @param {Color} color
|
|
1532
1506
|
* @param {number} alpha with alpha = 0 being this color, and alpha = 1 being the given one.
|
|
1533
1507
|
* @returns {Color} Reference to this object for method chaining
|
|
@@ -1535,16 +1509,12 @@ export class Color {
|
|
|
1535
1509
|
lerp(color: Color, alpha: number): Color;
|
|
1536
1510
|
/**
|
|
1537
1511
|
* Lighten this color value by 0..1
|
|
1538
|
-
* @name lighten
|
|
1539
|
-
* @memberof Color
|
|
1540
1512
|
* @param {number} scale
|
|
1541
1513
|
* @returns {Color} Reference to this object for method chaining
|
|
1542
1514
|
*/
|
|
1543
1515
|
lighten(scale: number): Color;
|
|
1544
1516
|
/**
|
|
1545
1517
|
* Generate random r,g,b values for this color object
|
|
1546
|
-
* @name random
|
|
1547
|
-
* @memberof Color
|
|
1548
1518
|
* @param {number} [min=0] minimum value for the random range
|
|
1549
1519
|
* @param {number} [max=255] maxmium value for the random range
|
|
1550
1520
|
* @returns {Color} Reference to this object for method chaining
|
|
@@ -1553,8 +1523,6 @@ export class Color {
|
|
|
1553
1523
|
/**
|
|
1554
1524
|
* Return true if the r,g,b,a values of this color are equal with the
|
|
1555
1525
|
* given one.
|
|
1556
|
-
* @name equals
|
|
1557
|
-
* @memberof Color
|
|
1558
1526
|
* @param {Color} color
|
|
1559
1527
|
* @returns {boolean}
|
|
1560
1528
|
*/
|
|
@@ -1562,16 +1530,12 @@ export class Color {
|
|
|
1562
1530
|
/**
|
|
1563
1531
|
* Parse a CSS color string and set this color to the corresponding
|
|
1564
1532
|
* r,g,b values
|
|
1565
|
-
* @name parseCSS
|
|
1566
|
-
* @memberof Color
|
|
1567
1533
|
* @param {string} cssColor
|
|
1568
1534
|
* @returns {Color} Reference to this object for method chaining
|
|
1569
1535
|
*/
|
|
1570
1536
|
parseCSS(cssColor: string): Color;
|
|
1571
1537
|
/**
|
|
1572
1538
|
* Parse an RGB or RGBA CSS color string
|
|
1573
|
-
* @name parseRGB
|
|
1574
|
-
* @memberof Color
|
|
1575
1539
|
* @param {string} rgbColor
|
|
1576
1540
|
* @returns {Color} Reference to this object for method chaining
|
|
1577
1541
|
*/
|
|
@@ -1579,8 +1543,6 @@ export class Color {
|
|
|
1579
1543
|
/**
|
|
1580
1544
|
* Parse a Hex color ("#RGB", "#RGBA" or "#RRGGBB", "#RRGGBBAA" format) and set this color to
|
|
1581
1545
|
* the corresponding r,g,b,a values
|
|
1582
|
-
* @name parseHex
|
|
1583
|
-
* @memberof Color
|
|
1584
1546
|
* @param {string} hexColor
|
|
1585
1547
|
* @param {boolean} [argb = false] true if format is #ARGB, or #AARRGGBB (as opposed to #RGBA or #RGGBBAA)
|
|
1586
1548
|
* @returns {Color} Reference to this object for method chaining
|
|
@@ -1588,44 +1550,32 @@ export class Color {
|
|
|
1588
1550
|
parseHex(hexColor: string, argb?: boolean): Color;
|
|
1589
1551
|
/**
|
|
1590
1552
|
* Pack this color into a Uint32 ARGB representation
|
|
1591
|
-
* @name toUint32
|
|
1592
|
-
* @memberof Color
|
|
1593
1553
|
* @param {number} [alpha=1.0] alpha value [0.0 .. 1.0]
|
|
1594
1554
|
* @returns {number}
|
|
1595
1555
|
*/
|
|
1596
1556
|
toUint32(alpha?: number): number;
|
|
1597
1557
|
/**
|
|
1598
1558
|
* return an array representation of this object
|
|
1599
|
-
* @name toArray
|
|
1600
|
-
* @memberof Color
|
|
1601
1559
|
* @returns {Float32Array}
|
|
1602
1560
|
*/
|
|
1603
1561
|
toArray(): Float32Array;
|
|
1604
1562
|
/**
|
|
1605
|
-
*
|
|
1606
|
-
* @name toHex
|
|
1607
|
-
* @memberof Color
|
|
1563
|
+
* return the color in "#RRGGBB" format
|
|
1608
1564
|
* @returns {string}
|
|
1609
1565
|
*/
|
|
1610
1566
|
toHex(): string;
|
|
1611
1567
|
/**
|
|
1612
1568
|
* Get the color in "#RRGGBBAA" format
|
|
1613
|
-
* @name toHex8
|
|
1614
|
-
* @memberof Color
|
|
1615
1569
|
* @returns {string}
|
|
1616
1570
|
*/
|
|
1617
1571
|
toHex8(alpha?: number): string;
|
|
1618
1572
|
/**
|
|
1619
1573
|
* Get the color in "rgb(R,G,B)" format
|
|
1620
|
-
* @name toRGB
|
|
1621
|
-
* @memberof Color
|
|
1622
1574
|
* @returns {string}
|
|
1623
1575
|
*/
|
|
1624
1576
|
toRGB(): string;
|
|
1625
1577
|
/**
|
|
1626
1578
|
* Get the color in "rgba(R,G,B,A)" format
|
|
1627
|
-
* @name toRGBA
|
|
1628
|
-
* @memberof Color
|
|
1629
1579
|
* @param {number} [alpha=1.0] alpha value [0.0 .. 1.0]
|
|
1630
1580
|
* @returns {string}
|
|
1631
1581
|
*/
|
|
@@ -1956,7 +1906,7 @@ export class Container extends Renderable {
|
|
|
1956
1906
|
* @memberof Container
|
|
1957
1907
|
* @public
|
|
1958
1908
|
* @param {Renderable} child
|
|
1959
|
-
* @param {boolean} [keepalive=
|
|
1909
|
+
* @param {boolean} [keepalive=false] true to prevent calling child.destroy()
|
|
1960
1910
|
*/
|
|
1961
1911
|
public removeChild(child: Renderable, keepalive?: boolean): void;
|
|
1962
1912
|
/**
|
|
@@ -3626,6 +3576,15 @@ export class ObservableVector2d extends Vector2d {
|
|
|
3626
3576
|
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
3627
3577
|
*/
|
|
3628
3578
|
lerp(v: Vector2d | ObservableVector2d, alpha: number): ObservableVector2d;
|
|
3579
|
+
/**
|
|
3580
|
+
* interpolate the position of this vector towards the given one while nsure that the distance never exceeds the given step.
|
|
3581
|
+
* @name moveTowards
|
|
3582
|
+
* @memberof ObservableVector2d
|
|
3583
|
+
* @param {Vector2d|ObservableVector2d} target
|
|
3584
|
+
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
3585
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
3586
|
+
*/
|
|
3587
|
+
moveTowards(target: Vector2d | ObservableVector2d, step: number): ObservableVector2d;
|
|
3629
3588
|
/**
|
|
3630
3589
|
* return the distance between this vector and the passed one
|
|
3631
3590
|
* @name distance
|
|
@@ -3909,6 +3868,15 @@ export class ObservableVector3d extends Vector3d {
|
|
|
3909
3868
|
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
3910
3869
|
*/
|
|
3911
3870
|
lerp(v: Vector3d | ObservableVector3d, alpha: number): ObservableVector3d;
|
|
3871
|
+
/**
|
|
3872
|
+
* interpolate the position of this vector on the x and y axis towards the given one while ensure that the distance never exceeds the given step.
|
|
3873
|
+
* @name moveTowards
|
|
3874
|
+
* @memberof ObservableVector3d
|
|
3875
|
+
* @param {Vector2d|ObservableVector2d|Vector3d|ObservableVector3d} target
|
|
3876
|
+
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
3877
|
+
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
3878
|
+
*/
|
|
3879
|
+
moveTowards(target: Vector2d | ObservableVector2d | Vector3d | ObservableVector3d, step: number): ObservableVector3d;
|
|
3912
3880
|
/**
|
|
3913
3881
|
* return the distance between this vector and the passed one
|
|
3914
3882
|
* @name distance
|
|
@@ -5409,16 +5377,18 @@ export class Polygon {
|
|
|
5409
5377
|
*/
|
|
5410
5378
|
export class QuadTree {
|
|
5411
5379
|
/**
|
|
5380
|
+
* @param {World} world the physic world this QuadTree belongs to
|
|
5412
5381
|
* @param {Bounds} bounds bounds of the node
|
|
5413
5382
|
* @param {number} [max_objects=4] max objects a node can hold before splitting into 4 subnodes
|
|
5414
5383
|
* @param {number} [max_levels=4] total max levels inside root Quadtree
|
|
5415
5384
|
* @param {number} [level] deepth level, required for subnodes
|
|
5416
5385
|
*/
|
|
5417
|
-
constructor(bounds: Bounds, max_objects?: number, max_levels?: number, level?: number);
|
|
5386
|
+
constructor(world: World, bounds: Bounds, max_objects?: number, max_levels?: number, level?: number);
|
|
5387
|
+
world: World;
|
|
5388
|
+
bounds: Bounds;
|
|
5418
5389
|
max_objects: number;
|
|
5419
5390
|
max_levels: number;
|
|
5420
5391
|
level: number;
|
|
5421
|
-
bounds: Bounds;
|
|
5422
5392
|
objects: any[];
|
|
5423
5393
|
nodes: any[];
|
|
5424
5394
|
split(): void;
|
|
@@ -6159,7 +6129,6 @@ export class Renderer {
|
|
|
6159
6129
|
* @param {number} options.width The width of the canvas without scaling
|
|
6160
6130
|
* @param {number} options.height The height of the canvas without scaling
|
|
6161
6131
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
6162
|
-
* @param {boolean} [options.doubleBuffering=false] Whether to enable double buffering
|
|
6163
6132
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing, use false (default) for a pixelated effect.
|
|
6164
6133
|
* @param {boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
6165
6134
|
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
|
|
@@ -6173,7 +6142,6 @@ export class Renderer {
|
|
|
6173
6142
|
width: number;
|
|
6174
6143
|
height: number;
|
|
6175
6144
|
canvas?: HTMLCanvasElement;
|
|
6176
|
-
doubleBuffering?: boolean;
|
|
6177
6145
|
antiAlias?: boolean;
|
|
6178
6146
|
failIfMajorPerformanceCaveat?: boolean;
|
|
6179
6147
|
transparent?: boolean;
|
|
@@ -6219,8 +6187,6 @@ export class Renderer {
|
|
|
6219
6187
|
*/
|
|
6220
6188
|
currentBlendMode: string;
|
|
6221
6189
|
canvas: any;
|
|
6222
|
-
backBufferCanvas: any;
|
|
6223
|
-
context: any;
|
|
6224
6190
|
currentColor: Color;
|
|
6225
6191
|
currentTint: Color;
|
|
6226
6192
|
projectionMatrix: Matrix3d;
|
|
@@ -6231,6 +6197,12 @@ export class Renderer {
|
|
|
6231
6197
|
* @memberof Renderer
|
|
6232
6198
|
*/
|
|
6233
6199
|
clear(): void;
|
|
6200
|
+
/**
|
|
6201
|
+
* render the main framebuffer on screen
|
|
6202
|
+
* @name flush
|
|
6203
|
+
* @memberof Renderer
|
|
6204
|
+
*/
|
|
6205
|
+
flush(): void;
|
|
6234
6206
|
/**
|
|
6235
6207
|
* Reset context state
|
|
6236
6208
|
* @name reset
|
|
@@ -6238,27 +6210,19 @@ export class Renderer {
|
|
|
6238
6210
|
*/
|
|
6239
6211
|
reset(): void;
|
|
6240
6212
|
/**
|
|
6241
|
-
* return a reference to the
|
|
6213
|
+
* return a reference to the canvas which this renderer draws to
|
|
6242
6214
|
* @name getCanvas
|
|
6243
6215
|
* @memberof Renderer
|
|
6244
6216
|
* @returns {HTMLCanvasElement}
|
|
6245
6217
|
*/
|
|
6246
6218
|
getCanvas(): HTMLCanvasElement;
|
|
6247
6219
|
/**
|
|
6248
|
-
* return a reference to
|
|
6249
|
-
* @name
|
|
6250
|
-
* @memberof Renderer
|
|
6251
|
-
* @returns {HTMLCanvasElement}
|
|
6252
|
-
*/
|
|
6253
|
-
getScreenCanvas(): HTMLCanvasElement;
|
|
6254
|
-
/**
|
|
6255
|
-
* return a reference to the screen canvas corresponding 2d Context<br>
|
|
6256
|
-
* (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
|
|
6257
|
-
* @name getScreenContext
|
|
6220
|
+
* return a reference to this renderer canvas corresponding Context
|
|
6221
|
+
* @name getContext
|
|
6258
6222
|
* @memberof Renderer
|
|
6259
|
-
* @returns {CanvasRenderingContext2D}
|
|
6223
|
+
* @returns {CanvasRenderingContext2D|WebGLRenderingContext}
|
|
6260
6224
|
*/
|
|
6261
|
-
|
|
6225
|
+
getContext(): CanvasRenderingContext2D | WebGLRenderingContext;
|
|
6262
6226
|
/**
|
|
6263
6227
|
* returns the current blend mode for this renderer
|
|
6264
6228
|
* @name getBlendMode
|
|
@@ -6397,6 +6361,25 @@ export class Renderer {
|
|
|
6397
6361
|
*/
|
|
6398
6362
|
drawFont(): void;
|
|
6399
6363
|
get Texture(): typeof TextureAtlas;
|
|
6364
|
+
/**
|
|
6365
|
+
* return a reference to the screen canvas
|
|
6366
|
+
* @name getScreenCanvas
|
|
6367
|
+
* @memberof Renderer
|
|
6368
|
+
* @returns {HTMLCanvasElement}
|
|
6369
|
+
* @deprecated since 13.1.0
|
|
6370
|
+
* @see getCanvas();
|
|
6371
|
+
*/
|
|
6372
|
+
getScreenCanvas(): HTMLCanvasElement;
|
|
6373
|
+
/**
|
|
6374
|
+
* return a reference to the screen canvas corresponding 2d Context<br>
|
|
6375
|
+
* (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
|
|
6376
|
+
* @name getScreenContext
|
|
6377
|
+
* @memberof Renderer
|
|
6378
|
+
* @returns {CanvasRenderingContext2D}
|
|
6379
|
+
* @deprecated since 13.1.0
|
|
6380
|
+
* @see getContext();
|
|
6381
|
+
*/
|
|
6382
|
+
getScreenContext(): CanvasRenderingContext2D;
|
|
6400
6383
|
}
|
|
6401
6384
|
/**
|
|
6402
6385
|
* @classdesc
|
|
@@ -7004,6 +6987,14 @@ export class TMXLayer extends Renderable {
|
|
|
7004
6987
|
* @name TMXLayer#renderorder
|
|
7005
6988
|
*/
|
|
7006
6989
|
public renderorder: string;
|
|
6990
|
+
/**
|
|
6991
|
+
* the layer class
|
|
6992
|
+
* @public
|
|
6993
|
+
* @type {string}
|
|
6994
|
+
* @name class
|
|
6995
|
+
* @name TMXLayer#class
|
|
6996
|
+
*/
|
|
6997
|
+
public class: string;
|
|
7007
6998
|
name: any;
|
|
7008
6999
|
cols: number;
|
|
7009
7000
|
rows: number;
|
|
@@ -7335,6 +7326,13 @@ export class TMXTileMap {
|
|
|
7335
7326
|
* @name TMXTileMap#tiledversion
|
|
7336
7327
|
*/
|
|
7337
7328
|
public tiledversion: string;
|
|
7329
|
+
/**
|
|
7330
|
+
* The map class.
|
|
7331
|
+
* @public
|
|
7332
|
+
* @type {string}
|
|
7333
|
+
* @name TMXTileMap#class
|
|
7334
|
+
*/
|
|
7335
|
+
public class: string;
|
|
7338
7336
|
tilesets: TMXTilesetGroup;
|
|
7339
7337
|
layers: any[];
|
|
7340
7338
|
objectGroups: any[];
|
|
@@ -7440,6 +7438,13 @@ export class TMXTileset {
|
|
|
7440
7438
|
* @name TMXTileset#isCollection
|
|
7441
7439
|
*/
|
|
7442
7440
|
public isCollection: boolean;
|
|
7441
|
+
/**
|
|
7442
|
+
* the tileset class
|
|
7443
|
+
* @public
|
|
7444
|
+
* @type {boolean}
|
|
7445
|
+
* @name TMXTileset#class
|
|
7446
|
+
*/
|
|
7447
|
+
public class: boolean;
|
|
7443
7448
|
/**
|
|
7444
7449
|
* Tileset animations
|
|
7445
7450
|
* @private
|
|
@@ -7630,9 +7635,6 @@ export class Text extends Renderable {
|
|
|
7630
7635
|
public fontSize: number;
|
|
7631
7636
|
canvasTexture: any;
|
|
7632
7637
|
metrics: TextMetrics;
|
|
7633
|
-
/** @ignore */
|
|
7634
|
-
onDeactivateEvent(): void;
|
|
7635
|
-
glTextureUnit: any;
|
|
7636
7638
|
/**
|
|
7637
7639
|
* make the font bold
|
|
7638
7640
|
* @returns {Text} this object for chaining
|
|
@@ -7660,6 +7662,7 @@ export class Text extends Renderable {
|
|
|
7660
7662
|
* @returns {Text} this object for chaining
|
|
7661
7663
|
*/
|
|
7662
7664
|
setText(value?: number | string | string[]): Text;
|
|
7665
|
+
glTextureUnit: any;
|
|
7663
7666
|
/**
|
|
7664
7667
|
* measure the given text size in pixels
|
|
7665
7668
|
* @param {CanvasRenderer|WebGLRenderer} renderer reference to the active renderer
|
|
@@ -8472,6 +8475,15 @@ export class Vector2d {
|
|
|
8472
8475
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
8473
8476
|
*/
|
|
8474
8477
|
lerp(v: Vector2d, alpha: number): Vector2d;
|
|
8478
|
+
/**
|
|
8479
|
+
* interpolate the position of this vector towards the given one by the given maximum step.
|
|
8480
|
+
* @name moveTowards
|
|
8481
|
+
* @memberof Vector2d
|
|
8482
|
+
* @param {Vector2d} target
|
|
8483
|
+
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
8484
|
+
* @returns {Vector2d} Reference to this object for method chaining
|
|
8485
|
+
*/
|
|
8486
|
+
moveTowards(target: Vector2d, step: number): Vector2d;
|
|
8475
8487
|
/**
|
|
8476
8488
|
* return the distance between this vector and the passed one
|
|
8477
8489
|
* @name distance
|
|
@@ -8795,6 +8807,15 @@ export class Vector3d {
|
|
|
8795
8807
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
8796
8808
|
*/
|
|
8797
8809
|
lerp(v: Vector3d, alpha: number): Vector3d;
|
|
8810
|
+
/**
|
|
8811
|
+
* interpolate the position of this vector on the x and y axis towards the given one by the given maximum step.
|
|
8812
|
+
* @name moveTowards
|
|
8813
|
+
* @memberof Vector3d
|
|
8814
|
+
* @param {Vector2d|Vector3d} target
|
|
8815
|
+
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
8816
|
+
* @returns {Vector3d} Reference to this object for method chaining
|
|
8817
|
+
*/
|
|
8818
|
+
moveTowards(target: Vector2d | Vector3d, step: number): Vector3d;
|
|
8798
8819
|
/**
|
|
8799
8820
|
* return the distance between this vector and the passed one
|
|
8800
8821
|
* @name distance
|
|
@@ -9058,7 +9079,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9058
9079
|
* @param {number} options.width The width of the canvas without scaling
|
|
9059
9080
|
* @param {number} options.height The height of the canvas without scaling
|
|
9060
9081
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
9061
|
-
* @param {boolean} [options.doubleBuffering=false] Whether to enable double buffering
|
|
9062
9082
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
|
|
9063
9083
|
* @param {boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
9064
9084
|
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
|
|
@@ -9073,7 +9093,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9073
9093
|
width: number;
|
|
9074
9094
|
height: number;
|
|
9075
9095
|
canvas?: HTMLCanvasElement;
|
|
9076
|
-
doubleBuffering?: boolean;
|
|
9077
9096
|
antiAlias?: boolean;
|
|
9078
9097
|
failIfMajorPerformanceCaveat?: boolean;
|
|
9079
9098
|
transparent?: boolean;
|
|
@@ -9205,12 +9224,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9205
9224
|
* var basic = renderer.createPattern(image, "no-repeat");
|
|
9206
9225
|
*/
|
|
9207
9226
|
createPattern(image: new (width?: number, height?: number) => HTMLImageElement, repeat: string): TextureAtlas;
|
|
9208
|
-
/**
|
|
9209
|
-
* Flush the compositor to the frame buffer
|
|
9210
|
-
* @name flush
|
|
9211
|
-
* @memberof WebGLRenderer
|
|
9212
|
-
*/
|
|
9213
|
-
flush(): void;
|
|
9214
9227
|
/**
|
|
9215
9228
|
* Clears the gl context with the given color.
|
|
9216
9229
|
* @name clearColor
|
|
@@ -9267,13 +9280,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9267
9280
|
* @see WebGLRenderer#createPattern
|
|
9268
9281
|
*/
|
|
9269
9282
|
drawPattern(pattern: TextureAtlas, x: number, y: number, width: number, height: number): void;
|
|
9270
|
-
/**
|
|
9271
|
-
* return a reference to the screen canvas corresponding WebGL Context
|
|
9272
|
-
* @name getScreenContext
|
|
9273
|
-
* @memberof WebGLRenderer
|
|
9274
|
-
* @returns {WebGLRenderingContext}
|
|
9275
|
-
*/
|
|
9276
|
-
getScreenContext(): WebGLRenderingContext;
|
|
9277
9283
|
/**
|
|
9278
9284
|
* Returns the WebGL Context object of the given Canvas
|
|
9279
9285
|
* @name getContextGL
|
|
@@ -9562,6 +9568,12 @@ export class World extends Container {
|
|
|
9562
9568
|
* @param {number} [height=game.viewport.height] height of the container
|
|
9563
9569
|
*/
|
|
9564
9570
|
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
9571
|
+
/**
|
|
9572
|
+
* the application (game) this physic world belong to
|
|
9573
|
+
* @public
|
|
9574
|
+
* @type {Application}
|
|
9575
|
+
*/
|
|
9576
|
+
public app: Application;
|
|
9565
9577
|
/**
|
|
9566
9578
|
* the rate at which the game world is updated,
|
|
9567
9579
|
* may be greater than or lower than the display fps
|
|
@@ -9629,6 +9641,14 @@ export class World extends Container {
|
|
|
9629
9641
|
* @returns {World} this game world
|
|
9630
9642
|
*/
|
|
9631
9643
|
removeBody(body: Body): World;
|
|
9644
|
+
/**
|
|
9645
|
+
* Apply gravity to the given body
|
|
9646
|
+
* @name bodyApplyVelocity
|
|
9647
|
+
* @memberof World
|
|
9648
|
+
* @private
|
|
9649
|
+
* @param {Body} body
|
|
9650
|
+
*/
|
|
9651
|
+
private bodyApplyGravity;
|
|
9632
9652
|
}
|
|
9633
9653
|
export var audio: Readonly<{
|
|
9634
9654
|
__proto__: any;
|
|
@@ -9740,29 +9760,7 @@ export namespace collision {
|
|
|
9740
9760
|
*/
|
|
9741
9761
|
function rayCast(line: Line, result?: Renderable[]): Renderable[];
|
|
9742
9762
|
}
|
|
9743
|
-
export
|
|
9744
|
-
const devicePixelRatio: number;
|
|
9745
|
-
const isFullscreen: boolean;
|
|
9746
|
-
const sound: boolean;
|
|
9747
|
-
/**
|
|
9748
|
-
* @public
|
|
9749
|
-
* @name turnOnPointerLock
|
|
9750
|
-
* @returns {boolean} return true if the request was successfully submitted
|
|
9751
|
-
* @memberof device#
|
|
9752
|
-
* @deprecated since 10.3.0
|
|
9753
|
-
* @see input.requestPointerLock
|
|
9754
|
-
*/
|
|
9755
|
-
function turnOnPointerLock(): boolean;
|
|
9756
|
-
/**
|
|
9757
|
-
* @public
|
|
9758
|
-
* @name turnOffPointerLock
|
|
9759
|
-
* @returns {boolean} return true if the request was successfully submitted
|
|
9760
|
-
* @memberof device#
|
|
9761
|
-
* @deprecated since 10.3.0
|
|
9762
|
-
* @see input.exitPointerLock
|
|
9763
|
-
*/
|
|
9764
|
-
function turnOffPointerLock(): boolean;
|
|
9765
|
-
}
|
|
9763
|
+
export var device: any;
|
|
9766
9764
|
export var event: Readonly<{
|
|
9767
9765
|
__proto__: any;
|
|
9768
9766
|
DOM_READY: string;
|
|
@@ -9805,21 +9803,13 @@ export var event: Readonly<{
|
|
|
9805
9803
|
once: typeof once;
|
|
9806
9804
|
off: typeof off;
|
|
9807
9805
|
}>;
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
onLevelLoaded: typeof onLevelLoaded;
|
|
9816
|
-
reset: typeof reset;
|
|
9817
|
-
updateFrameRate: typeof updateFrameRate;
|
|
9818
|
-
getParentContainer: typeof getParentContainer;
|
|
9819
|
-
repaint: typeof repaint;
|
|
9820
|
-
update: typeof update;
|
|
9821
|
-
draw: typeof draw;
|
|
9822
|
-
}>;
|
|
9806
|
+
/**
|
|
9807
|
+
* game is a default instance of a melonJS Application and represents your current game,
|
|
9808
|
+
* it contains all the objects, tilemap layers, current viewport, collision map, etc...<br>
|
|
9809
|
+
* @namespace game
|
|
9810
|
+
* @see Application
|
|
9811
|
+
*/
|
|
9812
|
+
export let game: Application;
|
|
9823
9813
|
/**
|
|
9824
9814
|
* a flag indicating that melonJS is fully initialized
|
|
9825
9815
|
* @type {boolean}
|
|
@@ -10154,7 +10144,7 @@ export namespace level {
|
|
|
10154
10144
|
* @param {string} levelId level id
|
|
10155
10145
|
* @param {object} [options] additional optional parameters
|
|
10156
10146
|
* @param {Container} [options.container=game.world] container in which to load the specified level
|
|
10157
|
-
* @param {Function} [options.onLoaded=
|
|
10147
|
+
* @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
|
|
10158
10148
|
* @param {boolean} [options.flatten=game.mergeGroup] if true, flatten all objects into the given container
|
|
10159
10149
|
* @param {boolean} [options.setViewportBounds=true] if true, set the viewport bounds to the map size
|
|
10160
10150
|
* @returns {boolean} true if the level was successfully loaded
|
|
@@ -10199,7 +10189,7 @@ export namespace level {
|
|
|
10199
10189
|
* @param {string} levelId level id
|
|
10200
10190
|
* @param {object} [options] additional optional parameters
|
|
10201
10191
|
* @param {Container} [options.container=game.world] container in which to load the specified level
|
|
10202
|
-
* @param {Function} [options.onLoaded=
|
|
10192
|
+
* @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
|
|
10203
10193
|
* @param {boolean} [options.flatten=game.mergeGroup] if true, flatten all objects into the given container
|
|
10204
10194
|
* @param {boolean} [options.setViewportBounds=true] if true, set the viewport bounds to the map size
|
|
10205
10195
|
* @returns {boolean} true if the level was successfully loaded
|
|
@@ -10468,6 +10458,8 @@ export namespace loader {
|
|
|
10468
10458
|
* {name: "tileset-platformer", type: "image", src: "data/map/tileset.png"},
|
|
10469
10459
|
* // PNG packed texture
|
|
10470
10460
|
* {name: "texture", type:"image", src: "data/gfx/texture.png"}
|
|
10461
|
+
* // PNG base64 encoded image
|
|
10462
|
+
* {name: "texture", type:"image", src: "data:image/png;base64,iVBORw0KAAAQAAAAEACA..."}
|
|
10471
10463
|
* // TSX file
|
|
10472
10464
|
* {name: "meta_tiles", type: "tsx", src: "data/map/meta_tiles.tsx"},
|
|
10473
10465
|
* // TMX level (XML & JSON)
|
|
@@ -10478,6 +10470,8 @@ export namespace loader {
|
|
|
10478
10470
|
* // audio resources
|
|
10479
10471
|
* {name: "bgmusic", type: "audio", src: "data/audio/"},
|
|
10480
10472
|
* {name: "cling", type: "audio", src: "data/audio/"},
|
|
10473
|
+
* // base64 encoded audio resources
|
|
10474
|
+
* {name: "band", type: "audio", src: "data:audio/wav;base64,..."},
|
|
10481
10475
|
* // binary file
|
|
10482
10476
|
* {name: "ymTrack", type: "binary", src: "data/audio/main.ym"},
|
|
10483
10477
|
* // JSON file (used for texturePacker)
|
|
@@ -10515,6 +10509,8 @@ export namespace loader {
|
|
|
10515
10509
|
* {name: "tileset-platformer", type: "image", src: "data/map/tileset.png"},
|
|
10516
10510
|
* // PNG packed texture
|
|
10517
10511
|
* {name: "texture", type:"image", src: "data/gfx/texture.png"}
|
|
10512
|
+
* // PNG base64 encoded image
|
|
10513
|
+
* {name: "texture", type:"image", src: "data:image/png;base64,iVBORw0KAAAQAAAAEACA..."}
|
|
10518
10514
|
* // TSX file
|
|
10519
10515
|
* {name: "meta_tiles", type: "tsx", src: "data/map/meta_tiles.tsx"},
|
|
10520
10516
|
* // TMX level (XML & JSON)
|
|
@@ -10525,6 +10521,8 @@ export namespace loader {
|
|
|
10525
10521
|
* // audio resources
|
|
10526
10522
|
* {name: "bgmusic", type: "audio", src: "data/audio/"},
|
|
10527
10523
|
* {name: "cling", type: "audio", src: "data/audio/"},
|
|
10524
|
+
* // base64 encoded audio resources
|
|
10525
|
+
* {name: "band", type: "audio", src: "data:audio/wav;base64,..."},
|
|
10528
10526
|
* // binary file
|
|
10529
10527
|
* {name: "ymTrack", type: "binary", src: "data/audio/main.ym"},
|
|
10530
10528
|
* // JSON file (used for texturePacker)
|
|
@@ -10554,13 +10552,14 @@ export namespace loader {
|
|
|
10554
10552
|
* @param {string} res.type "audio", binary", "image", "json", "tmx", "tsx"
|
|
10555
10553
|
* @param {string} res.src path and/or file name of the resource (for audio assets only the path is required)
|
|
10556
10554
|
* @param {boolean} [res.stream] Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
10557
|
-
* @param {Function} onload function to be called when the resource is loaded
|
|
10558
|
-
* @param {Function} onerror function to be called in case of error
|
|
10555
|
+
* @param {Function} [onload] function to be called when the resource is loaded
|
|
10556
|
+
* @param {Function} [onerror] function to be called in case of error
|
|
10559
10557
|
* @returns {number} the amount of corresponding resource to be preloaded
|
|
10560
10558
|
* @example
|
|
10561
10559
|
* // load an image asset
|
|
10562
10560
|
* me.loader.load({name: "avatar", type:"image", src: "data/avatar.png"}, this.onload.bind(this), this.onerror.bind(this));
|
|
10563
|
-
*
|
|
10561
|
+
* // load a base64 image asset
|
|
10562
|
+
* me.loader.load({name: "avatar", type:"image", src: "data:image/png;base64,iVBORw0KAAAQAAAAEACA..."};
|
|
10564
10563
|
* // start loading music
|
|
10565
10564
|
* me.loader.load({
|
|
10566
10565
|
* name : "bgmusic",
|
|
@@ -10575,7 +10574,7 @@ export namespace loader {
|
|
|
10575
10574
|
type: string;
|
|
10576
10575
|
src: string;
|
|
10577
10576
|
stream?: boolean;
|
|
10578
|
-
}, onload
|
|
10577
|
+
}, onload?: Function, onerror?: Function): number;
|
|
10579
10578
|
/**
|
|
10580
10579
|
* Load a single resource (to be used if you need to load additional resource during the game)
|
|
10581
10580
|
* @name load
|
|
@@ -10586,13 +10585,14 @@ export namespace loader {
|
|
|
10586
10585
|
* @param {string} res.type "audio", binary", "image", "json", "tmx", "tsx"
|
|
10587
10586
|
* @param {string} res.src path and/or file name of the resource (for audio assets only the path is required)
|
|
10588
10587
|
* @param {boolean} [res.stream] Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
10589
|
-
* @param {Function} onload function to be called when the resource is loaded
|
|
10590
|
-
* @param {Function} onerror function to be called in case of error
|
|
10588
|
+
* @param {Function} [onload] function to be called when the resource is loaded
|
|
10589
|
+
* @param {Function} [onerror] function to be called in case of error
|
|
10591
10590
|
* @returns {number} the amount of corresponding resource to be preloaded
|
|
10592
10591
|
* @example
|
|
10593
10592
|
* // load an image asset
|
|
10594
10593
|
* me.loader.load({name: "avatar", type:"image", src: "data/avatar.png"}, this.onload.bind(this), this.onerror.bind(this));
|
|
10595
|
-
*
|
|
10594
|
+
* // load a base64 image asset
|
|
10595
|
+
* me.loader.load({name: "avatar", type:"image", src: "data:image/png;base64,iVBORw0KAAAQAAAAEACA..."};
|
|
10596
10596
|
* // start loading music
|
|
10597
10597
|
* me.loader.load({
|
|
10598
10598
|
* name : "bgmusic",
|
|
@@ -10607,7 +10607,7 @@ export namespace loader {
|
|
|
10607
10607
|
type: string;
|
|
10608
10608
|
src: string;
|
|
10609
10609
|
stream?: boolean;
|
|
10610
|
-
}, onload
|
|
10610
|
+
}, onload?: Function, onerror?: Function): number;
|
|
10611
10611
|
/**
|
|
10612
10612
|
* unload specified resource to free memory
|
|
10613
10613
|
* @name unload
|
|
@@ -11115,20 +11115,6 @@ export namespace state {
|
|
|
11115
11115
|
*/
|
|
11116
11116
|
export function isCurrent(state: number): boolean;
|
|
11117
11117
|
}
|
|
11118
|
-
/**
|
|
11119
|
-
* the default global Timer instance
|
|
11120
|
-
* @namespace timer
|
|
11121
|
-
* @see Timer
|
|
11122
|
-
* @example
|
|
11123
|
-
* // set a timer to call "myFunction" after 1000ms
|
|
11124
|
-
* timer.setTimeout(myFunction, 1000);
|
|
11125
|
-
* // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2
|
|
11126
|
-
* timer.setTimeout(myFunction, 1000, true, param1, param2);
|
|
11127
|
-
* // set a timer to call "myFunction" every 1000ms
|
|
11128
|
-
* timer.setInterval(myFunction, 1000);
|
|
11129
|
-
* // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2
|
|
11130
|
-
* timer.setInterval(myFunction, 1000, true, param1, param2);
|
|
11131
|
-
*/
|
|
11132
11118
|
export const timer: Timer;
|
|
11133
11119
|
export namespace utils {
|
|
11134
11120
|
export { agentUtils as agent };
|
|
@@ -11157,7 +11143,7 @@ export var video: Readonly<{
|
|
|
11157
11143
|
AUTO: 2;
|
|
11158
11144
|
readonly parent: HTMLElement;
|
|
11159
11145
|
scaleRatio: Vector2d;
|
|
11160
|
-
readonly renderer:
|
|
11146
|
+
readonly renderer: WebGLRenderer | CanvasRenderer;
|
|
11161
11147
|
init: typeof init;
|
|
11162
11148
|
createCanvas: typeof createCanvas;
|
|
11163
11149
|
getParent: typeof getParent;
|
|
@@ -11593,6 +11579,109 @@ declare class VertexArrayBuffer {
|
|
|
11593
11579
|
*/
|
|
11594
11580
|
isEmpty(): boolean;
|
|
11595
11581
|
}
|
|
11582
|
+
/**
|
|
11583
|
+
* @classdesc
|
|
11584
|
+
* An Application represents a single melonJS game.
|
|
11585
|
+
* An Application is responsible for updating (each frame) all the related object status and draw them.
|
|
11586
|
+
* @see game
|
|
11587
|
+
*/
|
|
11588
|
+
declare class Application {
|
|
11589
|
+
/**
|
|
11590
|
+
* a reference to the current active stage "default" camera
|
|
11591
|
+
* @public
|
|
11592
|
+
* @type {Camera2d}
|
|
11593
|
+
*/
|
|
11594
|
+
public viewport: Camera2d;
|
|
11595
|
+
/**
|
|
11596
|
+
* a reference to the game world, <br>
|
|
11597
|
+
* a world is a virtual environment containing all the game objects
|
|
11598
|
+
* @public
|
|
11599
|
+
* @type {World}
|
|
11600
|
+
*/
|
|
11601
|
+
public world: World;
|
|
11602
|
+
/**
|
|
11603
|
+
* when true, all objects will be added under the root world container.<br>
|
|
11604
|
+
* When false, a `me.Container` object will be created for each corresponding groups
|
|
11605
|
+
* @public
|
|
11606
|
+
* @type {boolean}
|
|
11607
|
+
* @default true
|
|
11608
|
+
*/
|
|
11609
|
+
public mergeGroup: boolean;
|
|
11610
|
+
/**
|
|
11611
|
+
* Specify the property to be used when sorting renderables.
|
|
11612
|
+
* Accepted values : "x", "y", "z"
|
|
11613
|
+
* @public
|
|
11614
|
+
* @type {string}
|
|
11615
|
+
* @default "z"
|
|
11616
|
+
*/
|
|
11617
|
+
public sortOn: string;
|
|
11618
|
+
/**
|
|
11619
|
+
* Last time the game update loop was executed. <br>
|
|
11620
|
+
* Use this value to implement frame prediction in drawing events,
|
|
11621
|
+
* for creating smooth motion while running game update logic at
|
|
11622
|
+
* a lower fps.
|
|
11623
|
+
* @public
|
|
11624
|
+
* @type {DOMHighResTimeStamp}
|
|
11625
|
+
* @name lastUpdate
|
|
11626
|
+
* @memberof Application
|
|
11627
|
+
*/
|
|
11628
|
+
public lastUpdate: DOMHighResTimeStamp;
|
|
11629
|
+
isDirty: boolean;
|
|
11630
|
+
isAlwaysDirty: boolean;
|
|
11631
|
+
frameCounter: number;
|
|
11632
|
+
frameRate: number;
|
|
11633
|
+
accumulator: number;
|
|
11634
|
+
accumulatorMax: number;
|
|
11635
|
+
accumulatorUpdateDelta: number;
|
|
11636
|
+
stepSize: number;
|
|
11637
|
+
updateDelta: number;
|
|
11638
|
+
lastUpdateStart: number;
|
|
11639
|
+
updateAverageDelta: number;
|
|
11640
|
+
/**
|
|
11641
|
+
* init the game instance (create a physic world, update starting time, etc..)
|
|
11642
|
+
*/
|
|
11643
|
+
init(): void;
|
|
11644
|
+
/**
|
|
11645
|
+
* reset the game Object manager
|
|
11646
|
+
* destroy all current objects
|
|
11647
|
+
*/
|
|
11648
|
+
reset(): void;
|
|
11649
|
+
/**
|
|
11650
|
+
* Fired when a level is fully loaded and all renderable instantiated. <br>
|
|
11651
|
+
* Additionnaly the level id will also be passed to the called function.
|
|
11652
|
+
* @example
|
|
11653
|
+
* // call myFunction () everytime a level is loaded
|
|
11654
|
+
* me.game.onLevelLoaded = this.myFunction.bind(this);
|
|
11655
|
+
*/
|
|
11656
|
+
onLevelLoaded(): void;
|
|
11657
|
+
/**
|
|
11658
|
+
* Update the renderer framerate using the system config variables.
|
|
11659
|
+
* @see timer.maxfps
|
|
11660
|
+
* @see World.fps
|
|
11661
|
+
*/
|
|
11662
|
+
updateFrameRate(): void;
|
|
11663
|
+
/**
|
|
11664
|
+
* Returns the parent container of the specified Child in the game world
|
|
11665
|
+
* @param {Renderable} child
|
|
11666
|
+
* @returns {Container}
|
|
11667
|
+
*/
|
|
11668
|
+
getParentContainer(child: Renderable): Container;
|
|
11669
|
+
/**
|
|
11670
|
+
* force the redraw (not update) of all objects
|
|
11671
|
+
*/
|
|
11672
|
+
repaint(): void;
|
|
11673
|
+
/**
|
|
11674
|
+
* update all objects related to this game active scene/stage
|
|
11675
|
+
* @param {number} time current timestamp as provided by the RAF callback
|
|
11676
|
+
* @param {Stage} stage the current stage
|
|
11677
|
+
*/
|
|
11678
|
+
update(time: number, stage: Stage): void;
|
|
11679
|
+
/**
|
|
11680
|
+
* draw the active scene/stage associated to this game
|
|
11681
|
+
* @param {Stage} stage the current stage
|
|
11682
|
+
*/
|
|
11683
|
+
draw(stage: Stage): void;
|
|
11684
|
+
}
|
|
11596
11685
|
/**
|
|
11597
11686
|
* Initialize and configure the audio support.<br>
|
|
11598
11687
|
* melonJS supports a wide array of audio codecs that have varying browser support :
|
|
@@ -11894,55 +11983,6 @@ declare function once(eventName: string | symbol, listener: Function, context?:
|
|
|
11894
11983
|
* me.event.off("event-name", myFunction);
|
|
11895
11984
|
*/
|
|
11896
11985
|
declare function off(eventName: string | symbol, listener: Function): {};
|
|
11897
|
-
/**
|
|
11898
|
-
* Fired when a level is fully loaded and all entities instantiated. <br>
|
|
11899
|
-
* Additionnaly the level id will also be passed to the called function.
|
|
11900
|
-
* @function game.onLevelLoaded
|
|
11901
|
-
* @example
|
|
11902
|
-
* // call myFunction () everytime a level is loaded
|
|
11903
|
-
* me.game.onLevelLoaded = this.myFunction.bind(this);
|
|
11904
|
-
*/
|
|
11905
|
-
declare function onLevelLoaded(): void;
|
|
11906
|
-
/**
|
|
11907
|
-
* reset the game Object manager<br>
|
|
11908
|
-
* destroy all current objects
|
|
11909
|
-
* @function game.reset
|
|
11910
|
-
*/
|
|
11911
|
-
declare function reset(): void;
|
|
11912
|
-
/**
|
|
11913
|
-
* Update the renderer framerate using the system config variables.
|
|
11914
|
-
* @function game.updateFrameRate
|
|
11915
|
-
* @see timer.maxfps
|
|
11916
|
-
* @see World.fps
|
|
11917
|
-
*/
|
|
11918
|
-
declare function updateFrameRate(): void;
|
|
11919
|
-
/**
|
|
11920
|
-
* Returns the parent container of the specified Child in the game world
|
|
11921
|
-
* @function game.getParentContainer
|
|
11922
|
-
* @param {Renderable} child
|
|
11923
|
-
* @returns {Container}
|
|
11924
|
-
*/
|
|
11925
|
-
declare function getParentContainer(child: Renderable): Container;
|
|
11926
|
-
/**
|
|
11927
|
-
* force the redraw (not update) of all objects
|
|
11928
|
-
* @function game.repaint
|
|
11929
|
-
*/
|
|
11930
|
-
declare function repaint(): void;
|
|
11931
|
-
/**
|
|
11932
|
-
* update all objects of the game manager
|
|
11933
|
-
* @ignore
|
|
11934
|
-
* @function game.update
|
|
11935
|
-
* @param {number} time current timestamp as provided by the RAF callback
|
|
11936
|
-
* @param {Stage} stage the current stage
|
|
11937
|
-
*/
|
|
11938
|
-
declare function update(time: number, stage: Stage): void;
|
|
11939
|
-
/**
|
|
11940
|
-
* draw the current scene/stage
|
|
11941
|
-
* @function game.draw
|
|
11942
|
-
* @ignore
|
|
11943
|
-
* @param {Stage} stage the current stage
|
|
11944
|
-
*/
|
|
11945
|
-
declare function draw(stage: Stage): void;
|
|
11946
11986
|
/**
|
|
11947
11987
|
* Translate the specified x and y values from the global (absolute)
|
|
11948
11988
|
* coordinate to local (viewport) relative coordinate.
|
|
@@ -12337,48 +12377,41 @@ declare class ObjectPool {
|
|
|
12337
12377
|
/**
|
|
12338
12378
|
* @classdesc
|
|
12339
12379
|
* a Timer class to manage timing related function (FPS, Game Tick, Time...)
|
|
12340
|
-
|
|
12380
|
+
* @see {@link timer} the default global timer instance
|
|
12341
12381
|
*/
|
|
12342
12382
|
declare class Timer {
|
|
12343
12383
|
/**
|
|
12344
|
-
* Last game tick value
|
|
12345
|
-
* Use this value to scale velocities during frame drops due to slow
|
|
12346
|
-
*
|
|
12347
|
-
* This feature is disabled by default. Enable me.timer.interpolation to
|
|
12348
|
-
* use it.
|
|
12384
|
+
* Last game tick value. <br>
|
|
12385
|
+
* Use this value to scale velocities during frame drops due to slow hardware or when setting an FPS limit.
|
|
12386
|
+
* This feature is disabled by default (Enable interpolation to use it).
|
|
12349
12387
|
* @public
|
|
12350
|
-
* @see
|
|
12388
|
+
* @see interpolation
|
|
12389
|
+
* @See maxfps
|
|
12351
12390
|
* @type {number}
|
|
12352
12391
|
* @name tick
|
|
12353
|
-
* @memberof timer
|
|
12354
12392
|
*/
|
|
12355
12393
|
public tick: number;
|
|
12356
12394
|
/**
|
|
12357
|
-
* Last measured fps rate.<br
|
|
12358
|
-
* This feature is disabled by default, unless the debugPanel is enabled/visible
|
|
12395
|
+
* Last measured fps rate.<br>
|
|
12396
|
+
* This feature is disabled by default, unless the debugPanel is enabled/visible.
|
|
12359
12397
|
* @public
|
|
12360
12398
|
* @type {number}
|
|
12361
12399
|
* @name fps
|
|
12362
|
-
* @memberof timer
|
|
12363
12400
|
*/
|
|
12364
12401
|
public fps: number;
|
|
12365
12402
|
/**
|
|
12366
12403
|
* Set the maximum target display frame per second
|
|
12367
12404
|
* @public
|
|
12368
|
-
* @see
|
|
12405
|
+
* @see tick
|
|
12369
12406
|
* @type {number}
|
|
12370
|
-
* @name maxfps
|
|
12371
12407
|
* @default 60
|
|
12372
|
-
* @memberof timer
|
|
12373
12408
|
*/
|
|
12374
12409
|
public maxfps: number;
|
|
12375
12410
|
/**
|
|
12376
12411
|
* Enable/disable frame interpolation
|
|
12377
|
-
* @see
|
|
12412
|
+
* @see tick
|
|
12378
12413
|
* @type {boolean}
|
|
12379
12414
|
* @default false
|
|
12380
|
-
* @name interpolation
|
|
12381
|
-
* @memberof timer
|
|
12382
12415
|
*/
|
|
12383
12416
|
interpolation: boolean;
|
|
12384
12417
|
framecount: number;
|
|
@@ -12392,15 +12425,11 @@ declare class Timer {
|
|
|
12392
12425
|
timerId: number;
|
|
12393
12426
|
/**
|
|
12394
12427
|
* reset time (e.g. usefull in case of pause)
|
|
12395
|
-
* @name reset
|
|
12396
|
-
* @memberof timer
|
|
12397
12428
|
* @ignore
|
|
12398
12429
|
*/
|
|
12399
12430
|
reset(): void;
|
|
12400
12431
|
/**
|
|
12401
12432
|
* Calls a function once after a specified delay. See me.timer.setInterval to repeativly call a function.
|
|
12402
|
-
* @name setTimeout
|
|
12403
|
-
* @memberof timer
|
|
12404
12433
|
* @param {Function} fn the function you want to execute after delay milliseconds.
|
|
12405
12434
|
* @param {number} delay the number of milliseconds (thousandths of a second) that the function call should be delayed by.
|
|
12406
12435
|
* @param {boolean} [pauseable=true] respects the pause state of the engine.
|
|
@@ -12415,8 +12444,6 @@ declare class Timer {
|
|
|
12415
12444
|
setTimeout(fn: Function, delay: number, pauseable?: boolean, ...args: any[]): number;
|
|
12416
12445
|
/**
|
|
12417
12446
|
* Calls a function continously at the specified interval. See setTimeout to call function a single time.
|
|
12418
|
-
* @name setInterval
|
|
12419
|
-
* @memberof timer
|
|
12420
12447
|
* @param {Function} fn the function to execute
|
|
12421
12448
|
* @param {number} delay the number of milliseconds (thousandths of a second) on how often to execute the function
|
|
12422
12449
|
* @param {boolean} [pauseable=true] respects the pause state of the engine.
|
|
@@ -12431,38 +12458,28 @@ declare class Timer {
|
|
|
12431
12458
|
setInterval(fn: Function, delay: number, pauseable?: boolean, ...args: any[]): number;
|
|
12432
12459
|
/**
|
|
12433
12460
|
* Clears the delay set by me.timer.setTimeout().
|
|
12434
|
-
* @name clearTimeout
|
|
12435
|
-
* @memberof timer
|
|
12436
12461
|
* @param {number} timeoutID ID of the timeout to be cleared
|
|
12437
12462
|
*/
|
|
12438
12463
|
clearTimeout(timeoutID: number): void;
|
|
12439
12464
|
/**
|
|
12440
12465
|
* Clears the Interval set by me.timer.setInterval().
|
|
12441
|
-
* @name clearInterval
|
|
12442
|
-
* @memberof timer
|
|
12443
12466
|
* @param {number} intervalID ID of the interval to be cleared
|
|
12444
12467
|
*/
|
|
12445
12468
|
clearInterval(intervalID: number): void;
|
|
12446
12469
|
/**
|
|
12447
12470
|
* Return the current timestamp in milliseconds <br>
|
|
12448
12471
|
* since the game has started or since linux epoch (based on browser support for High Resolution Timer)
|
|
12449
|
-
* @name getTime
|
|
12450
|
-
* @memberof timer
|
|
12451
12472
|
* @returns {number}
|
|
12452
12473
|
*/
|
|
12453
12474
|
getTime(): number;
|
|
12454
12475
|
/**
|
|
12455
12476
|
* Return elapsed time in milliseconds since the last update
|
|
12456
|
-
* @name getDelta
|
|
12457
|
-
* @memberof timer
|
|
12458
12477
|
* @returns {number}
|
|
12459
12478
|
*/
|
|
12460
12479
|
getDelta(): number;
|
|
12461
12480
|
/**
|
|
12462
12481
|
* compute the actual frame time and fps rate
|
|
12463
|
-
* @name computeFPS
|
|
12464
12482
|
* @ignore
|
|
12465
|
-
* @memberof timer
|
|
12466
12483
|
*/
|
|
12467
12484
|
countFPS(): void;
|
|
12468
12485
|
/**
|
|
@@ -12500,11 +12517,10 @@ declare var fileUtils: Readonly<{
|
|
|
12500
12517
|
declare var stringUtils: Readonly<{
|
|
12501
12518
|
__proto__: any;
|
|
12502
12519
|
capitalize: typeof capitalize;
|
|
12503
|
-
trimLeft: typeof trimLeft;
|
|
12504
|
-
trimRight: typeof trimRight;
|
|
12505
12520
|
isNumeric: typeof isNumeric;
|
|
12506
12521
|
isBoolean: typeof isBoolean;
|
|
12507
12522
|
toHex: typeof toHex$1;
|
|
12523
|
+
isDataUrl: typeof isDataUrl;
|
|
12508
12524
|
}>;
|
|
12509
12525
|
declare var fnUtils: Readonly<{
|
|
12510
12526
|
__proto__: any;
|
|
@@ -12534,7 +12550,6 @@ declare var fnUtils: Readonly<{
|
|
|
12534
12550
|
* @param {object} [options] The optional video/renderer parameters.<br> (see Renderer(s) documentation for further specific options)
|
|
12535
12551
|
* @param {string|HTMLElement} [options.parent=document.body] the DOM parent element to hold the canvas in the HTML file
|
|
12536
12552
|
* @param {number} [options.renderer=video.AUTO] renderer to use (me.video.CANVAS, me.video.WEBGL, me.video.AUTO)
|
|
12537
|
-
* @param {boolean} [options.doubleBuffering=false] enable/disable double buffering
|
|
12538
12553
|
* @param {number|string} [options.scale=1.0] enable scaling of the canvas ('auto' for automatic scaling)
|
|
12539
12554
|
* @param {string} [options.scaleMethod="fit"] screen scaling modes ('fit','fill-min','fill-max','flex','flex-width','flex-height','stretch')
|
|
12540
12555
|
* @param {boolean} [options.preferWebGL1=false] if true the renderer will only use WebGL 1
|
|
@@ -12549,14 +12564,12 @@ declare var fnUtils: Readonly<{
|
|
|
12549
12564
|
* parent : "screen",
|
|
12550
12565
|
* renderer : me.video.AUTO,
|
|
12551
12566
|
* scale : "auto",
|
|
12552
|
-
* scaleMethod : "fit"
|
|
12553
|
-
* doubleBuffering : true
|
|
12567
|
+
* scaleMethod : "fit"
|
|
12554
12568
|
* });
|
|
12555
12569
|
*/
|
|
12556
12570
|
declare function init(width: number, height: number, options?: {
|
|
12557
12571
|
parent?: string | HTMLElement;
|
|
12558
12572
|
renderer?: number;
|
|
12559
|
-
doubleBuffering?: boolean;
|
|
12560
12573
|
scale?: number | string;
|
|
12561
12574
|
scaleMethod?: string;
|
|
12562
12575
|
preferWebGL1?: boolean;
|
|
@@ -12570,10 +12583,10 @@ declare function init(width: number, height: number, options?: {
|
|
|
12570
12583
|
* @function video.createCanvas
|
|
12571
12584
|
* @param {number} width width
|
|
12572
12585
|
* @param {number} height height
|
|
12573
|
-
* @param {boolean} [
|
|
12586
|
+
* @param {boolean} [returnOffscreenCanvas=false] will return an OffscreenCanvas if supported
|
|
12574
12587
|
* @returns {HTMLCanvasElement|OffscreenCanvas}
|
|
12575
12588
|
*/
|
|
12576
|
-
declare function createCanvas(width: number, height: number,
|
|
12589
|
+
declare function createCanvas(width: number, height: number, returnOffscreenCanvas?: boolean): HTMLCanvasElement | OffscreenCanvas;
|
|
12577
12590
|
/**
|
|
12578
12591
|
* return a reference to the parent DOM element holding the main canvas
|
|
12579
12592
|
* @function video.getParent
|
|
@@ -12681,24 +12694,6 @@ declare function getExtension(path: string): string;
|
|
|
12681
12694
|
* @returns {string} the capitalized string
|
|
12682
12695
|
*/
|
|
12683
12696
|
declare function capitalize(str: string): string;
|
|
12684
|
-
/**
|
|
12685
|
-
* returns the string stripped of whitespace from the left.
|
|
12686
|
-
* @public
|
|
12687
|
-
* @memberof utils.string
|
|
12688
|
-
* @name trimLeft
|
|
12689
|
-
* @param {string} str the string to be trimmed
|
|
12690
|
-
* @returns {string} trimmed string
|
|
12691
|
-
*/
|
|
12692
|
-
declare function trimLeft(str: string): string;
|
|
12693
|
-
/**
|
|
12694
|
-
* returns the string stripped of whitespace from the right.
|
|
12695
|
-
* @public
|
|
12696
|
-
* @memberof utils.string
|
|
12697
|
-
* @name trimRight
|
|
12698
|
-
* @param {string} str the string to be trimmed
|
|
12699
|
-
* @returns {string} trimmed string
|
|
12700
|
-
*/
|
|
12701
|
-
declare function trimRight(str: string): string;
|
|
12702
12697
|
/**
|
|
12703
12698
|
* returns true if the given string contains a numeric integer or float value
|
|
12704
12699
|
* @public
|
|
@@ -12726,6 +12721,16 @@ declare function isBoolean(str: string): boolean;
|
|
|
12726
12721
|
* @returns {string} the converted hexadecimal value
|
|
12727
12722
|
*/
|
|
12728
12723
|
declare function toHex$1(str: string): string;
|
|
12724
|
+
/**
|
|
12725
|
+
* returns true if the given string is a data url in the `data:[<mediatype>][;base64],<data>` format.
|
|
12726
|
+
* (this will not test the validity of the Data or Base64 encoding)
|
|
12727
|
+
* @public
|
|
12728
|
+
* @memberof utils.string
|
|
12729
|
+
* @name isDataUrl
|
|
12730
|
+
* @param {string} str the string (url) to be tested
|
|
12731
|
+
* @returns {boolean} true if the string is a data url
|
|
12732
|
+
*/
|
|
12733
|
+
declare function isDataUrl(str: string): boolean;
|
|
12729
12734
|
/**
|
|
12730
12735
|
* a collection of utility functions
|
|
12731
12736
|
* @namespace utils.function
|