melonjs 10.8.0 → 10.9.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 +393 -49
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +24 -137
- package/dist/melonjs.module.js +367 -39
- package/package.json +5 -5
- package/src/geometries/roundrect.js +98 -1
- package/src/input/gamepad.js +2 -2
- package/src/polyfill/index.js +1 -0
- package/src/polyfill/roundrect.js +235 -0
- package/src/renderable/renderable.js +1 -1
- package/src/utils/utils.js +2 -2
- package/src/video/canvas/canvas_renderer.js +8 -18
- package/src/video/renderer.js +15 -7
- package/src/video/webgl/utils/uniforms.js +1 -1
- package/src/video/webgl/webgl_renderer.js +1 -1
package/dist/melonjs.module.d.ts
CHANGED
|
@@ -6087,7 +6087,7 @@ export class Renderable extends Rect {
|
|
|
6087
6087
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
6088
6088
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
6089
6089
|
* @public
|
|
6090
|
-
* @type {Rect|Polygon|Line|Ellipse}
|
|
6090
|
+
* @type {Rect|RoundRect|Polygon|Line|Ellipse}
|
|
6091
6091
|
* @name mask
|
|
6092
6092
|
* @default undefined
|
|
6093
6093
|
* @memberof Renderable#
|
|
@@ -6107,7 +6107,7 @@ export class Renderable extends Rect {
|
|
|
6107
6107
|
* {x: -14, y: 30}
|
|
6108
6108
|
* ]);
|
|
6109
6109
|
*/
|
|
6110
|
-
public mask: Rect | Polygon | Line | Ellipse;
|
|
6110
|
+
public mask: Rect | RoundRect | Polygon | Line | Ellipse;
|
|
6111
6111
|
/**
|
|
6112
6112
|
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
6113
6113
|
* @public
|
|
@@ -6637,9 +6637,9 @@ export class Renderer {
|
|
|
6637
6637
|
* @name fill
|
|
6638
6638
|
* @memberof Renderer.prototype
|
|
6639
6639
|
* @function
|
|
6640
|
-
* @param {Rect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
6640
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
6641
6641
|
*/
|
|
6642
|
-
fill(shape: Rect | Polygon | Line | Ellipse): void;
|
|
6642
|
+
fill(shape: Rect | RoundRect | Polygon | Line | Ellipse): void;
|
|
6643
6643
|
/**
|
|
6644
6644
|
* tint the given image or canvas using the given color
|
|
6645
6645
|
* @name tint
|
|
@@ -6658,9 +6658,9 @@ export class Renderer {
|
|
|
6658
6658
|
* @name setMask
|
|
6659
6659
|
* @memberof Renderer.prototype
|
|
6660
6660
|
* @function
|
|
6661
|
-
* @param {Rect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
6661
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
6662
6662
|
*/
|
|
6663
|
-
setMask(mask?: Rect | Polygon | Line | Ellipse): void;
|
|
6663
|
+
setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse): void;
|
|
6664
6664
|
/**
|
|
6665
6665
|
* disable (remove) the rendering mask set through setMask.
|
|
6666
6666
|
* @name clearMask
|
|
@@ -6719,6 +6719,24 @@ export class RoundRect extends Rect {
|
|
|
6719
6719
|
/** @ignore */
|
|
6720
6720
|
onResetEvent(x: any, y: any, w: any, h: any, radius: any): void;
|
|
6721
6721
|
_radius: number;
|
|
6722
|
+
/**
|
|
6723
|
+
* copy the position, size and radius of the given rounded rectangle into this one
|
|
6724
|
+
* @name copy
|
|
6725
|
+
* @memberof RoundRect.prototype
|
|
6726
|
+
* @function
|
|
6727
|
+
* @param {RoundRect} rrect source rounded rectangle
|
|
6728
|
+
* @returns {RoundRect} new rectangle
|
|
6729
|
+
*/
|
|
6730
|
+
copy(rrect: RoundRect): RoundRect;
|
|
6731
|
+
/**
|
|
6732
|
+
* check if this RoundRect is identical to the specified one
|
|
6733
|
+
* @name equals
|
|
6734
|
+
* @memberof RoundRect.prototype
|
|
6735
|
+
* @function
|
|
6736
|
+
* @param {RoundRect} rrect
|
|
6737
|
+
* @returns {boolean} true if equals
|
|
6738
|
+
*/
|
|
6739
|
+
equals(rrect: RoundRect): boolean;
|
|
6722
6740
|
/**
|
|
6723
6741
|
* clone this RoundRect
|
|
6724
6742
|
* @name clone
|
|
@@ -12199,137 +12217,6 @@ declare function round(num: number, dec?: number): number;
|
|
|
12199
12217
|
* }
|
|
12200
12218
|
*/
|
|
12201
12219
|
declare function toBeCloseTo(expected: number, actual: number, precision?: number): boolean;
|
|
12202
|
-
/**
|
|
12203
|
-
* @classdesc
|
|
12204
|
-
* a simplified path2d implementation, supporting only one path
|
|
12205
|
-
*/
|
|
12206
|
-
declare class Path2D {
|
|
12207
|
-
/**
|
|
12208
|
-
* the points defining the current path
|
|
12209
|
-
* @public
|
|
12210
|
-
* @type {Vector2d[]}
|
|
12211
|
-
* @name points
|
|
12212
|
-
* @memberof Path2D#
|
|
12213
|
-
*/
|
|
12214
|
-
public points: Vector2d[];
|
|
12215
|
-
/**
|
|
12216
|
-
* space between interpolated points for quadratic and bezier curve approx. in pixels.
|
|
12217
|
-
* @public
|
|
12218
|
-
* @type {number}
|
|
12219
|
-
* @name arcResolution
|
|
12220
|
-
* @default 5
|
|
12221
|
-
* @memberof Path2D#
|
|
12222
|
-
*/
|
|
12223
|
-
public arcResolution: number;
|
|
12224
|
-
vertices: any[];
|
|
12225
|
-
/**
|
|
12226
|
-
* begin a new path
|
|
12227
|
-
* @name beginPath
|
|
12228
|
-
* @memberof Path2D.prototype
|
|
12229
|
-
* @function
|
|
12230
|
-
*/
|
|
12231
|
-
beginPath(): void;
|
|
12232
|
-
/**
|
|
12233
|
-
* causes the point of the pen to move back to the start of the current path.
|
|
12234
|
-
* It tries to draw a straight line from the current point to the start.
|
|
12235
|
-
* If the shape has already been closed or has only one point, this function does nothing.
|
|
12236
|
-
* @name closePath
|
|
12237
|
-
* @memberof Path2D.prototype
|
|
12238
|
-
* @function
|
|
12239
|
-
*/
|
|
12240
|
-
closePath(): void;
|
|
12241
|
-
/**
|
|
12242
|
-
* triangulate the shape defined by this path into an array of triangles
|
|
12243
|
-
* @name triangulatePath
|
|
12244
|
-
* @memberof Path2D.prototype
|
|
12245
|
-
* @function
|
|
12246
|
-
* @returns {Vector2d[]}
|
|
12247
|
-
*/
|
|
12248
|
-
triangulatePath(): Vector2d[];
|
|
12249
|
-
/**
|
|
12250
|
-
* moves the starting point of the current path to the (x, y) coordinates.
|
|
12251
|
-
* @name moveTo
|
|
12252
|
-
* @memberof Path2D.prototype
|
|
12253
|
-
* @function
|
|
12254
|
-
* @param {number} x the x-axis (horizontal) coordinate of the point.
|
|
12255
|
-
* @param {number} y the y-axis (vertical) coordinate of the point.
|
|
12256
|
-
*/
|
|
12257
|
-
moveTo(x: number, y: number): void;
|
|
12258
|
-
/**
|
|
12259
|
-
* connects the last point in the current patch to the (x, y) coordinates with a straight line.
|
|
12260
|
-
* @name lineTo
|
|
12261
|
-
* @memberof Path2D.prototype
|
|
12262
|
-
* @function
|
|
12263
|
-
* @param {number} x the x-axis coordinate of the line's end point.
|
|
12264
|
-
* @param {number} y the y-axis coordinate of the line's end point.
|
|
12265
|
-
*/
|
|
12266
|
-
lineTo(x: number, y: number): void;
|
|
12267
|
-
/**
|
|
12268
|
-
* adds an arc to the current path which is centered at (x, y) position with the given radius,
|
|
12269
|
-
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
|
|
12270
|
-
* @name arc
|
|
12271
|
-
* @memberof Path2D.prototype
|
|
12272
|
-
* @function
|
|
12273
|
-
* @param {number} x the horizontal coordinate of the arc's center.
|
|
12274
|
-
* @param {number} y the vertical coordinate of the arc's center.
|
|
12275
|
-
* @param {number} radius the arc's radius. Must be positive.
|
|
12276
|
-
* @param {number} startAngle the angle at which the arc starts in radians, measured from the positive x-axis.
|
|
12277
|
-
* @param {number} endAngle the angle at which the arc ends in radians, measured from the positive x-axis.
|
|
12278
|
-
* @param {boolean} [anticlockwise=false] an optional boolean value. If true, draws the arc counter-clockwise between the start and end angles.
|
|
12279
|
-
*/
|
|
12280
|
-
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
|
|
12281
|
-
/**
|
|
12282
|
-
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
12283
|
-
* @name arcTo
|
|
12284
|
-
* @memberof Path2D.prototype
|
|
12285
|
-
* @function
|
|
12286
|
-
* @param {number} x the x-axis coordinate of the first control point.
|
|
12287
|
-
* @param {number} y the y-axis coordinate of the first control point.
|
|
12288
|
-
* @param {number} x the x-axis coordinate of the second control point.
|
|
12289
|
-
* @param {number} y the y-axis coordinate of the second control point.
|
|
12290
|
-
* @param {number} radius the arc's radius. Must be positive.
|
|
12291
|
-
*/
|
|
12292
|
-
arcTo(x1: any, y1: any, x2: any, y2: any, radius: number): void;
|
|
12293
|
-
/**
|
|
12294
|
-
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
12295
|
-
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|
|
12296
|
-
* @name ellipse
|
|
12297
|
-
* @memberof Path2D.prototype
|
|
12298
|
-
* @function
|
|
12299
|
-
* @param {number} x the x-axis (horizontal) coordinate of the ellipse's center.
|
|
12300
|
-
* @param {number} y the y-axis (vertical) coordinate of the ellipse's center.
|
|
12301
|
-
* @param {number} radiusX the ellipse's major-axis radius. Must be non-negative.
|
|
12302
|
-
* @param {number} radiusY the ellipse's minor-axis radius. Must be non-negative.
|
|
12303
|
-
* @param {number} rotation the rotation of the ellipse, expressed in radians.
|
|
12304
|
-
* @param {number} startAngle the angle at which the ellipse starts, measured clockwise from the positive x-axis and expressed in radians.
|
|
12305
|
-
* @param {number} endAngle the angle at which the ellipse ends, measured clockwise from the positive x-axis and expressed in radians.
|
|
12306
|
-
* @param {boolean} [anticlockwise=false] an optional boolean value which, if true, draws the ellipse counterclockwise (anticlockwise).
|
|
12307
|
-
*/
|
|
12308
|
-
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
|
|
12309
|
-
/**
|
|
12310
|
-
* creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
|
|
12311
|
-
* @name rect
|
|
12312
|
-
* @memberof Path2D.prototype
|
|
12313
|
-
* @function
|
|
12314
|
-
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
12315
|
-
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
12316
|
-
* @param {number} width the rectangle's width. Positive values are to the right, and negative to the left.
|
|
12317
|
-
* @param {number} height the rectangle's height. Positive values are down, and negative are up.
|
|
12318
|
-
*/
|
|
12319
|
-
rect(x: number, y: number, width: number, height: number): void;
|
|
12320
|
-
/**
|
|
12321
|
-
* adds an rounded rectangle to the current path.
|
|
12322
|
-
* @name roundRect
|
|
12323
|
-
* @memberof Path2D.prototype
|
|
12324
|
-
* @function
|
|
12325
|
-
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
12326
|
-
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
12327
|
-
* @param {number} width the rectangle's width. Positive values are to the right, and negative to the left.
|
|
12328
|
-
* @param {number} height the rectangle's height. Positive values are down, and negative are up.
|
|
12329
|
-
* @param {number} radius the arc's radius to draw the borders. Must be positive.
|
|
12330
|
-
*/
|
|
12331
|
-
roundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
12332
|
-
}
|
|
12333
12220
|
/**
|
|
12334
12221
|
* @classdesc
|
|
12335
12222
|
* a Vertex Buffer object
|