melonjs 13.0.0 → 13.2.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 +642 -583
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +286 -476
- package/dist/melonjs.module.js +629 -592
- package/package.json +7 -7
- package/src/geometries/point.js +80 -0
- package/src/index.js +4 -0
- package/src/input/pointerevent.js +2 -2
- package/src/lang/deprecated.js +27 -1
- package/src/level/tiled/TMXGroup.js +10 -0
- package/src/level/tiled/TMXLayer.js +9 -0
- package/src/level/tiled/TMXObject.js +33 -10
- package/src/level/tiled/TMXTileMap.js +12 -0
- package/src/level/tiled/TMXTileset.js +8 -0
- package/src/math/color.js +63 -43
- 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 +10 -3
- package/src/physics/bounds.js +10 -9
- package/src/polyfill/index.js +2 -2
- package/src/renderable/nineslicesprite.js +27 -1
- package/src/renderable/renderable.js +49 -135
- package/src/renderable/sprite.js +7 -1
- package/src/text/bitmaptext.js +8 -8
- package/src/text/text.js +1 -1
- package/src/text/textmetrics.js +1 -1
- package/src/video/canvas/canvas_renderer.js +51 -60
- package/src/video/renderer.js +27 -76
- package/src/video/texture/canvas_texture.js +4 -2
- package/src/video/video.js +13 -16
- package/src/video/webgl/glshader.js +0 -28
- package/src/video/webgl/webgl_compositor.js +21 -50
- package/src/video/webgl/webgl_renderer.js +44 -132
package/dist/melonjs.module.d.ts
CHANGED
|
@@ -98,6 +98,14 @@ export class BitmapText extends Renderable {
|
|
|
98
98
|
* @private
|
|
99
99
|
*/
|
|
100
100
|
private fontData;
|
|
101
|
+
public set fillStyle(arg: Color);
|
|
102
|
+
/**
|
|
103
|
+
* defines the color used to tint the bitmap text
|
|
104
|
+
* @public
|
|
105
|
+
* @type {Color}
|
|
106
|
+
* @see Renderable#tint
|
|
107
|
+
*/
|
|
108
|
+
public get fillStyle(): Color;
|
|
101
109
|
metrics: TextMetrics;
|
|
102
110
|
/**
|
|
103
111
|
* change the font settings
|
|
@@ -112,14 +120,6 @@ export class BitmapText extends Renderable {
|
|
|
112
120
|
* @returns {BitmapText} this object for chaining
|
|
113
121
|
*/
|
|
114
122
|
setText(value?: number | string | string[]): BitmapText;
|
|
115
|
-
public set fillStyle(arg: Color);
|
|
116
|
-
/**
|
|
117
|
-
* defines the color used to tint the bitmap text
|
|
118
|
-
* @public
|
|
119
|
-
* @type {Color}
|
|
120
|
-
* @see Renderable#tint
|
|
121
|
-
*/
|
|
122
|
-
public get fillStyle(): Color;
|
|
123
123
|
/**
|
|
124
124
|
* change the font display size
|
|
125
125
|
* @param {number} scale ratio
|
|
@@ -189,10 +189,10 @@ export class BitmapTextData {
|
|
|
189
189
|
export class Body {
|
|
190
190
|
/**
|
|
191
191
|
* @param {Renderable} ancestor the parent object this body is attached to
|
|
192
|
-
* @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Bounds|Bounds[]|object} [shapes] a initial shape, list of shapes, or JSON object defining the body
|
|
192
|
+
* @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Point|Point[]|Bounds|Bounds[]|object} [shapes] a initial shape, list of shapes, or JSON object defining the body
|
|
193
193
|
* @param {Function} [onBodyUpdate] callback for when the body is updated (e.g. add/remove shapes)
|
|
194
194
|
*/
|
|
195
|
-
constructor(ancestor: Renderable, shapes?: Rect | Rect[] | Polygon | Polygon[] | Line | Line[] | Ellipse | Ellipse[] | Bounds | Bounds[] | object, onBodyUpdate?: Function);
|
|
195
|
+
constructor(ancestor: Renderable, shapes?: Rect | Rect[] | Polygon | Polygon[] | Line | Line[] | Ellipse | Ellipse[] | Point | Point[] | Bounds | Bounds[] | object, onBodyUpdate?: Function);
|
|
196
196
|
/**
|
|
197
197
|
* a reference to the parent object that contains this body,
|
|
198
198
|
* or undefined if it has not been added to one.
|
|
@@ -210,9 +210,9 @@ export class Body {
|
|
|
210
210
|
/**
|
|
211
211
|
* The collision shapes of the body
|
|
212
212
|
* @ignore
|
|
213
|
-
* @type {Polygon[]|Line[]|Ellipse[]}
|
|
213
|
+
* @type {Polygon[]|Line[]|Ellipse[]|Point|Point[]}
|
|
214
214
|
*/
|
|
215
|
-
shapes: Polygon[] | Line[] | Ellipse[];
|
|
215
|
+
shapes: Polygon[] | Line[] | Ellipse[] | Point | Point[];
|
|
216
216
|
/**
|
|
217
217
|
* The body collision mask, that defines what should collide with what.<br>
|
|
218
218
|
* (by default will collide with all entities)
|
|
@@ -348,7 +348,7 @@ export class Body {
|
|
|
348
348
|
/**
|
|
349
349
|
* add a collision shape to this body <br>
|
|
350
350
|
* (note: me.Rect objects will be converted to me.Polygon before being added)
|
|
351
|
-
* @param {Rect|Polygon|Line|Ellipse|Bounds|object} shape a shape or JSON object
|
|
351
|
+
* @param {Rect|Polygon|Line|Ellipse|Point|Point[]|Bounds|object} shape a shape or JSON object
|
|
352
352
|
* @returns {number} the shape array length
|
|
353
353
|
* @example
|
|
354
354
|
* // add a rectangle shape
|
|
@@ -356,7 +356,7 @@ export class Body {
|
|
|
356
356
|
* // add a shape from a JSON object
|
|
357
357
|
* this.body.addShape(me.loader.getJSON("shapesdef").banana);
|
|
358
358
|
*/
|
|
359
|
-
addShape(shape: Rect | Polygon | Line | Ellipse | Bounds | object): number;
|
|
359
|
+
addShape(shape: Rect | Polygon | Line | Ellipse | Point | Point[] | Bounds | object): number;
|
|
360
360
|
/**
|
|
361
361
|
* set the body vertices to the given one
|
|
362
362
|
* @param {Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
|
|
@@ -663,10 +663,10 @@ export class Bounds {
|
|
|
663
663
|
* add the given point to the bounds definition.
|
|
664
664
|
* @name addPoint
|
|
665
665
|
* @memberof Bounds
|
|
666
|
-
* @param {Vector2d}
|
|
667
|
-
* @param {Matrix2d} [m] an optional transform to apply to the given point
|
|
666
|
+
* @param {Vector2d|Point} point the point to be added to the bounds
|
|
667
|
+
* @param {Matrix2d} [m] an optional transform to apply to the given point (only if the given point is a vector)
|
|
668
668
|
*/
|
|
669
|
-
addPoint(
|
|
669
|
+
addPoint(point: Vector2d | Point, m?: Matrix2d): void;
|
|
670
670
|
/**
|
|
671
671
|
* add the given quad coordinates to this bound definition, multiplied by the given matrix
|
|
672
672
|
* @name addFrame
|
|
@@ -1049,7 +1049,6 @@ export class CanvasRenderer extends Renderer {
|
|
|
1049
1049
|
* @param {number} options.width The width of the canvas without scaling
|
|
1050
1050
|
* @param {number} options.height The height of the canvas without scaling
|
|
1051
1051
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
1052
|
-
* @param {boolean} [options.doubleBuffering=false] Whether to enable double buffering
|
|
1053
1052
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
|
|
1054
1053
|
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
|
|
1055
1054
|
* @param {boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
|
|
@@ -1061,7 +1060,6 @@ export class CanvasRenderer extends Renderer {
|
|
|
1061
1060
|
width: number;
|
|
1062
1061
|
height: number;
|
|
1063
1062
|
canvas?: HTMLCanvasElement;
|
|
1064
|
-
doubleBuffering?: boolean;
|
|
1065
1063
|
antiAlias?: boolean;
|
|
1066
1064
|
transparent?: boolean;
|
|
1067
1065
|
subPixel?: boolean;
|
|
@@ -1070,8 +1068,6 @@ export class CanvasRenderer extends Renderer {
|
|
|
1070
1068
|
zoomY?: number;
|
|
1071
1069
|
});
|
|
1072
1070
|
context: CanvasRenderingContext2D;
|
|
1073
|
-
backBufferCanvas: HTMLCanvasElement | OffscreenCanvas;
|
|
1074
|
-
backBufferContext2D: CanvasRenderingContext2D;
|
|
1075
1071
|
cache: TextureCache;
|
|
1076
1072
|
/**
|
|
1077
1073
|
* Reset the canvas transform to identity
|
|
@@ -1097,12 +1093,6 @@ export class CanvasRenderer extends Renderer {
|
|
|
1097
1093
|
* @param {CanvasRenderingContext2D} [context]
|
|
1098
1094
|
*/
|
|
1099
1095
|
setBlendMode(mode?: string, context?: CanvasRenderingContext2D): void;
|
|
1100
|
-
/**
|
|
1101
|
-
* render the main framebuffer on screen
|
|
1102
|
-
* @name flush
|
|
1103
|
-
* @memberof CanvasRenderer
|
|
1104
|
-
*/
|
|
1105
|
-
flush(): void;
|
|
1106
1096
|
/**
|
|
1107
1097
|
* Clears the main framebuffer with the given color
|
|
1108
1098
|
* @name clearColor
|
|
@@ -1296,17 +1286,28 @@ export class CanvasRenderer extends Renderer {
|
|
|
1296
1286
|
*/
|
|
1297
1287
|
fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
1298
1288
|
/**
|
|
1299
|
-
*
|
|
1300
|
-
* @name
|
|
1289
|
+
* Stroke a Point at the specified coordinates
|
|
1290
|
+
* @name strokePoint
|
|
1301
1291
|
* @memberof CanvasRenderer
|
|
1302
|
-
* @
|
|
1292
|
+
* @param {number} x
|
|
1293
|
+
* @param {number} y
|
|
1303
1294
|
*/
|
|
1304
|
-
|
|
1295
|
+
strokePoint(x: number, y: number): void;
|
|
1296
|
+
/**
|
|
1297
|
+
* Draw a a point at the specified coordinates
|
|
1298
|
+
* @name fillPoint
|
|
1299
|
+
* @memberof CanvasRenderer
|
|
1300
|
+
* @param {number} x
|
|
1301
|
+
* @param {number} y
|
|
1302
|
+
* @param {number} width
|
|
1303
|
+
* @param {number} height
|
|
1304
|
+
*/
|
|
1305
|
+
fillPoint(x: number, y: number): void;
|
|
1305
1306
|
/**
|
|
1306
1307
|
* return a reference to the font 2d Context
|
|
1307
1308
|
* @ignore
|
|
1308
1309
|
*/
|
|
1309
|
-
getFontContext(): CanvasRenderingContext2D;
|
|
1310
|
+
getFontContext(): CanvasRenderingContext2D | WebGLRenderingContext;
|
|
1310
1311
|
/**
|
|
1311
1312
|
* save the canvas context
|
|
1312
1313
|
* @name save
|
|
@@ -1449,34 +1450,28 @@ export class Color {
|
|
|
1449
1450
|
/**
|
|
1450
1451
|
* Color Red Component [0 .. 255]
|
|
1451
1452
|
* @type {number}
|
|
1452
|
-
* @memberof Color
|
|
1453
1453
|
*/
|
|
1454
1454
|
get r(): number;
|
|
1455
1455
|
set g(arg: number);
|
|
1456
1456
|
/**
|
|
1457
1457
|
* Color Green Component [0 .. 255]
|
|
1458
1458
|
* @type {number}
|
|
1459
|
-
* @memberof Color
|
|
1460
1459
|
*/
|
|
1461
1460
|
get g(): number;
|
|
1462
1461
|
set b(arg: number);
|
|
1463
1462
|
/**
|
|
1464
1463
|
* Color Blue Component [0 .. 255]
|
|
1465
1464
|
* @type {number}
|
|
1466
|
-
* @memberof Color
|
|
1467
1465
|
*/
|
|
1468
1466
|
get b(): number;
|
|
1469
1467
|
set alpha(arg: number);
|
|
1470
1468
|
/**
|
|
1471
1469
|
* Color Alpha Component [0.0 .. 1.0]
|
|
1472
1470
|
* @type {number}
|
|
1473
|
-
* @memberof Color
|
|
1474
1471
|
*/
|
|
1475
1472
|
get alpha(): number;
|
|
1476
1473
|
/**
|
|
1477
1474
|
* Set this color to the specified value.
|
|
1478
|
-
* @name setColor
|
|
1479
|
-
* @memberof Color
|
|
1480
1475
|
* @param {number} r red component [0 .. 255]
|
|
1481
1476
|
* @param {number} g green component [0 .. 255]
|
|
1482
1477
|
* @param {number} b blue component [0 .. 255]
|
|
@@ -1484,41 +1479,47 @@ export class Color {
|
|
|
1484
1479
|
* @returns {Color} Reference to this object for method chaining
|
|
1485
1480
|
*/
|
|
1486
1481
|
setColor(r: number, g: number, b: number, alpha?: number): Color;
|
|
1482
|
+
/**
|
|
1483
|
+
* set this color to the specified HSV value
|
|
1484
|
+
* @param {number} h hue (a value from 0 to 1)
|
|
1485
|
+
* @param {number} s saturation (a value from 0 to 1)
|
|
1486
|
+
* @param {number} v value (a value from 0 to 1)
|
|
1487
|
+
* @returns {Color} Reference to this object for method chaining
|
|
1488
|
+
*/
|
|
1489
|
+
setHSV(h: number, s: number, v: number): Color;
|
|
1490
|
+
/**
|
|
1491
|
+
* set this color to the specified HSL value
|
|
1492
|
+
* @param {number} h hue (a value from 0 to 1)
|
|
1493
|
+
* @param {number} s saturation (a value from 0 to 1)
|
|
1494
|
+
* @param {number} l lightness (a value from 0 to 1)
|
|
1495
|
+
* @returns {Color} Reference to this object for method chaining
|
|
1496
|
+
*/
|
|
1497
|
+
setHSL(h: number, s: number, l: number): Color;
|
|
1487
1498
|
/**
|
|
1488
1499
|
* Create a new copy of this color object.
|
|
1489
|
-
* @name clone
|
|
1490
|
-
* @memberof Color
|
|
1491
1500
|
* @returns {Color} Reference to the newly cloned object
|
|
1492
1501
|
*/
|
|
1493
1502
|
clone(): Color;
|
|
1494
1503
|
/**
|
|
1495
1504
|
* Copy a color object or CSS color into this one.
|
|
1496
|
-
* @name copy
|
|
1497
|
-
* @memberof Color
|
|
1498
1505
|
* @param {Color|string} color
|
|
1499
1506
|
* @returns {Color} Reference to this object for method chaining
|
|
1500
1507
|
*/
|
|
1501
1508
|
copy(color: Color | string): Color;
|
|
1502
1509
|
/**
|
|
1503
1510
|
* Blend this color with the given one using addition.
|
|
1504
|
-
* @name add
|
|
1505
|
-
* @memberof Color
|
|
1506
1511
|
* @param {Color} color
|
|
1507
1512
|
* @returns {Color} Reference to this object for method chaining
|
|
1508
1513
|
*/
|
|
1509
1514
|
add(color: Color): Color;
|
|
1510
1515
|
/**
|
|
1511
1516
|
* Darken this color value by 0..1
|
|
1512
|
-
* @name darken
|
|
1513
|
-
* @memberof Color
|
|
1514
1517
|
* @param {number} scale
|
|
1515
1518
|
* @returns {Color} Reference to this object for method chaining
|
|
1516
1519
|
*/
|
|
1517
1520
|
darken(scale: number): Color;
|
|
1518
1521
|
/**
|
|
1519
1522
|
* Linearly interpolate between this color and the given one.
|
|
1520
|
-
* @name lerp
|
|
1521
|
-
* @memberof Color
|
|
1522
1523
|
* @param {Color} color
|
|
1523
1524
|
* @param {number} alpha with alpha = 0 being this color, and alpha = 1 being the given one.
|
|
1524
1525
|
* @returns {Color} Reference to this object for method chaining
|
|
@@ -1526,16 +1527,12 @@ export class Color {
|
|
|
1526
1527
|
lerp(color: Color, alpha: number): Color;
|
|
1527
1528
|
/**
|
|
1528
1529
|
* Lighten this color value by 0..1
|
|
1529
|
-
* @name lighten
|
|
1530
|
-
* @memberof Color
|
|
1531
1530
|
* @param {number} scale
|
|
1532
1531
|
* @returns {Color} Reference to this object for method chaining
|
|
1533
1532
|
*/
|
|
1534
1533
|
lighten(scale: number): Color;
|
|
1535
1534
|
/**
|
|
1536
1535
|
* Generate random r,g,b values for this color object
|
|
1537
|
-
* @name random
|
|
1538
|
-
* @memberof Color
|
|
1539
1536
|
* @param {number} [min=0] minimum value for the random range
|
|
1540
1537
|
* @param {number} [max=255] maxmium value for the random range
|
|
1541
1538
|
* @returns {Color} Reference to this object for method chaining
|
|
@@ -1544,8 +1541,6 @@ export class Color {
|
|
|
1544
1541
|
/**
|
|
1545
1542
|
* Return true if the r,g,b,a values of this color are equal with the
|
|
1546
1543
|
* given one.
|
|
1547
|
-
* @name equals
|
|
1548
|
-
* @memberof Color
|
|
1549
1544
|
* @param {Color} color
|
|
1550
1545
|
* @returns {boolean}
|
|
1551
1546
|
*/
|
|
@@ -1553,16 +1548,12 @@ export class Color {
|
|
|
1553
1548
|
/**
|
|
1554
1549
|
* Parse a CSS color string and set this color to the corresponding
|
|
1555
1550
|
* r,g,b values
|
|
1556
|
-
* @name parseCSS
|
|
1557
|
-
* @memberof Color
|
|
1558
1551
|
* @param {string} cssColor
|
|
1559
1552
|
* @returns {Color} Reference to this object for method chaining
|
|
1560
1553
|
*/
|
|
1561
1554
|
parseCSS(cssColor: string): Color;
|
|
1562
1555
|
/**
|
|
1563
1556
|
* Parse an RGB or RGBA CSS color string
|
|
1564
|
-
* @name parseRGB
|
|
1565
|
-
* @memberof Color
|
|
1566
1557
|
* @param {string} rgbColor
|
|
1567
1558
|
* @returns {Color} Reference to this object for method chaining
|
|
1568
1559
|
*/
|
|
@@ -1570,8 +1561,6 @@ export class Color {
|
|
|
1570
1561
|
/**
|
|
1571
1562
|
* Parse a Hex color ("#RGB", "#RGBA" or "#RRGGBB", "#RRGGBBAA" format) and set this color to
|
|
1572
1563
|
* the corresponding r,g,b,a values
|
|
1573
|
-
* @name parseHex
|
|
1574
|
-
* @memberof Color
|
|
1575
1564
|
* @param {string} hexColor
|
|
1576
1565
|
* @param {boolean} [argb = false] true if format is #ARGB, or #AARRGGBB (as opposed to #RGBA or #RGGBBAA)
|
|
1577
1566
|
* @returns {Color} Reference to this object for method chaining
|
|
@@ -1579,44 +1568,32 @@ export class Color {
|
|
|
1579
1568
|
parseHex(hexColor: string, argb?: boolean): Color;
|
|
1580
1569
|
/**
|
|
1581
1570
|
* Pack this color into a Uint32 ARGB representation
|
|
1582
|
-
* @name toUint32
|
|
1583
|
-
* @memberof Color
|
|
1584
1571
|
* @param {number} [alpha=1.0] alpha value [0.0 .. 1.0]
|
|
1585
1572
|
* @returns {number}
|
|
1586
1573
|
*/
|
|
1587
1574
|
toUint32(alpha?: number): number;
|
|
1588
1575
|
/**
|
|
1589
1576
|
* return an array representation of this object
|
|
1590
|
-
* @name toArray
|
|
1591
|
-
* @memberof Color
|
|
1592
1577
|
* @returns {Float32Array}
|
|
1593
1578
|
*/
|
|
1594
1579
|
toArray(): Float32Array;
|
|
1595
1580
|
/**
|
|
1596
|
-
*
|
|
1597
|
-
* @name toHex
|
|
1598
|
-
* @memberof Color
|
|
1581
|
+
* return the color in "#RRGGBB" format
|
|
1599
1582
|
* @returns {string}
|
|
1600
1583
|
*/
|
|
1601
1584
|
toHex(): string;
|
|
1602
1585
|
/**
|
|
1603
1586
|
* Get the color in "#RRGGBBAA" format
|
|
1604
|
-
* @name toHex8
|
|
1605
|
-
* @memberof Color
|
|
1606
1587
|
* @returns {string}
|
|
1607
1588
|
*/
|
|
1608
1589
|
toHex8(alpha?: number): string;
|
|
1609
1590
|
/**
|
|
1610
1591
|
* Get the color in "rgb(R,G,B)" format
|
|
1611
|
-
* @name toRGB
|
|
1612
|
-
* @memberof Color
|
|
1613
1592
|
* @returns {string}
|
|
1614
1593
|
*/
|
|
1615
1594
|
toRGB(): string;
|
|
1616
1595
|
/**
|
|
1617
1596
|
* Get the color in "rgba(R,G,B,A)" format
|
|
1618
|
-
* @name toRGBA
|
|
1619
|
-
* @memberof Color
|
|
1620
1597
|
* @param {number} [alpha=1.0] alpha value [0.0 .. 1.0]
|
|
1621
1598
|
* @returns {string}
|
|
1622
1599
|
*/
|
|
@@ -2461,70 +2438,46 @@ export class GLShader {
|
|
|
2461
2438
|
constructor(gl: WebGLRenderingContext, vertex: string, fragment: string, precision?: string);
|
|
2462
2439
|
/**
|
|
2463
2440
|
* the active gl rendering context
|
|
2464
|
-
* @public
|
|
2465
2441
|
* @type {WebGLRenderingContext}
|
|
2466
|
-
* @name gl
|
|
2467
|
-
* @memberof GLShader
|
|
2468
2442
|
*/
|
|
2469
|
-
|
|
2443
|
+
gl: WebGLRenderingContext;
|
|
2470
2444
|
/**
|
|
2471
2445
|
* the vertex shader source code
|
|
2472
|
-
* @public
|
|
2473
2446
|
* @type {string}
|
|
2474
|
-
* @name vertex
|
|
2475
|
-
* @memberof GLShader
|
|
2476
2447
|
*/
|
|
2477
|
-
|
|
2448
|
+
vertex: string;
|
|
2478
2449
|
/**
|
|
2479
2450
|
* the fragment shader source code
|
|
2480
|
-
* @public
|
|
2481
2451
|
* @type {string}
|
|
2482
|
-
* @name vertex
|
|
2483
|
-
* @memberof GLShader
|
|
2484
2452
|
*/
|
|
2485
|
-
|
|
2453
|
+
fragment: string;
|
|
2486
2454
|
/**
|
|
2487
2455
|
* the location attributes of the shader
|
|
2488
|
-
* @public
|
|
2489
2456
|
* @type {GLint[]}
|
|
2490
|
-
* @name attributes
|
|
2491
|
-
* @memberof GLShader
|
|
2492
2457
|
*/
|
|
2493
|
-
|
|
2458
|
+
attributes: GLint[];
|
|
2494
2459
|
/**
|
|
2495
2460
|
* a reference to the shader program (once compiled)
|
|
2496
|
-
* @public
|
|
2497
2461
|
* @type {WebGLProgram}
|
|
2498
|
-
* @name program
|
|
2499
|
-
* @memberof GLShader
|
|
2500
2462
|
*/
|
|
2501
|
-
|
|
2463
|
+
program: WebGLProgram;
|
|
2502
2464
|
/**
|
|
2503
2465
|
* the uniforms of the shader
|
|
2504
|
-
* @public
|
|
2505
2466
|
* @type {object}
|
|
2506
|
-
* @name uniforms
|
|
2507
|
-
* @memberof GLShader
|
|
2508
2467
|
*/
|
|
2509
|
-
|
|
2468
|
+
uniforms: object;
|
|
2510
2469
|
/**
|
|
2511
2470
|
* Installs this shader program as part of current rendering state
|
|
2512
|
-
* @name bind
|
|
2513
|
-
* @memberof GLShader
|
|
2514
2471
|
*/
|
|
2515
2472
|
bind(): void;
|
|
2516
2473
|
/**
|
|
2517
2474
|
* returns the location of an attribute variable in this shader program
|
|
2518
|
-
* @name getAttribLocation
|
|
2519
|
-
* @memberof GLShader
|
|
2520
2475
|
* @param {string} name the name of the attribute variable whose location to get.
|
|
2521
2476
|
* @returns {GLint} number indicating the location of the variable name if found. Returns -1 otherwise
|
|
2522
2477
|
*/
|
|
2523
2478
|
getAttribLocation(name: string): GLint;
|
|
2524
2479
|
/**
|
|
2525
2480
|
* Set the uniform to the given value
|
|
2526
|
-
* @name setUniform
|
|
2527
|
-
* @memberof GLShader
|
|
2528
2481
|
* @param {string} name the uniform name
|
|
2529
2482
|
* @param {object|Float32Array} value the value to assign to that uniform
|
|
2530
2483
|
* @example
|
|
@@ -2533,8 +2486,6 @@ export class GLShader {
|
|
|
2533
2486
|
setUniform(name: string, value: object | Float32Array): void;
|
|
2534
2487
|
/**
|
|
2535
2488
|
* activate the given vertex attribute for this shader
|
|
2536
|
-
* @name setVertexAttributes
|
|
2537
|
-
* @memberof GLShader
|
|
2538
2489
|
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
2539
2490
|
* @param {object[]} attributes an array of vertex attributes
|
|
2540
2491
|
* @param {number} vertexByteSize the size of a single vertex in bytes
|
|
@@ -2542,8 +2493,6 @@ export class GLShader {
|
|
|
2542
2493
|
setVertexAttributes(gl: WebGLRenderingContext, attributes: object[], vertexByteSize: number): void;
|
|
2543
2494
|
/**
|
|
2544
2495
|
* destroy this shader objects resources (program, attributes, uniforms)
|
|
2545
|
-
* @name destroy
|
|
2546
|
-
* @memberof GLShader
|
|
2547
2496
|
*/
|
|
2548
2497
|
destroy(): void;
|
|
2549
2498
|
}
|
|
@@ -3617,6 +3566,15 @@ export class ObservableVector2d extends Vector2d {
|
|
|
3617
3566
|
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
3618
3567
|
*/
|
|
3619
3568
|
lerp(v: Vector2d | ObservableVector2d, alpha: number): ObservableVector2d;
|
|
3569
|
+
/**
|
|
3570
|
+
* interpolate the position of this vector towards the given one while nsure that the distance never exceeds the given step.
|
|
3571
|
+
* @name moveTowards
|
|
3572
|
+
* @memberof ObservableVector2d
|
|
3573
|
+
* @param {Vector2d|ObservableVector2d} target
|
|
3574
|
+
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
3575
|
+
* @returns {ObservableVector2d} Reference to this object for method chaining
|
|
3576
|
+
*/
|
|
3577
|
+
moveTowards(target: Vector2d | ObservableVector2d, step: number): ObservableVector2d;
|
|
3620
3578
|
/**
|
|
3621
3579
|
* return the distance between this vector and the passed one
|
|
3622
3580
|
* @name distance
|
|
@@ -3900,6 +3858,15 @@ export class ObservableVector3d extends Vector3d {
|
|
|
3900
3858
|
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
3901
3859
|
*/
|
|
3902
3860
|
lerp(v: Vector3d | ObservableVector3d, alpha: number): ObservableVector3d;
|
|
3861
|
+
/**
|
|
3862
|
+
* 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.
|
|
3863
|
+
* @name moveTowards
|
|
3864
|
+
* @memberof ObservableVector3d
|
|
3865
|
+
* @param {Vector2d|ObservableVector2d|Vector3d|ObservableVector3d} target
|
|
3866
|
+
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
3867
|
+
* @returns {ObservableVector3d} Reference to this object for method chaining
|
|
3868
|
+
*/
|
|
3869
|
+
moveTowards(target: Vector2d | ObservableVector2d | Vector3d | ObservableVector3d, step: number): ObservableVector3d;
|
|
3903
3870
|
/**
|
|
3904
3871
|
* return the distance between this vector and the passed one
|
|
3905
3872
|
* @name distance
|
|
@@ -4904,6 +4871,59 @@ export namespace ParticleEmitterSettings {
|
|
|
4904
4871
|
const duration: number;
|
|
4905
4872
|
const framesToSkip: number;
|
|
4906
4873
|
}
|
|
4874
|
+
/**
|
|
4875
|
+
* @classdesc
|
|
4876
|
+
* represents a point in a 2d space
|
|
4877
|
+
*/
|
|
4878
|
+
export class Point {
|
|
4879
|
+
constructor(x?: number, y?: number);
|
|
4880
|
+
/**
|
|
4881
|
+
* the position of the point on the horizontal axis
|
|
4882
|
+
* @public
|
|
4883
|
+
* @type {Number}
|
|
4884
|
+
* @default 0
|
|
4885
|
+
*/
|
|
4886
|
+
public x: number;
|
|
4887
|
+
/**
|
|
4888
|
+
* the position of the point on the vertical axis
|
|
4889
|
+
* @public
|
|
4890
|
+
* @type {Number}
|
|
4891
|
+
* @default 0
|
|
4892
|
+
*/
|
|
4893
|
+
public y: number;
|
|
4894
|
+
/** @ignore */
|
|
4895
|
+
onResetEvent(x?: number, y?: number): void;
|
|
4896
|
+
/**
|
|
4897
|
+
* set the Point x and y properties to the given values
|
|
4898
|
+
* @param {number} x
|
|
4899
|
+
* @param {number} y
|
|
4900
|
+
* @returns {Point} Reference to this object for method chaining
|
|
4901
|
+
*/
|
|
4902
|
+
set(x?: number, y?: number): Point;
|
|
4903
|
+
/**
|
|
4904
|
+
* return true if the two points are the same
|
|
4905
|
+
* @name equals
|
|
4906
|
+
* @memberof Point
|
|
4907
|
+
* @method
|
|
4908
|
+
* @param {Point} point
|
|
4909
|
+
* @returns {boolean}
|
|
4910
|
+
*/
|
|
4911
|
+
/**
|
|
4912
|
+
* return true if this point is equal to the given values
|
|
4913
|
+
* @name equals
|
|
4914
|
+
* @memberof Point
|
|
4915
|
+
* @param {number} x
|
|
4916
|
+
* @param {number} y
|
|
4917
|
+
* @returns {boolean}
|
|
4918
|
+
*/
|
|
4919
|
+
equals(...args: any[]): boolean;
|
|
4920
|
+
/**
|
|
4921
|
+
* clone this Point
|
|
4922
|
+
* @name clone
|
|
4923
|
+
* @returns {Point} new Point
|
|
4924
|
+
*/
|
|
4925
|
+
clone(): Point;
|
|
4926
|
+
}
|
|
4907
4927
|
/**
|
|
4908
4928
|
* @classdesc
|
|
4909
4929
|
* a pointer object, representing a single finger on a touch enabled device.
|
|
@@ -5660,20 +5680,13 @@ export class Renderable extends Rect {
|
|
|
5660
5680
|
isRenderable: boolean;
|
|
5661
5681
|
/**
|
|
5662
5682
|
* If true then physic collision and input events will not impact this renderable
|
|
5663
|
-
* @public
|
|
5664
5683
|
* @type {boolean}
|
|
5665
5684
|
* @default true
|
|
5666
|
-
* @name isKinematic
|
|
5667
|
-
* @memberof Renderable
|
|
5668
5685
|
*/
|
|
5669
|
-
|
|
5686
|
+
isKinematic: boolean;
|
|
5670
5687
|
/**
|
|
5671
5688
|
* the renderable physic body
|
|
5672
|
-
* @public
|
|
5673
5689
|
* @type {Body}
|
|
5674
|
-
* @see Body
|
|
5675
|
-
* @name body
|
|
5676
|
-
* @memberof Renderable#
|
|
5677
5690
|
* @example
|
|
5678
5691
|
* // define a new Player Class
|
|
5679
5692
|
* class PlayerEntity extends me.Sprite {
|
|
@@ -5706,32 +5719,23 @@ export class Renderable extends Rect {
|
|
|
5706
5719
|
*
|
|
5707
5720
|
* }
|
|
5708
5721
|
*/
|
|
5709
|
-
|
|
5722
|
+
body: Body;
|
|
5710
5723
|
/**
|
|
5711
5724
|
* the renderable default transformation matrix
|
|
5712
|
-
* @public
|
|
5713
5725
|
* @type {Matrix2d}
|
|
5714
|
-
* @name currentTransform
|
|
5715
|
-
* @memberof Renderable#
|
|
5716
5726
|
*/
|
|
5717
|
-
|
|
5727
|
+
currentTransform: Matrix2d;
|
|
5718
5728
|
/**
|
|
5719
5729
|
* (G)ame (U)nique (Id)entifier" <br>
|
|
5720
5730
|
* a GUID will be allocated for any renderable object added <br>
|
|
5721
5731
|
* to an object container (including the `me.game.world` container)
|
|
5722
|
-
* @public
|
|
5723
5732
|
* @type {string}
|
|
5724
|
-
* @name GUID
|
|
5725
|
-
* @memberof Renderable
|
|
5726
5733
|
*/
|
|
5727
|
-
|
|
5734
|
+
GUID: string;
|
|
5728
5735
|
/**
|
|
5729
5736
|
* an event handler that is called when the renderable leave or enter a camera viewport
|
|
5730
|
-
* @public
|
|
5731
5737
|
* @type {Function}
|
|
5732
5738
|
* @default undefined
|
|
5733
|
-
* @name onVisibilityChange
|
|
5734
|
-
* @memberof Renderable#
|
|
5735
5739
|
* @example
|
|
5736
5740
|
* this.onVisibilityChange = function(inViewport) {
|
|
5737
5741
|
* if (inViewport === true) {
|
|
@@ -5739,44 +5743,32 @@ export class Renderable extends Rect {
|
|
|
5739
5743
|
* }
|
|
5740
5744
|
* };
|
|
5741
5745
|
*/
|
|
5742
|
-
|
|
5746
|
+
onVisibilityChange: Function;
|
|
5743
5747
|
/**
|
|
5744
5748
|
* Whether the renderable object will always update, even when outside of the viewport<br>
|
|
5745
|
-
* @public
|
|
5746
5749
|
* @type {boolean}
|
|
5747
5750
|
* @default false
|
|
5748
|
-
* @name alwaysUpdate
|
|
5749
|
-
* @memberof Renderable
|
|
5750
5751
|
*/
|
|
5751
|
-
|
|
5752
|
+
alwaysUpdate: boolean;
|
|
5752
5753
|
/**
|
|
5753
5754
|
* Whether to update this object when the game is paused.
|
|
5754
|
-
* @public
|
|
5755
5755
|
* @type {boolean}
|
|
5756
5756
|
* @default false
|
|
5757
|
-
* @name updateWhenPaused
|
|
5758
|
-
* @memberof Renderable
|
|
5759
5757
|
*/
|
|
5760
|
-
|
|
5758
|
+
updateWhenPaused: boolean;
|
|
5761
5759
|
/**
|
|
5762
5760
|
* make the renderable object persistent over level changes<br>
|
|
5763
|
-
* @public
|
|
5764
5761
|
* @type {boolean}
|
|
5765
5762
|
* @default false
|
|
5766
|
-
* @name isPersistent
|
|
5767
|
-
* @memberof Renderable
|
|
5768
5763
|
*/
|
|
5769
|
-
|
|
5764
|
+
isPersistent: boolean;
|
|
5770
5765
|
/**
|
|
5771
5766
|
* If true, this renderable will be rendered using screen coordinates,
|
|
5772
5767
|
* as opposed to world coordinates. Use this, for example, to define UI elements.
|
|
5773
|
-
* @public
|
|
5774
5768
|
* @type {boolean}
|
|
5775
5769
|
* @default false
|
|
5776
|
-
* @name floating
|
|
5777
|
-
* @memberof Renderable
|
|
5778
5770
|
*/
|
|
5779
|
-
|
|
5771
|
+
floating: boolean;
|
|
5780
5772
|
/**
|
|
5781
5773
|
* The anchor point is used for attachment behavior, and/or when applying transformations.<br>
|
|
5782
5774
|
* The coordinate system places the origin at the top left corner of the frame (0, 0) and (1, 1) means the bottom-right corner<br>
|
|
@@ -5785,21 +5777,15 @@ export class Renderable extends Rect {
|
|
|
5785
5777
|
* <br>
|
|
5786
5778
|
* <i><b>Note:</b> Object created through Tiled will have their anchorPoint set to (0, 0) to match Tiled Level editor implementation.
|
|
5787
5779
|
* To specify a value through Tiled, use a json expression like `json:{"x":0.5,"y":0.5}`. </i>
|
|
5788
|
-
* @public
|
|
5789
5780
|
* @type {ObservableVector2d}
|
|
5790
5781
|
* @default <0.5,0.5>
|
|
5791
|
-
* @name anchorPoint
|
|
5792
|
-
* @memberof Renderable#
|
|
5793
5782
|
*/
|
|
5794
|
-
|
|
5783
|
+
anchorPoint: ObservableVector2d;
|
|
5795
5784
|
/**
|
|
5796
5785
|
* When enabled, an object container will automatically apply
|
|
5797
5786
|
* any defined transformation before calling the child draw method.
|
|
5798
|
-
* @public
|
|
5799
5787
|
* @type {boolean}
|
|
5800
5788
|
* @default true
|
|
5801
|
-
* @name autoTransform
|
|
5802
|
-
* @memberof Renderable
|
|
5803
5789
|
* @example
|
|
5804
5790
|
* // enable "automatic" transformation when the object is activated
|
|
5805
5791
|
* onActivateEvent: function () {
|
|
@@ -5812,34 +5798,27 @@ export class Renderable extends Rect {
|
|
|
5812
5798
|
* ....
|
|
5813
5799
|
* }
|
|
5814
5800
|
*/
|
|
5815
|
-
|
|
5801
|
+
autoTransform: boolean;
|
|
5816
5802
|
/**
|
|
5817
5803
|
* Define the renderable opacity<br>
|
|
5818
5804
|
* Set to zero if you do not wish an object to be drawn
|
|
5819
5805
|
* @see Renderable#setOpacity
|
|
5820
5806
|
* @see Renderable#getOpacity
|
|
5821
|
-
* @public
|
|
5822
5807
|
* @type {number}
|
|
5823
5808
|
* @default 1.0
|
|
5824
|
-
* @name Renderable#alpha
|
|
5825
5809
|
*/
|
|
5826
|
-
|
|
5810
|
+
alpha: number;
|
|
5827
5811
|
/**
|
|
5828
5812
|
* a reference to the parent object that contains this renderable
|
|
5829
|
-
* @public
|
|
5830
5813
|
* @type {Container|Entity}
|
|
5831
5814
|
* @default undefined
|
|
5832
|
-
* @name Renderable#ancestor
|
|
5833
5815
|
*/
|
|
5834
|
-
|
|
5816
|
+
ancestor: Container | Entity;
|
|
5835
5817
|
/**
|
|
5836
5818
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
5837
5819
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
5838
|
-
* @public
|
|
5839
5820
|
* @type {Rect|RoundRect|Polygon|Line|Ellipse}
|
|
5840
|
-
* @name mask
|
|
5841
5821
|
* @default undefined
|
|
5842
|
-
* @memberof Renderable#
|
|
5843
5822
|
* @example
|
|
5844
5823
|
* // apply a mask in the shape of a Star
|
|
5845
5824
|
* myNPCSprite.mask = new me.Polygon(myNPCSprite.width / 2, 0, [
|
|
@@ -5856,55 +5835,31 @@ export class Renderable extends Rect {
|
|
|
5856
5835
|
* {x: -14, y: 30}
|
|
5857
5836
|
* ]);
|
|
5858
5837
|
*/
|
|
5859
|
-
|
|
5860
|
-
/**
|
|
5861
|
-
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
5862
|
-
* @public
|
|
5863
|
-
* @type {Color}
|
|
5864
|
-
* @name tint
|
|
5865
|
-
* @default (255, 255, 255)
|
|
5866
|
-
* @memberof Renderable#
|
|
5867
|
-
* @example
|
|
5868
|
-
* // add a red tint to this renderable
|
|
5869
|
-
* this.tint.setColor(255, 128, 128);
|
|
5870
|
-
* // remove the tint
|
|
5871
|
-
* this.tint.setColor(255, 255, 255);
|
|
5872
|
-
*/
|
|
5873
|
-
public tint: Color;
|
|
5838
|
+
mask: Rect | RoundRect | Polygon | Line | Ellipse;
|
|
5874
5839
|
/**
|
|
5875
5840
|
* the blend mode to be applied to this renderable (see renderer setBlendMode for available blend mode)
|
|
5876
|
-
* @public
|
|
5877
5841
|
* @type {string}
|
|
5878
|
-
* @name blendMode
|
|
5879
5842
|
* @default "normal"
|
|
5880
5843
|
* @see CanvasRenderer#setBlendMode
|
|
5881
5844
|
* @see WebGLRenderer#setBlendMode
|
|
5882
|
-
* @memberof Renderable#
|
|
5883
5845
|
*/
|
|
5884
|
-
|
|
5846
|
+
blendMode: string;
|
|
5885
5847
|
/**
|
|
5886
5848
|
* The name of the renderable
|
|
5887
|
-
* @public
|
|
5888
5849
|
* @type {string}
|
|
5889
|
-
* @name name
|
|
5890
5850
|
* @default ""
|
|
5891
|
-
* @memberof Renderable
|
|
5892
5851
|
*/
|
|
5893
|
-
|
|
5852
|
+
name: string;
|
|
5894
5853
|
/**
|
|
5895
5854
|
* Position of the Renderable relative to its parent container
|
|
5896
5855
|
* @public
|
|
5897
5856
|
* @type {ObservableVector3d}
|
|
5898
|
-
* @name pos
|
|
5899
|
-
* @memberof Renderable#
|
|
5900
5857
|
*/
|
|
5901
5858
|
public pos: ObservableVector3d;
|
|
5902
5859
|
/**
|
|
5903
5860
|
* when true the renderable will be redrawn during the next update cycle
|
|
5904
5861
|
* @type {boolean}
|
|
5905
|
-
* @name isDirty
|
|
5906
5862
|
* @default false
|
|
5907
|
-
* @memberof Renderable#
|
|
5908
5863
|
*/
|
|
5909
5864
|
isDirty: boolean;
|
|
5910
5865
|
_flip: {
|
|
@@ -5914,30 +5869,35 @@ export class Renderable extends Rect {
|
|
|
5914
5869
|
_inViewport: boolean;
|
|
5915
5870
|
/**
|
|
5916
5871
|
* Whether the renderable object is floating, or contained in a floating container
|
|
5917
|
-
* @public
|
|
5918
5872
|
* @see Renderable#floating
|
|
5919
5873
|
* @type {boolean}
|
|
5920
|
-
* @name isFloating
|
|
5921
|
-
* @memberof Renderable
|
|
5922
5874
|
*/
|
|
5923
|
-
|
|
5924
|
-
|
|
5875
|
+
get isFloating(): boolean;
|
|
5876
|
+
set tint(arg: Color);
|
|
5877
|
+
/**
|
|
5878
|
+
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
5879
|
+
* @type {Color}
|
|
5880
|
+
* @default (255, 255, 255)
|
|
5881
|
+
* @example
|
|
5882
|
+
* // add a red tint to this renderable
|
|
5883
|
+
* this.tint.setColor(255, 128, 128);
|
|
5884
|
+
* // remove the tint
|
|
5885
|
+
* this.tint.setColor(255, 255, 255);
|
|
5886
|
+
*/
|
|
5887
|
+
get tint(): Color;
|
|
5888
|
+
_tint: any;
|
|
5889
|
+
set inViewport(arg: boolean);
|
|
5925
5890
|
/**
|
|
5926
5891
|
* Whether the renderable object is visible and within the viewport
|
|
5927
|
-
* @public
|
|
5928
5892
|
* @type {boolean}
|
|
5929
5893
|
* @default false
|
|
5930
|
-
* @name inViewport
|
|
5931
|
-
* @memberof Renderable
|
|
5932
5894
|
*/
|
|
5933
|
-
|
|
5895
|
+
get inViewport(): boolean;
|
|
5934
5896
|
/**
|
|
5935
5897
|
* returns true if this renderable is flipped on the horizontal axis
|
|
5936
5898
|
* @public
|
|
5937
5899
|
* @see Renderable#flipX
|
|
5938
5900
|
* @type {boolean}
|
|
5939
|
-
* @name isFlippedX
|
|
5940
|
-
* @memberof Renderable
|
|
5941
5901
|
*/
|
|
5942
5902
|
public get isFlippedX(): boolean;
|
|
5943
5903
|
/**
|
|
@@ -5945,29 +5905,21 @@ export class Renderable extends Rect {
|
|
|
5945
5905
|
* @public
|
|
5946
5906
|
* @see Renderable#flipY
|
|
5947
5907
|
* @type {boolean}
|
|
5948
|
-
* @name isFlippedY
|
|
5949
|
-
* @memberof Renderable
|
|
5950
5908
|
*/
|
|
5951
5909
|
public get isFlippedY(): boolean;
|
|
5952
5910
|
/**
|
|
5953
5911
|
* get the renderable alpha channel value<br>
|
|
5954
|
-
* @name getOpacity
|
|
5955
|
-
* @memberof Renderable
|
|
5956
5912
|
* @returns {number} current opacity value between 0 and 1
|
|
5957
5913
|
*/
|
|
5958
5914
|
getOpacity(): number;
|
|
5959
5915
|
/**
|
|
5960
5916
|
* set the renderable alpha channel value<br>
|
|
5961
|
-
* @name setOpacity
|
|
5962
|
-
* @memberof Renderable
|
|
5963
5917
|
* @param {number} alpha opacity value between 0.0 and 1.0
|
|
5964
5918
|
*/
|
|
5965
5919
|
setOpacity(alpha: number): void;
|
|
5966
5920
|
/**
|
|
5967
5921
|
* flip the renderable on the horizontal axis (around the center of the renderable)
|
|
5968
5922
|
* @see Matrix2d#scaleX
|
|
5969
|
-
* @name flipX
|
|
5970
|
-
* @memberof Renderable
|
|
5971
5923
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
5972
5924
|
* @returns {Renderable} Reference to this object for method chaining
|
|
5973
5925
|
*/
|
|
@@ -5975,16 +5927,12 @@ export class Renderable extends Rect {
|
|
|
5975
5927
|
/**
|
|
5976
5928
|
* flip the renderable on the vertical axis (around the center of the renderable)
|
|
5977
5929
|
* @see Matrix2d#scaleY
|
|
5978
|
-
* @name flipY
|
|
5979
|
-
* @memberof Renderable
|
|
5980
5930
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
5981
5931
|
* @returns {Renderable} Reference to this object for method chaining
|
|
5982
5932
|
*/
|
|
5983
5933
|
flipY(flip?: boolean): Renderable;
|
|
5984
5934
|
/**
|
|
5985
5935
|
* multiply the renderable currentTransform with the given matrix
|
|
5986
|
-
* @name transform
|
|
5987
|
-
* @memberof Renderable
|
|
5988
5936
|
* @see Renderable#currentTransform
|
|
5989
5937
|
* @param {Matrix2d} m the transformation matrix
|
|
5990
5938
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -5992,32 +5940,24 @@ export class Renderable extends Rect {
|
|
|
5992
5940
|
transform(m: Matrix2d): Renderable;
|
|
5993
5941
|
/**
|
|
5994
5942
|
* return the angle to the specified target
|
|
5995
|
-
* @name angleTo
|
|
5996
|
-
* @memberof Renderable
|
|
5997
5943
|
* @param {Renderable|Vector2d|Vector3d} target
|
|
5998
5944
|
* @returns {number} angle in radians
|
|
5999
5945
|
*/
|
|
6000
5946
|
angleTo(target: Renderable | Vector2d | Vector3d): number;
|
|
6001
5947
|
/**
|
|
6002
5948
|
* return the distance to the specified target
|
|
6003
|
-
* @name distanceTo
|
|
6004
|
-
* @memberof Renderable
|
|
6005
5949
|
* @param {Renderable|Vector2d|Vector3d} target
|
|
6006
5950
|
* @returns {number} distance
|
|
6007
5951
|
*/
|
|
6008
5952
|
distanceTo(target: Renderable | Vector2d | Vector3d): number;
|
|
6009
5953
|
/**
|
|
6010
5954
|
* Rotate this renderable towards the given target.
|
|
6011
|
-
* @name lookAt
|
|
6012
|
-
* @memberof Renderable
|
|
6013
5955
|
* @param {Renderable|Vector2d|Vector3d} target the renderable or position to look at
|
|
6014
5956
|
* @returns {Renderable} Reference to this object for method chaining
|
|
6015
5957
|
*/
|
|
6016
5958
|
lookAt(target: Renderable | Vector2d | Vector3d): Renderable;
|
|
6017
5959
|
/**
|
|
6018
5960
|
* Rotate this renderable by the specified angle (in radians).
|
|
6019
|
-
* @name rotate
|
|
6020
|
-
* @memberof Renderable
|
|
6021
5961
|
* @param {number} angle The angle to rotate (in radians)
|
|
6022
5962
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
6023
5963
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -6029,8 +5969,6 @@ export class Renderable extends Rect {
|
|
|
6029
5969
|
* when rendering. It does not scale the object itself. For example if the renderable
|
|
6030
5970
|
* is an image, the image.width and image.height properties are unaltered but the currentTransform
|
|
6031
5971
|
* member will be changed.
|
|
6032
|
-
* @name scale
|
|
6033
|
-
* @memberof Renderable
|
|
6034
5972
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
6035
5973
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
6036
5974
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -6038,33 +5976,23 @@ export class Renderable extends Rect {
|
|
|
6038
5976
|
scale(x: number, y?: number): Renderable;
|
|
6039
5977
|
/**
|
|
6040
5978
|
* scale the renderable around his anchor point
|
|
6041
|
-
* @name scaleV
|
|
6042
|
-
* @memberof Renderable
|
|
6043
5979
|
* @param {Vector2d} v scaling vector
|
|
6044
5980
|
* @returns {Renderable} Reference to this object for method chaining
|
|
6045
5981
|
*/
|
|
6046
5982
|
scaleV(v: Vector2d): Renderable;
|
|
6047
5983
|
/**
|
|
6048
|
-
* update function.
|
|
6049
|
-
* automatically called by the game manager {@link game}
|
|
6050
|
-
* @name update
|
|
6051
|
-
* @memberof Renderable
|
|
6052
|
-
* @protected
|
|
5984
|
+
* update function (automatically called by melonJS).
|
|
6053
5985
|
* @param {number} dt time since the last update in milliseconds.
|
|
6054
5986
|
* @returns {boolean} true if the renderable is dirty
|
|
6055
5987
|
*/
|
|
6056
|
-
|
|
5988
|
+
update(dt: number): boolean;
|
|
6057
5989
|
/**
|
|
6058
5990
|
* update the renderable's bounding rect (private)
|
|
6059
5991
|
* @ignore
|
|
6060
|
-
* @name updateBoundsPos
|
|
6061
|
-
* @memberof Renderable
|
|
6062
5992
|
*/
|
|
6063
5993
|
updateBoundsPos(newX: any, newY: any): void;
|
|
6064
5994
|
/**
|
|
6065
5995
|
* return the renderable absolute position in the game world
|
|
6066
|
-
* @name getAbsolutePosition
|
|
6067
|
-
* @memberof Renderable
|
|
6068
5996
|
* @returns {Vector2d}
|
|
6069
5997
|
*/
|
|
6070
5998
|
getAbsolutePosition(): Vector2d;
|
|
@@ -6072,45 +6000,42 @@ export class Renderable extends Rect {
|
|
|
6072
6000
|
/**
|
|
6073
6001
|
* called when the anchor point value is changed
|
|
6074
6002
|
* @private
|
|
6075
|
-
* @name onAnchorUpdate
|
|
6076
|
-
* @memberof Renderable
|
|
6077
6003
|
* @param {number} x the new X value to be set for the anchor
|
|
6078
6004
|
* @param {number} y the new Y value to be set for the anchor
|
|
6079
6005
|
*/
|
|
6080
6006
|
private onAnchorUpdate;
|
|
6081
6007
|
/**
|
|
6082
|
-
*
|
|
6083
|
-
*
|
|
6084
|
-
*
|
|
6085
|
-
* @
|
|
6086
|
-
* @memberof Renderable
|
|
6087
|
-
* @protected
|
|
6008
|
+
* Prepare the rendering context before drawing (automatically called by melonJS).
|
|
6009
|
+
* This will apply any defined transforms, anchor point, tint or blend mode and translate the context accordingly to this renderable position.
|
|
6010
|
+
* @see Renderable#draw
|
|
6011
|
+
* @see Renderable#postDraw
|
|
6088
6012
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
6089
6013
|
*/
|
|
6090
|
-
|
|
6091
|
-
/**
|
|
6092
|
-
*
|
|
6093
|
-
*
|
|
6094
|
-
*
|
|
6095
|
-
*
|
|
6014
|
+
preDraw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
6015
|
+
/**
|
|
6016
|
+
* Draw this renderable (automatically called by melonJS).
|
|
6017
|
+
* All draw operations for renderable are made respectively
|
|
6018
|
+
* to the position or transforms set or applied by the preDraw method.
|
|
6019
|
+
* The main draw loop will first call preDraw() to prepare the context for drawing the renderable,
|
|
6020
|
+
* then draw() to draw the renderable, and finally postDraw() to clear the context.
|
|
6021
|
+
* If you override this method, be mindful about the drawing logic; for example if you draw a shape
|
|
6022
|
+
* from the draw method, you should make sure that your draw it at the 0, 0 coordinates.
|
|
6023
|
+
* @see Renderable#preDraw
|
|
6024
|
+
* @see Renderable#postDraw
|
|
6096
6025
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
6097
6026
|
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
6098
6027
|
*/
|
|
6099
|
-
|
|
6028
|
+
draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
|
|
6100
6029
|
/**
|
|
6101
|
-
* restore the rendering context after drawing.
|
|
6102
|
-
*
|
|
6103
|
-
* @
|
|
6104
|
-
* @memberof Renderable
|
|
6105
|
-
* @protected
|
|
6030
|
+
* restore the rendering context after drawing (automatically called by melonJS).
|
|
6031
|
+
* @see Renderable#preDraw
|
|
6032
|
+
* @see Renderable#draw
|
|
6106
6033
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
6107
6034
|
*/
|
|
6108
|
-
|
|
6035
|
+
postDraw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
6109
6036
|
/**
|
|
6110
6037
|
* onCollision callback, triggered in case of collision,
|
|
6111
6038
|
* when this renderable body is colliding with another one
|
|
6112
|
-
* @name onCollision
|
|
6113
|
-
* @memberof Renderable
|
|
6114
6039
|
* @param {ResponseObject} response the collision response object
|
|
6115
6040
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
6116
6041
|
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
@@ -6137,8 +6062,6 @@ export class Renderable extends Rect {
|
|
|
6137
6062
|
/**
|
|
6138
6063
|
* OnDestroy Notification function<br>
|
|
6139
6064
|
* Called by engine before deleting the object
|
|
6140
|
-
* @name onDestroyEvent
|
|
6141
|
-
* @memberof Renderable
|
|
6142
6065
|
*/
|
|
6143
6066
|
onDestroyEvent(): void;
|
|
6144
6067
|
}
|
|
@@ -6152,10 +6075,10 @@ export class Renderer {
|
|
|
6152
6075
|
* @param {number} options.width The width of the canvas without scaling
|
|
6153
6076
|
* @param {number} options.height The height of the canvas without scaling
|
|
6154
6077
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
6155
|
-
* @param {boolean} [options.doubleBuffering=false] Whether to enable double buffering (not applicable when using the WebGL Renderer)
|
|
6156
6078
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing, use false (default) for a pixelated effect.
|
|
6157
6079
|
* @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.
|
|
6158
|
-
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
6080
|
+
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
6081
|
+
* @param {boolean} [options.premultipliedAlpha=true] in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
6159
6082
|
* @param {boolean} [options.blendMode="normal"] the default blend mode to use ("normal", "multiply")
|
|
6160
6083
|
* @param {boolean} [options.subPixel=false] Whether to enable subpixel rendering (performance hit when enabled)
|
|
6161
6084
|
* @param {boolean} [options.verbose=false] Enable the verbose mode that provides additional details as to what the renderer is doing
|
|
@@ -6166,10 +6089,10 @@ export class Renderer {
|
|
|
6166
6089
|
width: number;
|
|
6167
6090
|
height: number;
|
|
6168
6091
|
canvas?: HTMLCanvasElement;
|
|
6169
|
-
doubleBuffering?: boolean;
|
|
6170
6092
|
antiAlias?: boolean;
|
|
6171
6093
|
failIfMajorPerformanceCaveat?: boolean;
|
|
6172
6094
|
transparent?: boolean;
|
|
6095
|
+
premultipliedAlpha?: boolean;
|
|
6173
6096
|
blendMode?: boolean;
|
|
6174
6097
|
subPixel?: boolean;
|
|
6175
6098
|
verbose?: boolean;
|
|
@@ -6179,24 +6102,18 @@ export class Renderer {
|
|
|
6179
6102
|
/**
|
|
6180
6103
|
* The given constructor options
|
|
6181
6104
|
* @public
|
|
6182
|
-
* @name settings
|
|
6183
|
-
* @memberof Renderer#
|
|
6184
6105
|
* @type {object}
|
|
6185
6106
|
*/
|
|
6186
6107
|
public settings: object;
|
|
6187
6108
|
/**
|
|
6188
6109
|
* true if the current rendering context is valid
|
|
6189
|
-
* @name isContextValid
|
|
6190
|
-
* @memberof Renderer#
|
|
6191
6110
|
* @default true
|
|
6192
|
-
* type {boolean}
|
|
6111
|
+
* @type {boolean}
|
|
6193
6112
|
*/
|
|
6194
6113
|
isContextValid: boolean;
|
|
6195
6114
|
/**
|
|
6196
6115
|
* The Path2D instance used by the renderer to draw primitives
|
|
6197
|
-
* @name path2D
|
|
6198
6116
|
* @type {Path2D}
|
|
6199
|
-
* @memberof Renderer#
|
|
6200
6117
|
*/
|
|
6201
6118
|
path2D: Path2D;
|
|
6202
6119
|
/**
|
|
@@ -6212,58 +6129,40 @@ export class Renderer {
|
|
|
6212
6129
|
*/
|
|
6213
6130
|
currentBlendMode: string;
|
|
6214
6131
|
canvas: any;
|
|
6215
|
-
backBufferCanvas: any;
|
|
6216
|
-
context: any;
|
|
6217
6132
|
currentColor: Color;
|
|
6218
6133
|
currentTint: Color;
|
|
6219
6134
|
projectionMatrix: Matrix3d;
|
|
6220
6135
|
uvOffset: number;
|
|
6221
6136
|
/**
|
|
6222
6137
|
* prepare the framebuffer for drawing a new frame
|
|
6223
|
-
* @name clear
|
|
6224
|
-
* @memberof Renderer
|
|
6225
6138
|
*/
|
|
6226
6139
|
clear(): void;
|
|
6140
|
+
/**
|
|
6141
|
+
* render the main framebuffer on screen
|
|
6142
|
+
*/
|
|
6143
|
+
flush(): void;
|
|
6227
6144
|
/**
|
|
6228
6145
|
* Reset context state
|
|
6229
|
-
* @name reset
|
|
6230
|
-
* @memberof Renderer
|
|
6231
6146
|
*/
|
|
6232
6147
|
reset(): void;
|
|
6233
6148
|
/**
|
|
6234
|
-
* return a reference to the
|
|
6235
|
-
* @name getCanvas
|
|
6236
|
-
* @memberof Renderer
|
|
6149
|
+
* return a reference to the canvas which this renderer draws to
|
|
6237
6150
|
* @returns {HTMLCanvasElement}
|
|
6238
6151
|
*/
|
|
6239
6152
|
getCanvas(): HTMLCanvasElement;
|
|
6240
6153
|
/**
|
|
6241
|
-
* return a reference to
|
|
6242
|
-
* @
|
|
6243
|
-
* @memberof Renderer
|
|
6244
|
-
* @returns {HTMLCanvasElement}
|
|
6154
|
+
* return a reference to this renderer canvas corresponding Context
|
|
6155
|
+
* @returns {CanvasRenderingContext2D|WebGLRenderingContext}
|
|
6245
6156
|
*/
|
|
6246
|
-
|
|
6247
|
-
/**
|
|
6248
|
-
* return a reference to the screen canvas corresponding 2d Context<br>
|
|
6249
|
-
* (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
|
|
6250
|
-
* @name getScreenContext
|
|
6251
|
-
* @memberof Renderer
|
|
6252
|
-
* @returns {CanvasRenderingContext2D}
|
|
6253
|
-
*/
|
|
6254
|
-
getScreenContext(): CanvasRenderingContext2D;
|
|
6157
|
+
getContext(): CanvasRenderingContext2D | WebGLRenderingContext;
|
|
6255
6158
|
/**
|
|
6256
6159
|
* returns the current blend mode for this renderer
|
|
6257
|
-
* @name getBlendMode
|
|
6258
|
-
* @memberof Renderer
|
|
6259
6160
|
* @returns {string} blend mode
|
|
6260
6161
|
*/
|
|
6261
6162
|
getBlendMode(): string;
|
|
6262
6163
|
/**
|
|
6263
6164
|
* Returns the 2D Context object of the given Canvas<br>
|
|
6264
6165
|
* Also configures anti-aliasing and blend modes based on constructor options.
|
|
6265
|
-
* @name getContext2d
|
|
6266
|
-
* @memberof Renderer
|
|
6267
6166
|
* @param {HTMLCanvasElement} canvas
|
|
6268
6167
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
6269
6168
|
* @returns {CanvasRenderingContext2D}
|
|
@@ -6271,67 +6170,49 @@ export class Renderer {
|
|
|
6271
6170
|
getContext2d(canvas: HTMLCanvasElement, transparent?: boolean): CanvasRenderingContext2D;
|
|
6272
6171
|
/**
|
|
6273
6172
|
* return the width of the system Canvas
|
|
6274
|
-
* @name getWidth
|
|
6275
|
-
* @memberof Renderer
|
|
6276
6173
|
* @returns {number}
|
|
6277
6174
|
*/
|
|
6278
6175
|
getWidth(): number;
|
|
6279
6176
|
/**
|
|
6280
6177
|
* return the height of the system Canvas
|
|
6281
|
-
* @name getHeight
|
|
6282
|
-
* @memberof Renderer
|
|
6283
6178
|
* @returns {number} height of the system Canvas
|
|
6284
6179
|
*/
|
|
6285
6180
|
getHeight(): number;
|
|
6286
6181
|
/**
|
|
6287
6182
|
* get the current fill & stroke style color.
|
|
6288
|
-
* @name getColor
|
|
6289
|
-
* @memberof Renderer
|
|
6290
6183
|
* @returns {Color} current global color
|
|
6291
6184
|
*/
|
|
6292
6185
|
getColor(): Color;
|
|
6293
6186
|
/**
|
|
6294
6187
|
* return the current global alpha
|
|
6295
|
-
* @name globalAlpha
|
|
6296
|
-
* @memberof Renderer
|
|
6297
6188
|
* @returns {number}
|
|
6298
6189
|
*/
|
|
6299
6190
|
globalAlpha(): number;
|
|
6300
6191
|
/**
|
|
6301
6192
|
* check if the given rect or bounds overlaps with the renderer screen coordinates
|
|
6302
|
-
* @name overlaps
|
|
6303
|
-
* @memberof Renderer
|
|
6304
6193
|
* @param {Rect|Bounds} bounds
|
|
6305
6194
|
* @returns {boolean} true if overlaps
|
|
6306
6195
|
*/
|
|
6307
6196
|
overlaps(bounds: Rect | Bounds): boolean;
|
|
6308
6197
|
/**
|
|
6309
6198
|
* resizes the system canvas
|
|
6310
|
-
* @name resize
|
|
6311
|
-
* @memberof Renderer
|
|
6312
6199
|
* @param {number} width new width of the canvas
|
|
6313
6200
|
* @param {number} height new height of the canvas
|
|
6314
6201
|
*/
|
|
6315
6202
|
resize(width: number, height: number): void;
|
|
6316
6203
|
/**
|
|
6317
6204
|
* enable/disable image smoothing (scaling interpolation) for the given context
|
|
6318
|
-
* @name setAntiAlias
|
|
6319
|
-
* @memberof Renderer
|
|
6320
6205
|
* @param {CanvasRenderingContext2D} context
|
|
6321
6206
|
* @param {boolean} [enable=false]
|
|
6322
6207
|
*/
|
|
6323
6208
|
setAntiAlias(context: CanvasRenderingContext2D, enable?: boolean): void;
|
|
6324
6209
|
/**
|
|
6325
6210
|
* set/change the current projection matrix (WebGL only)
|
|
6326
|
-
* @name setProjection
|
|
6327
|
-
* @memberof Renderer
|
|
6328
6211
|
* @param {Matrix3d} matrix
|
|
6329
6212
|
*/
|
|
6330
6213
|
setProjection(matrix: Matrix3d): void;
|
|
6331
6214
|
/**
|
|
6332
6215
|
* stroke the given shape
|
|
6333
|
-
* @name stroke
|
|
6334
|
-
* @memberof Renderer
|
|
6335
6216
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
6336
6217
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
6337
6218
|
*/
|
|
@@ -6345,8 +6226,6 @@ export class Renderer {
|
|
|
6345
6226
|
fill(shape: Rect | RoundRect | Polygon | Line | Ellipse): void;
|
|
6346
6227
|
/**
|
|
6347
6228
|
* tint the given image or canvas using the given color
|
|
6348
|
-
* @name tint
|
|
6349
|
-
* @memberof Renderer
|
|
6350
6229
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
|
|
6351
6230
|
* @param {Color|string} color the color that will be used to tint the image
|
|
6352
6231
|
* @param {string} [mode="multiply"] the composition mode used to tint the image
|
|
@@ -6357,32 +6236,24 @@ export class Renderer {
|
|
|
6357
6236
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
6358
6237
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
6359
6238
|
* Mask are not preserved through renderer context save and restore.
|
|
6360
|
-
* @name setMask
|
|
6361
|
-
* @memberof Renderer
|
|
6362
6239
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
6363
6240
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
6364
6241
|
*/
|
|
6365
6242
|
setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse): void;
|
|
6366
6243
|
/**
|
|
6367
6244
|
* disable (remove) the rendering mask set through setMask.
|
|
6368
|
-
* @name clearMask
|
|
6369
6245
|
* @see Renderer#setMask
|
|
6370
|
-
* @memberof Renderer
|
|
6371
6246
|
*/
|
|
6372
6247
|
clearMask(): void;
|
|
6373
6248
|
/**
|
|
6374
6249
|
* set a coloring tint for sprite based renderables
|
|
6375
|
-
* @name setTint
|
|
6376
|
-
* @memberof Renderer
|
|
6377
6250
|
* @param {Color} tint the tint color
|
|
6378
6251
|
* @param {number} [alpha] an alpha value to be applied to the tint
|
|
6379
6252
|
*/
|
|
6380
6253
|
setTint(tint: Color, alpha?: number): void;
|
|
6381
6254
|
/**
|
|
6382
6255
|
* clear the rendering tint set through setTint.
|
|
6383
|
-
* @name clearTint
|
|
6384
6256
|
* @see Renderer#setTint
|
|
6385
|
-
* @memberof Renderer
|
|
6386
6257
|
*/
|
|
6387
6258
|
clearTint(): void;
|
|
6388
6259
|
/**
|
|
@@ -6390,6 +6261,25 @@ export class Renderer {
|
|
|
6390
6261
|
*/
|
|
6391
6262
|
drawFont(): void;
|
|
6392
6263
|
get Texture(): typeof TextureAtlas;
|
|
6264
|
+
/**
|
|
6265
|
+
* return a reference to the screen canvas
|
|
6266
|
+
* @name getScreenCanvas
|
|
6267
|
+
* @memberof Renderer
|
|
6268
|
+
* @returns {HTMLCanvasElement}
|
|
6269
|
+
* @deprecated since 13.1.0
|
|
6270
|
+
* @see getCanvas();
|
|
6271
|
+
*/
|
|
6272
|
+
getScreenCanvas(): HTMLCanvasElement;
|
|
6273
|
+
/**
|
|
6274
|
+
* return a reference to the screen canvas corresponding 2d Context<br>
|
|
6275
|
+
* (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
|
|
6276
|
+
* @name getScreenContext
|
|
6277
|
+
* @memberof Renderer
|
|
6278
|
+
* @returns {CanvasRenderingContext2D}
|
|
6279
|
+
* @deprecated since 13.1.0
|
|
6280
|
+
* @see getContext();
|
|
6281
|
+
*/
|
|
6282
|
+
getScreenContext(): CanvasRenderingContext2D;
|
|
6393
6283
|
}
|
|
6394
6284
|
/**
|
|
6395
6285
|
* @classdesc
|
|
@@ -6997,6 +6887,14 @@ export class TMXLayer extends Renderable {
|
|
|
6997
6887
|
* @name TMXLayer#renderorder
|
|
6998
6888
|
*/
|
|
6999
6889
|
public renderorder: string;
|
|
6890
|
+
/**
|
|
6891
|
+
* the layer class
|
|
6892
|
+
* @public
|
|
6893
|
+
* @type {string}
|
|
6894
|
+
* @name class
|
|
6895
|
+
* @name TMXLayer#class
|
|
6896
|
+
*/
|
|
6897
|
+
public class: string;
|
|
7000
6898
|
name: any;
|
|
7001
6899
|
cols: number;
|
|
7002
6900
|
rows: number;
|
|
@@ -7328,6 +7226,13 @@ export class TMXTileMap {
|
|
|
7328
7226
|
* @name TMXTileMap#tiledversion
|
|
7329
7227
|
*/
|
|
7330
7228
|
public tiledversion: string;
|
|
7229
|
+
/**
|
|
7230
|
+
* The map class.
|
|
7231
|
+
* @public
|
|
7232
|
+
* @type {string}
|
|
7233
|
+
* @name TMXTileMap#class
|
|
7234
|
+
*/
|
|
7235
|
+
public class: string;
|
|
7331
7236
|
tilesets: TMXTilesetGroup;
|
|
7332
7237
|
layers: any[];
|
|
7333
7238
|
objectGroups: any[];
|
|
@@ -7433,6 +7338,13 @@ export class TMXTileset {
|
|
|
7433
7338
|
* @name TMXTileset#isCollection
|
|
7434
7339
|
*/
|
|
7435
7340
|
public isCollection: boolean;
|
|
7341
|
+
/**
|
|
7342
|
+
* the tileset class
|
|
7343
|
+
* @public
|
|
7344
|
+
* @type {boolean}
|
|
7345
|
+
* @name TMXTileset#class
|
|
7346
|
+
*/
|
|
7347
|
+
public class: boolean;
|
|
7436
7348
|
/**
|
|
7437
7349
|
* Tileset animations
|
|
7438
7350
|
* @private
|
|
@@ -8463,6 +8375,15 @@ export class Vector2d {
|
|
|
8463
8375
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
8464
8376
|
*/
|
|
8465
8377
|
lerp(v: Vector2d, alpha: number): Vector2d;
|
|
8378
|
+
/**
|
|
8379
|
+
* interpolate the position of this vector towards the given one by the given maximum step.
|
|
8380
|
+
* @name moveTowards
|
|
8381
|
+
* @memberof Vector2d
|
|
8382
|
+
* @param {Vector2d} target
|
|
8383
|
+
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
8384
|
+
* @returns {Vector2d} Reference to this object for method chaining
|
|
8385
|
+
*/
|
|
8386
|
+
moveTowards(target: Vector2d, step: number): Vector2d;
|
|
8466
8387
|
/**
|
|
8467
8388
|
* return the distance between this vector and the passed one
|
|
8468
8389
|
* @name distance
|
|
@@ -8786,6 +8707,15 @@ export class Vector3d {
|
|
|
8786
8707
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
8787
8708
|
*/
|
|
8788
8709
|
lerp(v: Vector3d, alpha: number): Vector3d;
|
|
8710
|
+
/**
|
|
8711
|
+
* interpolate the position of this vector on the x and y axis towards the given one by the given maximum step.
|
|
8712
|
+
* @name moveTowards
|
|
8713
|
+
* @memberof Vector3d
|
|
8714
|
+
* @param {Vector2d|Vector3d} target
|
|
8715
|
+
* @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
|
|
8716
|
+
* @returns {Vector3d} Reference to this object for method chaining
|
|
8717
|
+
*/
|
|
8718
|
+
moveTowards(target: Vector2d | Vector3d, step: number): Vector3d;
|
|
8789
8719
|
/**
|
|
8790
8720
|
* return the distance between this vector and the passed one
|
|
8791
8721
|
* @name distance
|
|
@@ -8857,40 +8787,33 @@ export class WebGLCompositor {
|
|
|
8857
8787
|
viewMatrix: any;
|
|
8858
8788
|
/**
|
|
8859
8789
|
* a reference to the active WebGL shader
|
|
8860
|
-
* @name activeShader
|
|
8861
|
-
* @memberof WebGLCompositor
|
|
8862
8790
|
* @type {GLShader}
|
|
8863
8791
|
*/
|
|
8864
8792
|
activeShader: GLShader;
|
|
8865
8793
|
/**
|
|
8866
8794
|
* primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
8867
|
-
* @
|
|
8868
|
-
* @see WebGLCompositor
|
|
8869
|
-
* @memberof WebGLCompositor
|
|
8795
|
+
* @type {number}
|
|
8870
8796
|
* @default gl.TRIANGLES
|
|
8871
8797
|
*/
|
|
8872
|
-
mode:
|
|
8798
|
+
mode: number;
|
|
8873
8799
|
/**
|
|
8874
8800
|
* an array of vertex attribute properties
|
|
8875
|
-
* @name attributes
|
|
8876
8801
|
* @see WebGLCompositor.addAttribute
|
|
8877
|
-
* @
|
|
8802
|
+
* @type {Array}
|
|
8878
8803
|
*/
|
|
8879
8804
|
attributes: any[];
|
|
8880
8805
|
/**
|
|
8881
8806
|
* the size of a single vertex in bytes
|
|
8882
8807
|
* (will automatically be calculated as attributes definitions are added)
|
|
8883
|
-
* @name vertexByteSize
|
|
8884
8808
|
* @see WebGLCompositor.addAttribute
|
|
8885
|
-
* @
|
|
8809
|
+
* @type {number}
|
|
8886
8810
|
*/
|
|
8887
8811
|
vertexByteSize: number;
|
|
8888
8812
|
/**
|
|
8889
8813
|
* the size of a single vertex in floats
|
|
8890
8814
|
* (will automatically be calculated as attributes definitions are added)
|
|
8891
|
-
* @name vertexSize
|
|
8892
8815
|
* @see WebGLCompositor.addAttribute
|
|
8893
|
-
* @
|
|
8816
|
+
* @type {number}
|
|
8894
8817
|
*/
|
|
8895
8818
|
vertexSize: number;
|
|
8896
8819
|
primitiveShader: GLShader;
|
|
@@ -8903,8 +8826,6 @@ export class WebGLCompositor {
|
|
|
8903
8826
|
reset(): void;
|
|
8904
8827
|
/**
|
|
8905
8828
|
* add vertex attribute property definition to the compositor
|
|
8906
|
-
* @name addAttribute
|
|
8907
|
-
* @memberof WebGLCompositor
|
|
8908
8829
|
* @param {string} name name of the attribute in the vertex shader
|
|
8909
8830
|
* @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
|
|
8910
8831
|
* @param {GLenum} type data type of each component in the array
|
|
@@ -8914,8 +8835,6 @@ export class WebGLCompositor {
|
|
|
8914
8835
|
addAttribute(name: string, size: number, type: GLenum, normalized: boolean, offset: number): void;
|
|
8915
8836
|
/**
|
|
8916
8837
|
* Sets the viewport
|
|
8917
|
-
* @name setViewport
|
|
8918
|
-
* @memberof WebGLCompositor
|
|
8919
8838
|
* @param {number} x x position of viewport
|
|
8920
8839
|
* @param {number} y y position of viewport
|
|
8921
8840
|
* @param {number} w width of viewport
|
|
@@ -8924,8 +8843,6 @@ export class WebGLCompositor {
|
|
|
8924
8843
|
setViewport(x: number, y: number, w: number, h: number): void;
|
|
8925
8844
|
/**
|
|
8926
8845
|
* Create a WebGL texture from an image
|
|
8927
|
-
* @name createTexture2D
|
|
8928
|
-
* @memberof WebGLCompositor
|
|
8929
8846
|
* @param {number} unit Destination texture unit
|
|
8930
8847
|
* @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
|
|
8931
8848
|
* @param {number} filter gl.LINEAR or gl.NEAREST
|
|
@@ -8940,32 +8857,24 @@ export class WebGLCompositor {
|
|
|
8940
8857
|
createTexture2D(unit: number, image: (new (width?: number, height?: number) => HTMLImageElement) | HTMLCanvasElement | ImageData | Uint8Array[] | Float32Array[], filter: number, repeat?: string, w?: number, h?: number, b?: number, premultipliedAlpha?: boolean, mipmap?: boolean): WebGLTexture;
|
|
8941
8858
|
/**
|
|
8942
8859
|
* delete the given WebGL texture
|
|
8943
|
-
* @name bindTexture2D
|
|
8944
|
-
* @memberof WebGLCompositor
|
|
8945
8860
|
* @param {WebGLTexture} [texture] a WebGL texture to delete
|
|
8946
8861
|
* @param {number} [unit] Texture unit to delete
|
|
8947
8862
|
*/
|
|
8948
8863
|
deleteTexture2D(texture?: WebGLTexture): void;
|
|
8949
8864
|
/**
|
|
8950
8865
|
* returns the WebGL texture associated to the given texture unit
|
|
8951
|
-
* @name bindTexture2D
|
|
8952
|
-
* @memberof WebGLCompositor
|
|
8953
8866
|
* @param {number} unit Texture unit to which a texture is bound
|
|
8954
8867
|
* @returns {WebGLTexture} texture a WebGL texture
|
|
8955
8868
|
*/
|
|
8956
8869
|
getTexture2D(unit: number): WebGLTexture;
|
|
8957
8870
|
/**
|
|
8958
8871
|
* assign the given WebGL texture to the current batch
|
|
8959
|
-
* @name bindTexture2D
|
|
8960
|
-
* @memberof WebGLCompositor
|
|
8961
8872
|
* @param {WebGLTexture} texture a WebGL texture
|
|
8962
8873
|
* @param {number} unit Texture unit to which the given texture is bound
|
|
8963
8874
|
*/
|
|
8964
8875
|
bindTexture2D(texture: WebGLTexture, unit: number): void;
|
|
8965
8876
|
/**
|
|
8966
8877
|
* unbind the given WebGL texture, forcing it to be reuploaded
|
|
8967
|
-
* @name unbindTexture2D
|
|
8968
|
-
* @memberof WebGLCompositor
|
|
8969
8878
|
* @param {WebGLTexture} [texture] a WebGL texture
|
|
8970
8879
|
* @param {number} [unit] a WebGL texture
|
|
8971
8880
|
* @returns {number} unit the unit number that was associated with the given texture
|
|
@@ -8977,23 +8886,17 @@ export class WebGLCompositor {
|
|
|
8977
8886
|
uploadTexture(texture: any, w: any, h: any, b: any, force?: boolean): any;
|
|
8978
8887
|
/**
|
|
8979
8888
|
* set/change the current projection matrix
|
|
8980
|
-
* @name setProjection
|
|
8981
|
-
* @memberof WebGLCompositor
|
|
8982
8889
|
* @param {Matrix3d} matrix
|
|
8983
8890
|
*/
|
|
8984
8891
|
setProjection(matrix: Matrix3d): void;
|
|
8985
8892
|
/**
|
|
8986
8893
|
* Select the shader to use for compositing
|
|
8987
|
-
* @name useShader
|
|
8988
8894
|
* @see GLShader
|
|
8989
|
-
* @memberof WebGLCompositor
|
|
8990
8895
|
* @param {GLShader} shader a reference to a GLShader instance
|
|
8991
8896
|
*/
|
|
8992
8897
|
useShader(shader: GLShader): void;
|
|
8993
8898
|
/**
|
|
8994
8899
|
* Add a textured quad
|
|
8995
|
-
* @name addQuad
|
|
8996
|
-
* @memberof WebGLCompositor
|
|
8997
8900
|
* @param {TextureAtlas} texture Source texture atlas
|
|
8998
8901
|
* @param {number} x Destination x-coordinate
|
|
8999
8902
|
* @param {number} y Destination y-coordinate
|
|
@@ -9009,34 +8912,28 @@ export class WebGLCompositor {
|
|
|
9009
8912
|
/**
|
|
9010
8913
|
* Flush batched texture operations to the GPU
|
|
9011
8914
|
* @param {number} [mode=gl.TRIANGLES] the GL drawing mode
|
|
9012
|
-
* @memberof WebGLCompositor
|
|
9013
8915
|
*/
|
|
9014
8916
|
flush(mode?: number): void;
|
|
9015
8917
|
/**
|
|
9016
8918
|
* Draw an array of vertices
|
|
9017
|
-
* @name drawVertices
|
|
9018
|
-
* @memberof WebGLCompositor
|
|
9019
8919
|
* @param {GLenum} mode primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
9020
8920
|
* @param {Vector2d[]} verts vertices
|
|
9021
8921
|
* @param {number} [vertexCount=verts.length] amount of points defined in the points array
|
|
9022
8922
|
*/
|
|
9023
8923
|
drawVertices(mode: GLenum, verts: Vector2d[], vertexCount?: number): void;
|
|
9024
8924
|
/**
|
|
9025
|
-
*
|
|
9026
|
-
* @
|
|
9027
|
-
* @memberof WebGLCompositor
|
|
9028
|
-
* @param {number} [r=0] - the red color value used when the color buffers are cleared
|
|
9029
|
-
* @param {number} [g=0] - the green color value used when the color buffers are cleared
|
|
9030
|
-
* @param {number} [b=0] - the blue color value used when the color buffers are cleared
|
|
9031
|
-
* @param {number} [a=0] - the alpha color value used when the color buffers are cleared
|
|
8925
|
+
* Clear the frame buffer
|
|
8926
|
+
* @param {number} [alpha = 0.0] - the alpha value used when clearing the framebuffer
|
|
9032
8927
|
*/
|
|
9033
|
-
|
|
8928
|
+
clear(alpha?: number): void;
|
|
9034
8929
|
/**
|
|
9035
|
-
*
|
|
9036
|
-
* @
|
|
9037
|
-
* @
|
|
8930
|
+
* Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
|
|
8931
|
+
* @param {number} [r = 0] - the red color value used when the color buffers are cleared
|
|
8932
|
+
* @param {number} [g = 0] - the green color value used when the color buffers are cleared
|
|
8933
|
+
* @param {number} [b = 0] - the blue color value used when the color buffers are cleared
|
|
8934
|
+
* @param {number} [a = 0] - the alpha color value used when the color buffers are cleared
|
|
9038
8935
|
*/
|
|
9039
|
-
|
|
8936
|
+
clearColor(r?: number, g?: number, b?: number, a?: number): void;
|
|
9040
8937
|
}
|
|
9041
8938
|
/**
|
|
9042
8939
|
* @classdesc
|
|
@@ -9049,10 +8946,10 @@ export class WebGLRenderer extends Renderer {
|
|
|
9049
8946
|
* @param {number} options.width The width of the canvas without scaling
|
|
9050
8947
|
* @param {number} options.height The height of the canvas without scaling
|
|
9051
8948
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
9052
|
-
* @param {boolean} [options.doubleBuffering=false] Whether to enable double buffering (not applicable when using the WebGL Renderer)
|
|
9053
8949
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
|
|
9054
8950
|
* @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.
|
|
9055
|
-
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
8951
|
+
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
8952
|
+
* @param {boolean} [options.premultipliedAlpha=true] in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
9056
8953
|
* @param {boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
|
|
9057
8954
|
* @param {boolean} [options.preferWebGL1=false] if true the renderer will only use WebGL 1
|
|
9058
8955
|
* @param {string} [options.powerPreference="default"] a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
|
|
@@ -9064,10 +8961,10 @@ export class WebGLRenderer extends Renderer {
|
|
|
9064
8961
|
width: number;
|
|
9065
8962
|
height: number;
|
|
9066
8963
|
canvas?: HTMLCanvasElement;
|
|
9067
|
-
doubleBuffering?: boolean;
|
|
9068
8964
|
antiAlias?: boolean;
|
|
9069
8965
|
failIfMajorPerformanceCaveat?: boolean;
|
|
9070
8966
|
transparent?: boolean;
|
|
8967
|
+
premultipliedAlpha?: boolean;
|
|
9071
8968
|
subPixel?: boolean;
|
|
9072
8969
|
preferWebGL1?: boolean;
|
|
9073
8970
|
powerPreference?: string;
|
|
@@ -9077,8 +8974,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9077
8974
|
});
|
|
9078
8975
|
/**
|
|
9079
8976
|
* The WebGL version used by this renderer (1 or 2)
|
|
9080
|
-
* @name WebGLVersion
|
|
9081
|
-
* @memberof WebGLRenderer#
|
|
9082
8977
|
* @type {number}
|
|
9083
8978
|
* @default 1
|
|
9084
8979
|
* @readonly
|
|
@@ -9086,8 +8981,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9086
8981
|
readonly WebGLVersion: number;
|
|
9087
8982
|
/**
|
|
9088
8983
|
* The vendor string of the underlying graphics driver.
|
|
9089
|
-
* @name GPUVendor
|
|
9090
|
-
* @memberof WebGLRenderer#
|
|
9091
8984
|
* @type {string}
|
|
9092
8985
|
* @default null
|
|
9093
8986
|
* @readonly
|
|
@@ -9095,8 +8988,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9095
8988
|
readonly GPUVendor: string;
|
|
9096
8989
|
/**
|
|
9097
8990
|
* The renderer string of the underlying graphics driver.
|
|
9098
|
-
* @name GPURenderer
|
|
9099
|
-
* @memberof WebGLRenderer#
|
|
9100
8991
|
* @type {string}
|
|
9101
8992
|
* @default null
|
|
9102
8993
|
* @readonly
|
|
@@ -9105,15 +8996,12 @@ export class WebGLRenderer extends Renderer {
|
|
|
9105
8996
|
/**
|
|
9106
8997
|
* The WebGL context
|
|
9107
8998
|
* @name gl
|
|
9108
|
-
* @memberof WebGLRenderer
|
|
9109
8999
|
* @type {WebGLRenderingContext}
|
|
9110
9000
|
*/
|
|
9111
9001
|
context: WebGLRenderingContext;
|
|
9112
9002
|
gl: WebGLRenderingContext;
|
|
9113
9003
|
/**
|
|
9114
9004
|
* Maximum number of texture unit supported under the current context
|
|
9115
|
-
* @name maxTextures
|
|
9116
|
-
* @memberof WebGLRenderer#
|
|
9117
9005
|
* @type {number}
|
|
9118
9006
|
* @readonly
|
|
9119
9007
|
*/
|
|
@@ -9136,37 +9024,27 @@ export class WebGLRenderer extends Renderer {
|
|
|
9136
9024
|
_blendStack: any[];
|
|
9137
9025
|
/**
|
|
9138
9026
|
* The current transformation matrix used for transformations on the overall scene
|
|
9139
|
-
* @name currentTransform
|
|
9140
9027
|
* @type {Matrix2d}
|
|
9141
|
-
* @memberof WebGLRenderer#
|
|
9142
9028
|
*/
|
|
9143
9029
|
currentTransform: Matrix2d;
|
|
9144
9030
|
/**
|
|
9145
9031
|
* The current compositor used by the renderer
|
|
9146
|
-
* @name currentCompositor
|
|
9147
9032
|
* @type {WebGLCompositor}
|
|
9148
|
-
* @memberof WebGLRenderer#
|
|
9149
9033
|
*/
|
|
9150
9034
|
currentCompositor: WebGLCompositor;
|
|
9151
9035
|
/**
|
|
9152
9036
|
* The list of active compositors
|
|
9153
|
-
* @name compositors
|
|
9154
9037
|
* @type {Map<WebGLCompositor>}
|
|
9155
|
-
* @memberof WebGLRenderer#
|
|
9156
9038
|
*/
|
|
9157
9039
|
compositors: Map<WebGLCompositor, any>;
|
|
9158
9040
|
cache: TextureCache;
|
|
9159
9041
|
/**
|
|
9160
9042
|
* set the active compositor for this renderer
|
|
9161
|
-
* @name setCompositor
|
|
9162
9043
|
* @param {WebGLCompositor|string} compositor a compositor name or instance
|
|
9163
|
-
* @memberof WebGLRenderer
|
|
9164
9044
|
*/
|
|
9165
9045
|
setCompositor(compositor?: WebGLCompositor | string): void;
|
|
9166
9046
|
/**
|
|
9167
9047
|
* Reset the gl transform to identity
|
|
9168
|
-
* @name resetTransform
|
|
9169
|
-
* @memberof WebGLRenderer
|
|
9170
9048
|
*/
|
|
9171
9049
|
resetTransform(): void;
|
|
9172
9050
|
/**
|
|
@@ -9183,8 +9061,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9183
9061
|
fontTexture: TextureAtlas;
|
|
9184
9062
|
/**
|
|
9185
9063
|
* Create a pattern with the specified repetition
|
|
9186
|
-
* @name createPattern
|
|
9187
|
-
* @memberof WebGLRenderer
|
|
9188
9064
|
* @param {Image} image Source image
|
|
9189
9065
|
* @param {string} repeat Define how the pattern should be repeated
|
|
9190
9066
|
* @returns {TextureAtlas}
|
|
@@ -9196,24 +9072,14 @@ export class WebGLRenderer extends Renderer {
|
|
|
9196
9072
|
* var basic = renderer.createPattern(image, "no-repeat");
|
|
9197
9073
|
*/
|
|
9198
9074
|
createPattern(image: new (width?: number, height?: number) => HTMLImageElement, repeat: string): TextureAtlas;
|
|
9199
|
-
/**
|
|
9200
|
-
* Flush the compositor to the frame buffer
|
|
9201
|
-
* @name flush
|
|
9202
|
-
* @memberof WebGLRenderer
|
|
9203
|
-
*/
|
|
9204
|
-
flush(): void;
|
|
9205
9075
|
/**
|
|
9206
9076
|
* Clears the gl context with the given color.
|
|
9207
|
-
* @name clearColor
|
|
9208
|
-
* @memberof WebGLRenderer
|
|
9209
9077
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
9210
9078
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
9211
9079
|
*/
|
|
9212
9080
|
clearColor(color?: Color | string, opaque?: boolean): void;
|
|
9213
9081
|
/**
|
|
9214
9082
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
9215
|
-
* @name clearRect
|
|
9216
|
-
* @memberof WebGLRenderer
|
|
9217
9083
|
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
9218
9084
|
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
9219
9085
|
* @param {number} width The rectangle's width.
|
|
@@ -9226,8 +9092,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9226
9092
|
drawFont(bounds: any): void;
|
|
9227
9093
|
/**
|
|
9228
9094
|
* Draw an image to the gl context
|
|
9229
|
-
* @name drawImage
|
|
9230
|
-
* @memberof WebGLRenderer
|
|
9231
9095
|
* @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
9232
9096
|
* @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
9233
9097
|
* @param {number} sy The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
@@ -9248,8 +9112,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9248
9112
|
drawImage(image: new (width?: number, height?: number) => HTMLImageElement, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
|
|
9249
9113
|
/**
|
|
9250
9114
|
* Draw a pattern within the given rectangle.
|
|
9251
|
-
* @name drawPattern
|
|
9252
|
-
* @memberof WebGLRenderer
|
|
9253
9115
|
* @param {TextureAtlas} pattern Pattern object
|
|
9254
9116
|
* @param {number} x
|
|
9255
9117
|
* @param {number} y
|
|
@@ -9259,26 +9121,15 @@ export class WebGLRenderer extends Renderer {
|
|
|
9259
9121
|
*/
|
|
9260
9122
|
drawPattern(pattern: TextureAtlas, x: number, y: number, width: number, height: number): void;
|
|
9261
9123
|
/**
|
|
9262
|
-
*
|
|
9263
|
-
* @name getScreenContext
|
|
9264
|
-
* @memberof WebGLRenderer
|
|
9265
|
-
* @returns {WebGLRenderingContext}
|
|
9266
|
-
*/
|
|
9267
|
-
getScreenContext(): WebGLRenderingContext;
|
|
9268
|
-
/**
|
|
9269
|
-
* Returns the WebGL Context object of the given Canvas
|
|
9270
|
-
* @name getContextGL
|
|
9271
|
-
* @memberof WebGLRenderer
|
|
9124
|
+
* Returns the WebGL Context object of the given canvas element
|
|
9272
9125
|
* @param {HTMLCanvasElement} canvas
|
|
9273
|
-
* @param {boolean} [transparent=
|
|
9126
|
+
* @param {boolean} [transparent=false] use true to enable transparency
|
|
9274
9127
|
* @returns {WebGLRenderingContext}
|
|
9275
9128
|
*/
|
|
9276
9129
|
getContextGL(canvas: HTMLCanvasElement, transparent?: boolean): WebGLRenderingContext;
|
|
9277
9130
|
/**
|
|
9278
9131
|
* Returns the WebGLContext instance for the renderer
|
|
9279
9132
|
* return a reference to the system 2d Context
|
|
9280
|
-
* @name getContext
|
|
9281
|
-
* @memberof WebGLRenderer
|
|
9282
9133
|
* @returns {WebGLRenderingContext}
|
|
9283
9134
|
*/
|
|
9284
9135
|
getContext(): WebGLRenderingContext;
|
|
@@ -9293,9 +9144,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
9293
9144
|
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
9294
9145
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
9295
9146
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
9296
|
-
* @name setBlendMode
|
|
9297
9147
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
9298
|
-
* @memberof WebGLRenderer
|
|
9299
9148
|
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
9300
9149
|
* @param {WebGLRenderingContext} [gl]
|
|
9301
9150
|
*/
|
|
@@ -9308,27 +9157,19 @@ export class WebGLRenderer extends Renderer {
|
|
|
9308
9157
|
getFontContext(): CanvasRenderingContext2D;
|
|
9309
9158
|
/**
|
|
9310
9159
|
* restores the canvas context
|
|
9311
|
-
* @name restore
|
|
9312
|
-
* @memberof WebGLRenderer
|
|
9313
9160
|
*/
|
|
9314
9161
|
restore(): void;
|
|
9315
9162
|
/**
|
|
9316
9163
|
* saves the canvas context
|
|
9317
|
-
* @name save
|
|
9318
|
-
* @memberof WebGLRenderer
|
|
9319
9164
|
*/
|
|
9320
9165
|
save(): void;
|
|
9321
9166
|
/**
|
|
9322
9167
|
* rotates the uniform matrix
|
|
9323
|
-
* @name rotate
|
|
9324
|
-
* @memberof WebGLRenderer
|
|
9325
9168
|
* @param {number} angle in radians
|
|
9326
9169
|
*/
|
|
9327
9170
|
rotate(angle: number): void;
|
|
9328
9171
|
/**
|
|
9329
9172
|
* scales the uniform matrix
|
|
9330
|
-
* @name scale
|
|
9331
|
-
* @memberof WebGLRenderer
|
|
9332
9173
|
* @param {number} x
|
|
9333
9174
|
* @param {number} y
|
|
9334
9175
|
*/
|
|
@@ -9340,37 +9181,27 @@ export class WebGLRenderer extends Renderer {
|
|
|
9340
9181
|
setAntiAlias(context: any, enable: any): void;
|
|
9341
9182
|
/**
|
|
9342
9183
|
* Set the global alpha
|
|
9343
|
-
* @name setGlobalAlpha
|
|
9344
|
-
* @memberof WebGLRenderer
|
|
9345
9184
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
9346
9185
|
*/
|
|
9347
9186
|
setGlobalAlpha(alpha: number): void;
|
|
9348
9187
|
/**
|
|
9349
9188
|
* Return the global alpha
|
|
9350
|
-
* @name getGlobalAlpha
|
|
9351
|
-
* @memberof WebGLRenderer
|
|
9352
9189
|
* @returns {number} global alpha value
|
|
9353
9190
|
*/
|
|
9354
9191
|
getGlobalAlpha(): number;
|
|
9355
9192
|
/**
|
|
9356
9193
|
* Set the current fill & stroke style color.
|
|
9357
9194
|
* By default, or upon reset, the value is set to #000000.
|
|
9358
|
-
* @name setColor
|
|
9359
|
-
* @memberof WebGLRenderer
|
|
9360
9195
|
* @param {Color|string} color css color string.
|
|
9361
9196
|
*/
|
|
9362
9197
|
setColor(color: Color | string): void;
|
|
9363
9198
|
/**
|
|
9364
9199
|
* Set the line width
|
|
9365
|
-
* @name setLineWidth
|
|
9366
|
-
* @memberof WebGLRenderer
|
|
9367
9200
|
* @param {number} width Line width
|
|
9368
9201
|
*/
|
|
9369
9202
|
setLineWidth(width: number): void;
|
|
9370
9203
|
/**
|
|
9371
9204
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
9372
|
-
* @name strokeArc
|
|
9373
|
-
* @memberof WebGLRenderer
|
|
9374
9205
|
* @param {number} x arc center point x-axis
|
|
9375
9206
|
* @param {number} y arc center point y-axis
|
|
9376
9207
|
* @param {number} radius
|
|
@@ -9382,8 +9213,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9382
9213
|
strokeArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean, fill?: boolean): void;
|
|
9383
9214
|
/**
|
|
9384
9215
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
9385
|
-
* @name fillArc
|
|
9386
|
-
* @memberof WebGLRenderer
|
|
9387
9216
|
* @param {number} x arc center point x-axis
|
|
9388
9217
|
* @param {number} y arc center point y-axis
|
|
9389
9218
|
* @param {number} radius
|
|
@@ -9394,8 +9223,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9394
9223
|
fillArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean): void;
|
|
9395
9224
|
/**
|
|
9396
9225
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
9397
|
-
* @name strokeEllipse
|
|
9398
|
-
* @memberof WebGLRenderer
|
|
9399
9226
|
* @param {number} x ellipse center point x-axis
|
|
9400
9227
|
* @param {number} y ellipse center point y-axis
|
|
9401
9228
|
* @param {number} w horizontal radius of the ellipse
|
|
@@ -9405,8 +9232,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9405
9232
|
strokeEllipse(x: number, y: number, w: number, h: number, fill?: boolean): void;
|
|
9406
9233
|
/**
|
|
9407
9234
|
* Fill an ellipse at the specified coordinates with given radius
|
|
9408
|
-
* @name fillEllipse
|
|
9409
|
-
* @memberof WebGLRenderer
|
|
9410
9235
|
* @param {number} x ellipse center point x-axis
|
|
9411
9236
|
* @param {number} y ellipse center point y-axis
|
|
9412
9237
|
* @param {number} w horizontal radius of the ellipse
|
|
@@ -9415,8 +9240,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9415
9240
|
fillEllipse(x: number, y: number, w: number, h: number): void;
|
|
9416
9241
|
/**
|
|
9417
9242
|
* Stroke a line of the given two points
|
|
9418
|
-
* @name strokeLine
|
|
9419
|
-
* @memberof WebGLRenderer
|
|
9420
9243
|
* @param {number} startX the start x coordinate
|
|
9421
9244
|
* @param {number} startY the start y coordinate
|
|
9422
9245
|
* @param {number} endX the end x coordinate
|
|
@@ -9425,8 +9248,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9425
9248
|
strokeLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
9426
9249
|
/**
|
|
9427
9250
|
* Fill a line of the given two points
|
|
9428
|
-
* @name fillLine
|
|
9429
|
-
* @memberof WebGLRenderer
|
|
9430
9251
|
* @param {number} startX the start x coordinate
|
|
9431
9252
|
* @param {number} startY the start y coordinate
|
|
9432
9253
|
* @param {number} endX the end x coordinate
|
|
@@ -9435,23 +9256,17 @@ export class WebGLRenderer extends Renderer {
|
|
|
9435
9256
|
fillLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
9436
9257
|
/**
|
|
9437
9258
|
* Stroke a me.Polygon on the screen with a specified color
|
|
9438
|
-
* @name strokePolygon
|
|
9439
|
-
* @memberof WebGLRenderer
|
|
9440
9259
|
* @param {Polygon} poly the shape to draw
|
|
9441
9260
|
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
9442
9261
|
*/
|
|
9443
9262
|
strokePolygon(poly: Polygon, fill?: boolean): void;
|
|
9444
9263
|
/**
|
|
9445
9264
|
* Fill a me.Polygon on the screen
|
|
9446
|
-
* @name fillPolygon
|
|
9447
|
-
* @memberof WebGLRenderer
|
|
9448
9265
|
* @param {Polygon} poly the shape to draw
|
|
9449
9266
|
*/
|
|
9450
9267
|
fillPolygon(poly: Polygon): void;
|
|
9451
9268
|
/**
|
|
9452
9269
|
* Draw a stroke rectangle at the specified coordinates
|
|
9453
|
-
* @name strokeRect
|
|
9454
|
-
* @memberof WebGLRenderer
|
|
9455
9270
|
* @param {number} x
|
|
9456
9271
|
* @param {number} y
|
|
9457
9272
|
* @param {number} width
|
|
@@ -9461,8 +9276,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9461
9276
|
strokeRect(x: number, y: number, width: number, height: number, fill?: boolean): void;
|
|
9462
9277
|
/**
|
|
9463
9278
|
* Draw a filled rectangle at the specified coordinates
|
|
9464
|
-
* @name fillRect
|
|
9465
|
-
* @memberof WebGLRenderer
|
|
9466
9279
|
* @param {number} x
|
|
9467
9280
|
* @param {number} y
|
|
9468
9281
|
* @param {number} width
|
|
@@ -9471,8 +9284,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9471
9284
|
fillRect(x: number, y: number, width: number, height: number): void;
|
|
9472
9285
|
/**
|
|
9473
9286
|
* Stroke a rounded rectangle at the specified coordinates
|
|
9474
|
-
* @name strokeRoundRect
|
|
9475
|
-
* @memberof WebGLRenderer
|
|
9476
9287
|
* @param {number} x
|
|
9477
9288
|
* @param {number} y
|
|
9478
9289
|
* @param {number} width
|
|
@@ -9483,8 +9294,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9483
9294
|
strokeRoundRect(x: number, y: number, width: number, height: number, radius: number, fill?: boolean): void;
|
|
9484
9295
|
/**
|
|
9485
9296
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
9486
|
-
* @name fillRoundRect
|
|
9487
|
-
* @memberof WebGLRenderer
|
|
9488
9297
|
* @param {number} x
|
|
9489
9298
|
* @param {number} y
|
|
9490
9299
|
* @param {number} width
|
|
@@ -9492,25 +9301,33 @@ export class WebGLRenderer extends Renderer {
|
|
|
9492
9301
|
* @param {number} radius
|
|
9493
9302
|
*/
|
|
9494
9303
|
fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
9304
|
+
/**
|
|
9305
|
+
* Stroke a Point at the specified coordinates
|
|
9306
|
+
* @param {number} x
|
|
9307
|
+
* @param {number} y
|
|
9308
|
+
*/
|
|
9309
|
+
strokePoint(x: number, y: number): void;
|
|
9310
|
+
/**
|
|
9311
|
+
* Draw a a point at the specified coordinates
|
|
9312
|
+
* @param {number} x
|
|
9313
|
+
* @param {number} y
|
|
9314
|
+
* @param {number} width
|
|
9315
|
+
* @param {number} height
|
|
9316
|
+
*/
|
|
9317
|
+
fillPoint(x: number, y: number): void;
|
|
9495
9318
|
/**
|
|
9496
9319
|
* Reset (overrides) the renderer transformation matrix to the
|
|
9497
9320
|
* identity one, and then apply the given transformation matrix.
|
|
9498
|
-
* @name setTransform
|
|
9499
|
-
* @memberof WebGLRenderer
|
|
9500
9321
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
9501
9322
|
*/
|
|
9502
9323
|
setTransform(mat2d: Matrix2d): void;
|
|
9503
9324
|
/**
|
|
9504
9325
|
* Multiply given matrix into the renderer tranformation matrix
|
|
9505
|
-
* @name transform
|
|
9506
|
-
* @memberof WebGLRenderer
|
|
9507
9326
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
9508
9327
|
*/
|
|
9509
9328
|
transform(mat2d: Matrix2d): void;
|
|
9510
9329
|
/**
|
|
9511
9330
|
* Translates the uniform matrix by the given coordinates
|
|
9512
|
-
* @name translate
|
|
9513
|
-
* @memberof WebGLRenderer
|
|
9514
9331
|
* @param {number} x
|
|
9515
9332
|
* @param {number} y
|
|
9516
9333
|
*/
|
|
@@ -9521,8 +9338,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9521
9338
|
* You can however save the current region using the save(),
|
|
9522
9339
|
* and restore it (with the restore() method) any time in the future.
|
|
9523
9340
|
* (<u>this is an experimental feature !</u>)
|
|
9524
|
-
* @name clipRect
|
|
9525
|
-
* @memberof WebGLRenderer
|
|
9526
9341
|
* @param {number} x
|
|
9527
9342
|
* @param {number} y
|
|
9528
9343
|
* @param {number} width
|
|
@@ -9533,8 +9348,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9533
9348
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
9534
9349
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
9535
9350
|
* Mask are not preserved through renderer context save and restore.
|
|
9536
|
-
* @name setMask
|
|
9537
|
-
* @memberof WebGLRenderer
|
|
9538
9351
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] a shape defining the mask to be applied
|
|
9539
9352
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
9540
9353
|
*/
|
|
@@ -12535,7 +12348,6 @@ declare var fnUtils: Readonly<{
|
|
|
12535
12348
|
* @param {object} [options] The optional video/renderer parameters.<br> (see Renderer(s) documentation for further specific options)
|
|
12536
12349
|
* @param {string|HTMLElement} [options.parent=document.body] the DOM parent element to hold the canvas in the HTML file
|
|
12537
12350
|
* @param {number} [options.renderer=video.AUTO] renderer to use (me.video.CANVAS, me.video.WEBGL, me.video.AUTO)
|
|
12538
|
-
* @param {boolean} [options.doubleBuffering=false] enable/disable double buffering
|
|
12539
12351
|
* @param {number|string} [options.scale=1.0] enable scaling of the canvas ('auto' for automatic scaling)
|
|
12540
12352
|
* @param {string} [options.scaleMethod="fit"] screen scaling modes ('fit','fill-min','fill-max','flex','flex-width','flex-height','stretch')
|
|
12541
12353
|
* @param {boolean} [options.preferWebGL1=false] if true the renderer will only use WebGL 1
|
|
@@ -12550,14 +12362,12 @@ declare var fnUtils: Readonly<{
|
|
|
12550
12362
|
* parent : "screen",
|
|
12551
12363
|
* renderer : me.video.AUTO,
|
|
12552
12364
|
* scale : "auto",
|
|
12553
|
-
* scaleMethod : "fit"
|
|
12554
|
-
* doubleBuffering : true
|
|
12365
|
+
* scaleMethod : "fit"
|
|
12555
12366
|
* });
|
|
12556
12367
|
*/
|
|
12557
12368
|
declare function init(width: number, height: number, options?: {
|
|
12558
12369
|
parent?: string | HTMLElement;
|
|
12559
12370
|
renderer?: number;
|
|
12560
|
-
doubleBuffering?: boolean;
|
|
12561
12371
|
scale?: number | string;
|
|
12562
12372
|
scaleMethod?: string;
|
|
12563
12373
|
preferWebGL1?: boolean;
|