melonjs 13.1.0 → 13.2.1

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - v13.1.0
2
+ * melonJS Game Engine - v13.2.1
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -2999,7 +2999,7 @@
2999
2999
  * @returns {number}
3000
3000
  */
3001
3001
  Color.prototype.toUint32 = function toUint32 (alpha) {
3002
- if ( alpha === void 0 ) alpha = this.alpha;
3002
+ if ( alpha === void 0 ) alpha = 1.0;
3003
3003
 
3004
3004
  var ur = this.r & 0xff;
3005
3005
  var ug = this.g & 0xff;
@@ -6543,56 +6543,38 @@
6543
6543
 
6544
6544
  /**
6545
6545
  * the active gl rendering context
6546
- * @public
6547
6546
  * @type {WebGLRenderingContext}
6548
- * @name gl
6549
- * @memberof GLShader
6550
6547
  */
6551
6548
  this.gl = gl;
6552
6549
 
6553
6550
  /**
6554
6551
  * the vertex shader source code
6555
- * @public
6556
6552
  * @type {string}
6557
- * @name vertex
6558
- * @memberof GLShader
6559
6553
  */
6560
6554
  this.vertex = setPrecision(minify(vertex), precision || getMaxShaderPrecision(this.gl));
6561
6555
 
6562
6556
  /**
6563
6557
  * the fragment shader source code
6564
- * @public
6565
6558
  * @type {string}
6566
- * @name vertex
6567
- * @memberof GLShader
6568
6559
  */
6569
6560
  this.fragment = setPrecision(minify(fragment), precision || getMaxShaderPrecision(this.gl));
6570
6561
 
6571
6562
  /**
6572
6563
  * the location attributes of the shader
6573
- * @public
6574
6564
  * @type {GLint[]}
6575
- * @name attributes
6576
- * @memberof GLShader
6577
6565
  */
6578
6566
  this.attributes = extractAttributes(this.gl, this);
6579
6567
 
6580
6568
 
6581
6569
  /**
6582
6570
  * a reference to the shader program (once compiled)
6583
- * @public
6584
6571
  * @type {WebGLProgram}
6585
- * @name program
6586
- * @memberof GLShader
6587
6572
  */
6588
6573
  this.program = compileProgram(this.gl, this.vertex, this.fragment, this.attributes);
6589
6574
 
6590
6575
  /**
6591
6576
  * the uniforms of the shader
6592
- * @public
6593
6577
  * @type {object}
6594
- * @name uniforms
6595
- * @memberof GLShader
6596
6578
  */
6597
6579
  this.uniforms = extractUniforms(this.gl, this);
6598
6580
 
@@ -6602,8 +6584,6 @@
6602
6584
 
6603
6585
  /**
6604
6586
  * Installs this shader program as part of current rendering state
6605
- * @name bind
6606
- * @memberof GLShader
6607
6587
  */
6608
6588
  GLShader.prototype.bind = function bind () {
6609
6589
  this.gl.useProgram(this.program);
@@ -6611,8 +6591,6 @@
6611
6591
 
6612
6592
  /**
6613
6593
  * returns the location of an attribute variable in this shader program
6614
- * @name getAttribLocation
6615
- * @memberof GLShader
6616
6594
  * @param {string} name the name of the attribute variable whose location to get.
6617
6595
  * @returns {GLint} number indicating the location of the variable name if found. Returns -1 otherwise
6618
6596
  */
@@ -6627,8 +6605,6 @@
6627
6605
 
6628
6606
  /**
6629
6607
  * Set the uniform to the given value
6630
- * @name setUniform
6631
- * @memberof GLShader
6632
6608
  * @param {string} name the uniform name
6633
6609
  * @param {object|Float32Array} value the value to assign to that uniform
6634
6610
  * @example
@@ -6649,8 +6625,6 @@
6649
6625
 
6650
6626
  /**
6651
6627
  * activate the given vertex attribute for this shader
6652
- * @name setVertexAttributes
6653
- * @memberof GLShader
6654
6628
  * @param {WebGLRenderingContext} gl the current WebGL rendering context
6655
6629
  * @param {object[]} attributes an array of vertex attributes
6656
6630
  * @param {number} vertexByteSize the size of a single vertex in bytes
@@ -6672,8 +6646,6 @@
6672
6646
 
6673
6647
  /**
6674
6648
  * destroy this shader objects resources (program, attributes, uniforms)
6675
- * @name destroy
6676
- * @memberof GLShader
6677
6649
  */
6678
6650
  GLShader.prototype.destroy = function destroy () {
6679
6651
  this.uniforms = null;
@@ -6870,44 +6842,37 @@
6870
6842
 
6871
6843
  /**
6872
6844
  * a reference to the active WebGL shader
6873
- * @name activeShader
6874
- * @memberof WebGLCompositor
6875
6845
  * @type {GLShader}
6876
6846
  */
6877
6847
  this.activeShader = null;
6878
6848
 
6879
6849
  /**
6880
6850
  * primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
6881
- * @name mode
6882
- * @see WebGLCompositor
6883
- * @memberof WebGLCompositor
6851
+ * @type {number}
6884
6852
  * @default gl.TRIANGLES
6885
6853
  */
6886
6854
  this.mode = gl.TRIANGLES;
6887
6855
 
6888
6856
  /**
6889
6857
  * an array of vertex attribute properties
6890
- * @name attributes
6891
6858
  * @see WebGLCompositor.addAttribute
6892
- * @memberof WebGLCompositor
6859
+ * @type {Array}
6893
6860
  */
6894
6861
  this.attributes = [];
6895
6862
 
6896
6863
  /**
6897
6864
  * the size of a single vertex in bytes
6898
6865
  * (will automatically be calculated as attributes definitions are added)
6899
- * @name vertexByteSize
6900
6866
  * @see WebGLCompositor.addAttribute
6901
- * @memberof WebGLCompositor
6867
+ * @type {number}
6902
6868
  */
6903
6869
  this.vertexByteSize = 0;
6904
6870
 
6905
6871
  /**
6906
6872
  * the size of a single vertex in floats
6907
6873
  * (will automatically be calculated as attributes definitions are added)
6908
- * @name vertexSize
6909
6874
  * @see WebGLCompositor.addAttribute
6910
- * @memberof WebGLCompositor
6875
+ * @type {number}
6911
6876
  */
6912
6877
  this.vertexSize = 0;
6913
6878
 
@@ -6968,8 +6933,6 @@
6968
6933
 
6969
6934
  /**
6970
6935
  * add vertex attribute property definition to the compositor
6971
- * @name addAttribute
6972
- * @memberof WebGLCompositor
6973
6936
  * @param {string} name name of the attribute in the vertex shader
6974
6937
  * @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
6975
6938
  * @param {GLenum} type data type of each component in the array
@@ -7015,8 +6978,6 @@
7015
6978
 
7016
6979
  /**
7017
6980
  * Sets the viewport
7018
- * @name setViewport
7019
- * @memberof WebGLCompositor
7020
6981
  * @param {number} x x position of viewport
7021
6982
  * @param {number} y y position of viewport
7022
6983
  * @param {number} w width of viewport
@@ -7028,8 +6989,6 @@
7028
6989
 
7029
6990
  /**
7030
6991
  * Create a WebGL texture from an image
7031
- * @name createTexture2D
7032
- * @memberof WebGLCompositor
7033
6992
  * @param {number} unit Destination texture unit
7034
6993
  * @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
7035
6994
  * @param {number} filter gl.LINEAR or gl.NEAREST
@@ -7076,8 +7035,6 @@
7076
7035
 
7077
7036
  /**
7078
7037
  * delete the given WebGL texture
7079
- * @name bindTexture2D
7080
- * @memberof WebGLCompositor
7081
7038
  * @param {WebGLTexture} [texture] a WebGL texture to delete
7082
7039
  * @param {number} [unit] Texture unit to delete
7083
7040
  */
@@ -7088,8 +7045,6 @@
7088
7045
 
7089
7046
  /**
7090
7047
  * returns the WebGL texture associated to the given texture unit
7091
- * @name bindTexture2D
7092
- * @memberof WebGLCompositor
7093
7048
  * @param {number} unit Texture unit to which a texture is bound
7094
7049
  * @returns {WebGLTexture} texture a WebGL texture
7095
7050
  */
@@ -7099,8 +7054,6 @@
7099
7054
 
7100
7055
  /**
7101
7056
  * assign the given WebGL texture to the current batch
7102
- * @name bindTexture2D
7103
- * @memberof WebGLCompositor
7104
7057
  * @param {WebGLTexture} texture a WebGL texture
7105
7058
  * @param {number} unit Texture unit to which the given texture is bound
7106
7059
  */
@@ -7126,8 +7079,6 @@
7126
7079
 
7127
7080
  /**
7128
7081
  * unbind the given WebGL texture, forcing it to be reuploaded
7129
- * @name unbindTexture2D
7130
- * @memberof WebGLCompositor
7131
7082
  * @param {WebGLTexture} [texture] a WebGL texture
7132
7083
  * @param {number} [unit] a WebGL texture
7133
7084
  * @returns {number} unit the unit number that was associated with the given texture
@@ -7174,8 +7125,6 @@
7174
7125
 
7175
7126
  /**
7176
7127
  * set/change the current projection matrix
7177
- * @name setProjection
7178
- * @memberof WebGLCompositor
7179
7128
  * @param {Matrix3d} matrix
7180
7129
  */
7181
7130
  WebGLCompositor.prototype.setProjection = function setProjection (matrix) {
@@ -7184,9 +7133,7 @@
7184
7133
 
7185
7134
  /**
7186
7135
  * Select the shader to use for compositing
7187
- * @name useShader
7188
7136
  * @see GLShader
7189
- * @memberof WebGLCompositor
7190
7137
  * @param {GLShader} shader a reference to a GLShader instance
7191
7138
  */
7192
7139
  WebGLCompositor.prototype.useShader = function useShader (shader) {
@@ -7201,8 +7148,6 @@
7201
7148
 
7202
7149
  /**
7203
7150
  * Add a textured quad
7204
- * @name addQuad
7205
- * @memberof WebGLCompositor
7206
7151
  * @param {TextureAtlas} texture Source texture atlas
7207
7152
  * @param {number} x Destination x-coordinate
7208
7153
  * @param {number} y Destination y-coordinate
@@ -7258,7 +7203,6 @@
7258
7203
  /**
7259
7204
  * Flush batched texture operations to the GPU
7260
7205
  * @param {number} [mode=gl.TRIANGLES] the GL drawing mode
7261
- * @memberof WebGLCompositor
7262
7206
  */
7263
7207
  WebGLCompositor.prototype.flush = function flush (mode) {
7264
7208
  if ( mode === void 0 ) mode = this.mode;
@@ -7286,8 +7230,6 @@
7286
7230
 
7287
7231
  /**
7288
7232
  * Draw an array of vertices
7289
- * @name drawVertices
7290
- * @memberof WebGLCompositor
7291
7233
  * @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)
7292
7234
  * @param {Vector2d[]} verts vertices
7293
7235
  * @param {number} [vertexCount=verts.length] amount of points defined in the points array
@@ -7316,25 +7258,33 @@
7316
7258
  };
7317
7259
 
7318
7260
  /**
7319
- * Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
7320
- * @name clearColor
7321
- * @memberof WebGLCompositor
7322
- * @param {number} [r=0] - the red color value used when the color buffers are cleared
7323
- * @param {number} [g=0] - the green color value used when the color buffers are cleared
7324
- * @param {number} [b=0] - the blue color value used when the color buffers are cleared
7325
- * @param {number} [a=0] - the alpha color value used when the color buffers are cleared
7261
+ * Clear the frame buffer
7262
+ * @param {number} [alpha = 0.0] - the alpha value used when clearing the framebuffer
7326
7263
  */
7327
- WebGLCompositor.prototype.clearColor = function clearColor (r, g, b, a) {
7328
- this.gl.clearColor(r, g, b, a);
7264
+ WebGLCompositor.prototype.clear = function clear (alpha) {
7265
+ if ( alpha === void 0 ) alpha = 0;
7266
+
7267
+ var gl = this.gl;
7268
+ gl.clearColor(0, 0, 0, alpha);
7269
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
7329
7270
  };
7330
7271
 
7331
7272
  /**
7332
- * Clear the frame buffer
7333
- * @name clear
7334
- * @memberof WebGLCompositor
7273
+ * Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
7274
+ * @param {number} [r = 0] - the red color value used when the color buffers are cleared
7275
+ * @param {number} [g = 0] - the green color value used when the color buffers are cleared
7276
+ * @param {number} [b = 0] - the blue color value used when the color buffers are cleared
7277
+ * @param {number} [a = 0] - the alpha color value used when the color buffers are cleared
7335
7278
  */
7336
- WebGLCompositor.prototype.clear = function clear () {
7337
- this.gl.clear(this.gl.COLOR_BUFFER_BIT);
7279
+ WebGLCompositor.prototype.clearColor = function clearColor (r, g, b, a) {
7280
+ if ( r === void 0 ) r = 0;
7281
+ if ( g === void 0 ) g = 0;
7282
+ if ( b === void 0 ) b = 0;
7283
+ if ( a === void 0 ) a = 0;
7284
+
7285
+ var gl = this.gl;
7286
+ gl.clearColor(r, g, b, a);
7287
+ gl.clear(gl.COLOR_BUFFER_BIT);
7338
7288
  };
7339
7289
 
7340
7290
  var earcut$1 = {exports: {}};
@@ -9632,17 +9582,18 @@
9632
9582
  * add the given point to the bounds definition.
9633
9583
  * @name addPoint
9634
9584
  * @memberof Bounds
9635
- * @param {Vector2d} v
9636
- * @param {Matrix2d} [m] an optional transform to apply to the given point
9585
+ * @param {Vector2d|Point} point the point to be added to the bounds
9586
+ * @param {Matrix2d} [m] an optional transform to apply to the given point (only if the given point is a vector)
9637
9587
  */
9638
- Bounds.prototype.addPoint = function addPoint (v, m) {
9639
- if (typeof m !== "undefined") {
9640
- v = m.apply(v);
9588
+ Bounds.prototype.addPoint = function addPoint (point, m) {
9589
+ if ((typeof m !== "undefined") && (typeof point.rotate === "function")) {
9590
+ // only Vectors object have a rotate function
9591
+ point = m.apply(point);
9641
9592
  }
9642
- this.min.x = Math.min(this.min.x, v.x);
9643
- this.max.x = Math.max(this.max.x, v.x);
9644
- this.min.y = Math.min(this.min.y, v.y);
9645
- this.max.y = Math.max(this.max.y, v.y);
9593
+ this.min.x = Math.min(this.min.x, point.x);
9594
+ this.max.x = Math.max(this.max.x, point.x);
9595
+ this.min.y = Math.min(this.min.y, point.y);
9596
+ this.max.y = Math.max(this.max.y, point.y);
9646
9597
  };
9647
9598
 
9648
9599
  /**
@@ -10133,6 +10084,93 @@
10133
10084
  this.arcTo(x, y, x + radius, y, radius);
10134
10085
  };
10135
10086
 
10087
+ /**
10088
+ * @classdesc
10089
+ * represents a point in a 2d space
10090
+ */
10091
+ var Point = function Point(x, y) {
10092
+ if ( x === void 0 ) x = 0;
10093
+ if ( y === void 0 ) y = 0;
10094
+
10095
+ /**
10096
+ * the position of the point on the horizontal axis
10097
+ * @public
10098
+ * @type {Number}
10099
+ * @default 0
10100
+ */
10101
+ this.x = x;
10102
+
10103
+ /**
10104
+ * the position of the point on the vertical axis
10105
+ * @public
10106
+ * @type {Number}
10107
+ * @default 0
10108
+ */
10109
+ this.y = y;
10110
+ };
10111
+
10112
+ /** @ignore */
10113
+ Point.prototype.onResetEvent = function onResetEvent (x, y) {
10114
+ if ( x === void 0 ) x = 0;
10115
+ if ( y === void 0 ) y = 0;
10116
+
10117
+ this.set(x, y);
10118
+ };
10119
+
10120
+ /**
10121
+ * set the Point x and y properties to the given values
10122
+ * @param {number} x
10123
+ * @param {number} y
10124
+ * @returns {Point} Reference to this object for method chaining
10125
+ */
10126
+ Point.prototype.set = function set (x, y) {
10127
+ if ( x === void 0 ) x = 0;
10128
+ if ( y === void 0 ) y = 0;
10129
+
10130
+ this.x = x;
10131
+ this.y = y;
10132
+ return this;
10133
+ };
10134
+
10135
+ /**
10136
+ * return true if the two points are the same
10137
+ * @name equals
10138
+ * @memberof Point
10139
+ * @method
10140
+ * @param {Point} point
10141
+ * @returns {boolean}
10142
+ */
10143
+ /**
10144
+ * return true if this point is equal to the given values
10145
+ * @name equals
10146
+ * @memberof Point
10147
+ * @param {number} x
10148
+ * @param {number} y
10149
+ * @returns {boolean}
10150
+ */
10151
+ Point.prototype.equals = function equals () {
10152
+ var _x, _y;
10153
+ if (arguments.length === 2) {
10154
+ // x, y
10155
+ _x = arguments[0];
10156
+ _y = arguments[1];
10157
+ } else {
10158
+ // point
10159
+ _x = arguments[0].x;
10160
+ _y = arguments[0].y;
10161
+ }
10162
+ return ((this.x === _x) && (this.y === _y));
10163
+ };
10164
+
10165
+ /**
10166
+ * clone this Point
10167
+ * @name clone
10168
+ * @returns {Point} new Point
10169
+ */
10170
+ Point.prototype.clone = function clone () {
10171
+ return new Point(this.x, this.y);
10172
+ };
10173
+
10136
10174
  /**
10137
10175
  * @classdesc
10138
10176
  * a base renderer object
@@ -10141,26 +10179,20 @@
10141
10179
  /**
10142
10180
  * The given constructor options
10143
10181
  * @public
10144
- * @name settings
10145
- * @memberof Renderer#
10146
10182
  * @type {object}
10147
10183
  */
10148
10184
  this.settings = options;
10149
10185
 
10150
10186
  /**
10151
10187
  * true if the current rendering context is valid
10152
- * @name isContextValid
10153
- * @memberof Renderer#
10154
10188
  * @default true
10155
- * type {boolean}
10189
+ * @type {boolean}
10156
10190
  */
10157
10191
  this.isContextValid = true;
10158
10192
 
10159
10193
  /**
10160
10194
  * The Path2D instance used by the renderer to draw primitives
10161
- * @name path2D
10162
10195
  * @type {Path2D}
10163
- * @memberof Renderer#
10164
10196
  */
10165
10197
  this.path2D = new Path2D();
10166
10198
 
@@ -10212,22 +10244,16 @@
10212
10244
 
10213
10245
  /**
10214
10246
  * prepare the framebuffer for drawing a new frame
10215
- * @name clear
10216
- * @memberof Renderer
10217
10247
  */
10218
10248
  Renderer.prototype.clear = function clear () {};
10219
10249
 
10220
10250
  /**
10221
10251
  * render the main framebuffer on screen
10222
- * @name flush
10223
- * @memberof Renderer
10224
10252
  */
10225
10253
  Renderer.prototype.flush = function flush () {};
10226
10254
 
10227
10255
  /**
10228
10256
  * Reset context state
10229
- * @name reset
10230
- * @memberof Renderer
10231
10257
  */
10232
10258
  Renderer.prototype.reset = function reset () {
10233
10259
  this.resetTransform();
@@ -10244,8 +10270,6 @@
10244
10270
 
10245
10271
  /**
10246
10272
  * return a reference to the canvas which this renderer draws to
10247
- * @name getCanvas
10248
- * @memberof Renderer
10249
10273
  * @returns {HTMLCanvasElement}
10250
10274
  */
10251
10275
  Renderer.prototype.getCanvas = function getCanvas () {
@@ -10255,8 +10279,6 @@
10255
10279
 
10256
10280
  /**
10257
10281
  * return a reference to this renderer canvas corresponding Context
10258
- * @name getContext
10259
- * @memberof Renderer
10260
10282
  * @returns {CanvasRenderingContext2D|WebGLRenderingContext}
10261
10283
  */
10262
10284
  Renderer.prototype.getContext = function getContext () {
@@ -10265,8 +10287,6 @@
10265
10287
 
10266
10288
  /**
10267
10289
  * returns the current blend mode for this renderer
10268
- * @name getBlendMode
10269
- * @memberof Renderer
10270
10290
  * @returns {string} blend mode
10271
10291
  */
10272
10292
  Renderer.prototype.getBlendMode = function getBlendMode () {
@@ -10276,8 +10296,6 @@
10276
10296
  /**
10277
10297
  * Returns the 2D Context object of the given Canvas<br>
10278
10298
  * Also configures anti-aliasing and blend modes based on constructor options.
10279
- * @name getContext2d
10280
- * @memberof Renderer
10281
10299
  * @param {HTMLCanvasElement} canvas
10282
10300
  * @param {boolean} [transparent=true] use false to disable transparency
10283
10301
  * @returns {CanvasRenderingContext2D}
@@ -10313,8 +10331,6 @@
10313
10331
 
10314
10332
  /**
10315
10333
  * return the width of the system Canvas
10316
- * @name getWidth
10317
- * @memberof Renderer
10318
10334
  * @returns {number}
10319
10335
  */
10320
10336
  Renderer.prototype.getWidth = function getWidth () {
@@ -10323,8 +10339,6 @@
10323
10339
 
10324
10340
  /**
10325
10341
  * return the height of the system Canvas
10326
- * @name getHeight
10327
- * @memberof Renderer
10328
10342
  * @returns {number} height of the system Canvas
10329
10343
  */
10330
10344
  Renderer.prototype.getHeight = function getHeight () {
@@ -10333,8 +10347,6 @@
10333
10347
 
10334
10348
  /**
10335
10349
  * get the current fill & stroke style color.
10336
- * @name getColor
10337
- * @memberof Renderer
10338
10350
  * @returns {Color} current global color
10339
10351
  */
10340
10352
  Renderer.prototype.getColor = function getColor () {
@@ -10343,8 +10355,6 @@
10343
10355
 
10344
10356
  /**
10345
10357
  * return the current global alpha
10346
- * @name globalAlpha
10347
- * @memberof Renderer
10348
10358
  * @returns {number}
10349
10359
  */
10350
10360
  Renderer.prototype.globalAlpha = function globalAlpha () {
@@ -10353,8 +10363,6 @@
10353
10363
 
10354
10364
  /**
10355
10365
  * check if the given rect or bounds overlaps with the renderer screen coordinates
10356
- * @name overlaps
10357
- * @memberof Renderer
10358
10366
  * @param {Rect|Bounds} bounds
10359
10367
  * @returns {boolean} true if overlaps
10360
10368
  */
@@ -10368,8 +10376,6 @@
10368
10376
 
10369
10377
  /**
10370
10378
  * resizes the system canvas
10371
- * @name resize
10372
- * @memberof Renderer
10373
10379
  * @param {number} width new width of the canvas
10374
10380
  * @param {number} height new height of the canvas
10375
10381
  */
@@ -10389,8 +10395,6 @@
10389
10395
 
10390
10396
  /**
10391
10397
  * enable/disable image smoothing (scaling interpolation) for the given context
10392
- * @name setAntiAlias
10393
- * @memberof Renderer
10394
10398
  * @param {CanvasRenderingContext2D} context
10395
10399
  * @param {boolean} [enable=false]
10396
10400
  */
@@ -10418,8 +10422,6 @@
10418
10422
 
10419
10423
  /**
10420
10424
  * set/change the current projection matrix (WebGL only)
10421
- * @name setProjection
10422
- * @memberof Renderer
10423
10425
  * @param {Matrix3d} matrix
10424
10426
  */
10425
10427
  Renderer.prototype.setProjection = function setProjection (matrix) {
@@ -10428,8 +10430,6 @@
10428
10430
 
10429
10431
  /**
10430
10432
  * stroke the given shape
10431
- * @name stroke
10432
- * @memberof Renderer
10433
10433
  * @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
10434
10434
  * @param {boolean} [fill=false] fill the shape with the current color if true
10435
10435
  */
@@ -10456,6 +10456,10 @@
10456
10456
  );
10457
10457
  return;
10458
10458
  }
10459
+ if (shape instanceof Point) {
10460
+ this.strokePoint(shape.x, shape.y);
10461
+ return;
10462
+ }
10459
10463
  throw new Error("Invalid geometry for fill/stroke");
10460
10464
  };
10461
10465
 
@@ -10471,8 +10475,6 @@
10471
10475
 
10472
10476
  /**
10473
10477
  * tint the given image or canvas using the given color
10474
- * @name tint
10475
- * @memberof Renderer
10476
10478
  * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
10477
10479
  * @param {Color|string} color the color that will be used to tint the image
10478
10480
  * @param {string} [mode="multiply"] the composition mode used to tint the image
@@ -10501,8 +10503,6 @@
10501
10503
  * A mask limits rendering elements to the shape and position of the given mask object.
10502
10504
  * So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
10503
10505
  * Mask are not preserved through renderer context save and restore.
10504
- * @name setMask
10505
- * @memberof Renderer
10506
10506
  * @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
10507
10507
  * @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
10508
10508
  */
@@ -10511,16 +10511,12 @@
10511
10511
 
10512
10512
  /**
10513
10513
  * disable (remove) the rendering mask set through setMask.
10514
- * @name clearMask
10515
10514
  * @see Renderer#setMask
10516
- * @memberof Renderer
10517
10515
  */
10518
10516
  Renderer.prototype.clearMask = function clearMask () {};
10519
10517
 
10520
10518
  /**
10521
10519
  * set a coloring tint for sprite based renderables
10522
- * @name setTint
10523
- * @memberof Renderer
10524
10520
  * @param {Color} tint the tint color
10525
10521
  * @param {number} [alpha] an alpha value to be applied to the tint
10526
10522
  */
@@ -10534,9 +10530,7 @@
10534
10530
 
10535
10531
  /**
10536
10532
  * clear the rendering tint set through setTint.
10537
- * @name clearTint
10538
10533
  * @see Renderer#setTint
10539
- * @memberof Renderer
10540
10534
  */
10541
10535
  Renderer.prototype.clearTint = function clearTint () {
10542
10536
  // reset to default
@@ -18092,21 +18086,14 @@
18092
18086
 
18093
18087
  /**
18094
18088
  * If true then physic collision and input events will not impact this renderable
18095
- * @public
18096
18089
  * @type {boolean}
18097
18090
  * @default true
18098
- * @name isKinematic
18099
- * @memberof Renderable
18100
18091
  */
18101
18092
  this.isKinematic = true;
18102
18093
 
18103
18094
  /**
18104
18095
  * the renderable physic body
18105
- * @public
18106
18096
  * @type {Body}
18107
- * @see Body
18108
- * @name body
18109
- * @memberof Renderable#
18110
18097
  * @example
18111
18098
  * // define a new Player Class
18112
18099
  * class PlayerEntity extends me.Sprite {
@@ -18144,10 +18131,7 @@
18144
18131
  if (typeof this.currentTransform === "undefined") {
18145
18132
  /**
18146
18133
  * the renderable default transformation matrix
18147
- * @public
18148
18134
  * @type {Matrix2d}
18149
- * @name currentTransform
18150
- * @memberof Renderable#
18151
18135
  */
18152
18136
  this.currentTransform = pool.pull("Matrix2d");
18153
18137
  }
@@ -18157,20 +18141,14 @@
18157
18141
  * (G)ame (U)nique (Id)entifier" <br>
18158
18142
  * a GUID will be allocated for any renderable object added <br>
18159
18143
  * to an object container (including the `me.game.world` container)
18160
- * @public
18161
18144
  * @type {string}
18162
- * @name GUID
18163
- * @memberof Renderable
18164
18145
  */
18165
18146
  this.GUID = undefined;
18166
18147
 
18167
18148
  /**
18168
18149
  * an event handler that is called when the renderable leave or enter a camera viewport
18169
- * @public
18170
18150
  * @type {Function}
18171
18151
  * @default undefined
18172
- * @name onVisibilityChange
18173
- * @memberof Renderable#
18174
18152
  * @example
18175
18153
  * this.onVisibilityChange = function(inViewport) {
18176
18154
  * if (inViewport === true) {
@@ -18182,42 +18160,30 @@
18182
18160
 
18183
18161
  /**
18184
18162
  * Whether the renderable object will always update, even when outside of the viewport<br>
18185
- * @public
18186
18163
  * @type {boolean}
18187
18164
  * @default false
18188
- * @name alwaysUpdate
18189
- * @memberof Renderable
18190
18165
  */
18191
18166
  this.alwaysUpdate = false;
18192
18167
 
18193
18168
  /**
18194
18169
  * Whether to update this object when the game is paused.
18195
- * @public
18196
18170
  * @type {boolean}
18197
18171
  * @default false
18198
- * @name updateWhenPaused
18199
- * @memberof Renderable
18200
18172
  */
18201
18173
  this.updateWhenPaused = false;
18202
18174
 
18203
18175
  /**
18204
18176
  * make the renderable object persistent over level changes<br>
18205
- * @public
18206
18177
  * @type {boolean}
18207
18178
  * @default false
18208
- * @name isPersistent
18209
- * @memberof Renderable
18210
18179
  */
18211
18180
  this.isPersistent = false;
18212
18181
 
18213
18182
  /**
18214
18183
  * If true, this renderable will be rendered using screen coordinates,
18215
18184
  * as opposed to world coordinates. Use this, for example, to define UI elements.
18216
- * @public
18217
18185
  * @type {boolean}
18218
18186
  * @default false
18219
- * @name floating
18220
- * @memberof Renderable
18221
18187
  */
18222
18188
  this.floating = false;
18223
18189
 
@@ -18232,11 +18198,8 @@
18232
18198
  * <br>
18233
18199
  * <i><b>Note:</b> Object created through Tiled will have their anchorPoint set to (0, 0) to match Tiled Level editor implementation.
18234
18200
  * To specify a value through Tiled, use a json expression like `json:{"x":0.5,"y":0.5}`. </i>
18235
- * @public
18236
18201
  * @type {ObservableVector2d}
18237
18202
  * @default <0.5,0.5>
18238
- * @name anchorPoint
18239
- * @memberof Renderable#
18240
18203
  */
18241
18204
  this.anchorPoint = pool.pull("ObservableVector2d", 0.5, 0.5, { onUpdate: this.onAnchorUpdate, scope: this });
18242
18205
  }
@@ -18244,11 +18207,8 @@
18244
18207
  /**
18245
18208
  * When enabled, an object container will automatically apply
18246
18209
  * any defined transformation before calling the child draw method.
18247
- * @public
18248
18210
  * @type {boolean}
18249
18211
  * @default true
18250
- * @name autoTransform
18251
- * @memberof Renderable
18252
18212
  * @example
18253
18213
  * // enable "automatic" transformation when the object is activated
18254
18214
  * onActivateEvent: function () {
@@ -18268,30 +18228,23 @@
18268
18228
  * Set to zero if you do not wish an object to be drawn
18269
18229
  * @see Renderable#setOpacity
18270
18230
  * @see Renderable#getOpacity
18271
- * @public
18272
18231
  * @type {number}
18273
18232
  * @default 1.0
18274
- * @name Renderable#alpha
18275
18233
  */
18276
18234
  this.alpha = 1.0;
18277
18235
 
18278
18236
  /**
18279
18237
  * a reference to the parent object that contains this renderable
18280
- * @public
18281
18238
  * @type {Container|Entity}
18282
18239
  * @default undefined
18283
- * @name Renderable#ancestor
18284
18240
  */
18285
18241
  this.ancestor = undefined;
18286
18242
 
18287
18243
  /**
18288
18244
  * A mask limits rendering elements to the shape and position of the given mask object.
18289
18245
  * So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
18290
- * @public
18291
18246
  * @type {Rect|RoundRect|Polygon|Line|Ellipse}
18292
- * @name mask
18293
18247
  * @default undefined
18294
- * @memberof Renderable#
18295
18248
  * @example
18296
18249
  * // apply a mask in the shape of a Star
18297
18250
  * myNPCSprite.mask = new me.Polygon(myNPCSprite.width / 2, 0, [
@@ -18310,40 +18263,19 @@
18310
18263
  */
18311
18264
  this.mask = undefined;
18312
18265
 
18313
- /**
18314
- * define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
18315
- * @public
18316
- * @type {Color}
18317
- * @name tint
18318
- * @default (255, 255, 255)
18319
- * @memberof Renderable#
18320
- * @example
18321
- * // add a red tint to this renderable
18322
- * this.tint.setColor(255, 128, 128);
18323
- * // remove the tint
18324
- * this.tint.setColor(255, 255, 255);
18325
- */
18326
- this.tint = pool.pull("Color", 255, 255, 255, 1.0);
18327
-
18328
18266
  /**
18329
18267
  * the blend mode to be applied to this renderable (see renderer setBlendMode for available blend mode)
18330
- * @public
18331
18268
  * @type {string}
18332
- * @name blendMode
18333
18269
  * @default "normal"
18334
18270
  * @see CanvasRenderer#setBlendMode
18335
18271
  * @see WebGLRenderer#setBlendMode
18336
- * @memberof Renderable#
18337
18272
  */
18338
18273
  this.blendMode = "normal";
18339
18274
 
18340
18275
  /**
18341
18276
  * The name of the renderable
18342
- * @public
18343
18277
  * @type {string}
18344
- * @name name
18345
18278
  * @default ""
18346
- * @memberof Renderable
18347
18279
  */
18348
18280
  this.name = "";
18349
18281
 
@@ -18354,8 +18286,6 @@
18354
18286
  * Position of the Renderable relative to its parent container
18355
18287
  * @public
18356
18288
  * @type {ObservableVector3d}
18357
- * @name pos
18358
- * @memberof Renderable#
18359
18289
  */
18360
18290
  this.pos = pool.pull("ObservableVector3d", x, y, 0, { onUpdate: this.updateBoundsPos, scope: this});
18361
18291
  }
@@ -18363,9 +18293,7 @@
18363
18293
  /**
18364
18294
  * when true the renderable will be redrawn during the next update cycle
18365
18295
  * @type {boolean}
18366
- * @name isDirty
18367
18296
  * @default false
18368
- * @memberof Renderable#
18369
18297
  */
18370
18298
  this.isDirty = false;
18371
18299
 
@@ -18386,27 +18314,49 @@
18386
18314
  Renderable.prototype = Object.create( Rect && Rect.prototype );
18387
18315
  Renderable.prototype.constructor = Renderable;
18388
18316
 
18389
- var prototypeAccessors = { isFloating: { configurable: true },inViewport: { configurable: true },isFlippedX: { configurable: true },isFlippedY: { configurable: true } };
18317
+ var prototypeAccessors = { isFloating: { configurable: true },tint: { configurable: true },inViewport: { configurable: true },isFlippedX: { configurable: true },isFlippedY: { configurable: true } };
18390
18318
 
18391
18319
  /**
18392
18320
  * Whether the renderable object is floating, or contained in a floating container
18393
- * @public
18394
18321
  * @see Renderable#floating
18395
18322
  * @type {boolean}
18396
- * @name isFloating
18397
- * @memberof Renderable
18398
18323
  */
18399
18324
  prototypeAccessors.isFloating.get = function () {
18400
18325
  return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.floating === true);
18401
18326
  };
18402
18327
 
18328
+ /**
18329
+ * define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
18330
+ * @type {Color}
18331
+ * @default (255, 255, 255)
18332
+ * @example
18333
+ * // add a red tint to this renderable
18334
+ * this.tint.setColor(255, 128, 128);
18335
+ * // remove the tint
18336
+ * this.tint.setColor(255, 255, 255);
18337
+ */
18338
+ prototypeAccessors.tint.get = function () {
18339
+ if (typeof this._tint === "undefined") {
18340
+ this._tint = pool.pull("Color", 255, 255, 255, 1.0);
18341
+ }
18342
+ return this._tint;
18343
+ };
18344
+ prototypeAccessors.tint.set = function (value) {
18345
+ if (typeof this._tint === "undefined") {
18346
+ this._tint = pool.pull("Color", 255, 255, 255, 1.0);
18347
+ }
18348
+ if (value instanceof Color) {
18349
+ this._tint.copy(value);
18350
+ } else {
18351
+ // string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
18352
+ this._tint.parseCSS(value);
18353
+ }
18354
+ };
18355
+
18403
18356
  /**
18404
18357
  * Whether the renderable object is visible and within the viewport
18405
- * @public
18406
18358
  * @type {boolean}
18407
18359
  * @default false
18408
- * @name inViewport
18409
- * @memberof Renderable
18410
18360
  */
18411
18361
  prototypeAccessors.inViewport.get = function () {
18412
18362
  return this._inViewport;
@@ -18425,8 +18375,6 @@
18425
18375
  * @public
18426
18376
  * @see Renderable#flipX
18427
18377
  * @type {boolean}
18428
- * @name isFlippedX
18429
- * @memberof Renderable
18430
18378
  */
18431
18379
  prototypeAccessors.isFlippedX.get = function () {
18432
18380
  return this._flip.x === true;
@@ -18437,8 +18385,6 @@
18437
18385
  * @public
18438
18386
  * @see Renderable#flipY
18439
18387
  * @type {boolean}
18440
- * @name isFlippedY
18441
- * @memberof Renderable
18442
18388
  */
18443
18389
  prototypeAccessors.isFlippedY.get = function () {
18444
18390
  return this._flip.y === true;
@@ -18446,8 +18392,6 @@
18446
18392
 
18447
18393
  /**
18448
18394
  * returns the bounding box for this renderable
18449
- * @name getBounds
18450
- * @memberof Renderable
18451
18395
  * @returns {Bounds} bounding box Rectangle object
18452
18396
  */
18453
18397
  Renderable.prototype.getBounds = function getBounds () {
@@ -18466,8 +18410,6 @@
18466
18410
 
18467
18411
  /**
18468
18412
  * get the renderable alpha channel value<br>
18469
- * @name getOpacity
18470
- * @memberof Renderable
18471
18413
  * @returns {number} current opacity value between 0 and 1
18472
18414
  */
18473
18415
  Renderable.prototype.getOpacity = function getOpacity () {
@@ -18476,8 +18418,6 @@
18476
18418
 
18477
18419
  /**
18478
18420
  * set the renderable alpha channel value<br>
18479
- * @name setOpacity
18480
- * @memberof Renderable
18481
18421
  * @param {number} alpha opacity value between 0.0 and 1.0
18482
18422
  */
18483
18423
  Renderable.prototype.setOpacity = function setOpacity (alpha) {
@@ -18494,8 +18434,6 @@
18494
18434
  /**
18495
18435
  * flip the renderable on the horizontal axis (around the center of the renderable)
18496
18436
  * @see Matrix2d#scaleX
18497
- * @name flipX
18498
- * @memberof Renderable
18499
18437
  * @param {boolean} [flip=true] `true` to flip this renderable.
18500
18438
  * @returns {Renderable} Reference to this object for method chaining
18501
18439
  */
@@ -18510,8 +18448,6 @@
18510
18448
  /**
18511
18449
  * flip the renderable on the vertical axis (around the center of the renderable)
18512
18450
  * @see Matrix2d#scaleY
18513
- * @name flipY
18514
- * @memberof Renderable
18515
18451
  * @param {boolean} [flip=true] `true` to flip this renderable.
18516
18452
  * @returns {Renderable} Reference to this object for method chaining
18517
18453
  */
@@ -18525,8 +18461,6 @@
18525
18461
 
18526
18462
  /**
18527
18463
  * multiply the renderable currentTransform with the given matrix
18528
- * @name transform
18529
- * @memberof Renderable
18530
18464
  * @see Renderable#currentTransform
18531
18465
  * @param {Matrix2d} m the transformation matrix
18532
18466
  * @returns {Renderable} Reference to this object for method chaining
@@ -18541,8 +18475,6 @@
18541
18475
 
18542
18476
  /**
18543
18477
  * return the angle to the specified target
18544
- * @name angleTo
18545
- * @memberof Renderable
18546
18478
  * @param {Renderable|Vector2d|Vector3d} target
18547
18479
  * @returns {number} angle in radians
18548
18480
  */
@@ -18564,8 +18496,6 @@
18564
18496
 
18565
18497
  /**
18566
18498
  * return the distance to the specified target
18567
- * @name distanceTo
18568
- * @memberof Renderable
18569
18499
  * @param {Renderable|Vector2d|Vector3d} target
18570
18500
  * @returns {number} distance
18571
18501
  */
@@ -18587,8 +18517,6 @@
18587
18517
 
18588
18518
  /**
18589
18519
  * Rotate this renderable towards the given target.
18590
- * @name lookAt
18591
- * @memberof Renderable
18592
18520
  * @param {Renderable|Vector2d|Vector3d} target the renderable or position to look at
18593
18521
  * @returns {Renderable} Reference to this object for method chaining
18594
18522
  */
@@ -18610,8 +18538,6 @@
18610
18538
 
18611
18539
  /**
18612
18540
  * Rotate this renderable by the specified angle (in radians).
18613
- * @name rotate
18614
- * @memberof Renderable
18615
18541
  * @param {number} angle The angle to rotate (in radians)
18616
18542
  * @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
18617
18543
  * @returns {Renderable} Reference to this object for method chaining
@@ -18631,8 +18557,6 @@
18631
18557
  * when rendering. It does not scale the object itself. For example if the renderable
18632
18558
  * is an image, the image.width and image.height properties are unaltered but the currentTransform
18633
18559
  * member will be changed.
18634
- * @name scale
18635
- * @memberof Renderable
18636
18560
  * @param {number} x a number representing the abscissa of the scaling vector.
18637
18561
  * @param {number} [y=x] a number representing the ordinate of the scaling vector.
18638
18562
  * @returns {Renderable} Reference to this object for method chaining
@@ -18646,8 +18570,6 @@
18646
18570
 
18647
18571
  /**
18648
18572
  * scale the renderable around his anchor point
18649
- * @name scaleV
18650
- * @memberof Renderable
18651
18573
  * @param {Vector2d} v scaling vector
18652
18574
  * @returns {Renderable} Reference to this object for method chaining
18653
18575
  */
@@ -18657,11 +18579,7 @@
18657
18579
  };
18658
18580
 
18659
18581
  /**
18660
- * update function. <br>
18661
- * automatically called by the game manager {@link game}
18662
- * @name update
18663
- * @memberof Renderable
18664
- * @protected
18582
+ * update function (automatically called by melonJS).
18665
18583
  * @param {number} dt time since the last update in milliseconds.
18666
18584
  * @returns {boolean} true if the renderable is dirty
18667
18585
  */
@@ -18672,8 +18590,6 @@
18672
18590
  /**
18673
18591
  * update the bounding box for this shape.
18674
18592
  * @ignore
18675
- * @name updateBounds
18676
- * @memberof Renderable
18677
18593
  * @returns {Bounds} this shape bounding box Rectangle object
18678
18594
  */
18679
18595
  Renderable.prototype.updateBounds = function updateBounds () {
@@ -18685,8 +18601,6 @@
18685
18601
  /**
18686
18602
  * update the renderable's bounding rect (private)
18687
18603
  * @ignore
18688
- * @name updateBoundsPos
18689
- * @memberof Renderable
18690
18604
  */
18691
18605
  Renderable.prototype.updateBoundsPos = function updateBoundsPos (newX, newY) {
18692
18606
  var bounds = this.getBounds();
@@ -18717,8 +18631,6 @@
18717
18631
 
18718
18632
  /**
18719
18633
  * return the renderable absolute position in the game world
18720
- * @name getAbsolutePosition
18721
- * @memberof Renderable
18722
18634
  * @returns {Vector2d}
18723
18635
  */
18724
18636
  Renderable.prototype.getAbsolutePosition = function getAbsolutePosition () {
@@ -18736,8 +18648,6 @@
18736
18648
  /**
18737
18649
  * called when the anchor point value is changed
18738
18650
  * @private
18739
- * @name onAnchorUpdate
18740
- * @memberof Renderable
18741
18651
  * @param {number} x the new X value to be set for the anchor
18742
18652
  * @param {number} y the new Y value to be set for the anchor
18743
18653
  */
@@ -18750,12 +18660,10 @@
18750
18660
  };
18751
18661
 
18752
18662
  /**
18753
- * prepare the rendering context before drawing
18754
- * (apply defined transforms, anchor point). <br>
18755
- * automatically called by the game manager {@link game}
18756
- * @name preDraw
18757
- * @memberof Renderable
18758
- * @protected
18663
+ * Prepare the rendering context before drawing (automatically called by melonJS).
18664
+ * This will apply any defined transforms, anchor point, tint or blend mode and translate the context accordingly to this renderable position.
18665
+ * @see Renderable#draw
18666
+ * @see Renderable#postDraw
18759
18667
  * @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
18760
18668
  */
18761
18669
  Renderable.prototype.preDraw = function preDraw (renderer) {
@@ -18806,10 +18714,15 @@
18806
18714
  };
18807
18715
 
18808
18716
  /**
18809
- * draw this renderable (automatically called by melonJS)
18810
- * @name draw
18811
- * @memberof Renderable
18812
- * @protected
18717
+ * Draw this renderable (automatically called by melonJS).
18718
+ * All draw operations for renderable are made respectively
18719
+ * to the position or transforms set or applied by the preDraw method.
18720
+ * The main draw loop will first call preDraw() to prepare the context for drawing the renderable,
18721
+ * then draw() to draw the renderable, and finally postDraw() to clear the context.
18722
+ * If you override this method, be mindful about the drawing logic; for example if you draw a shape
18723
+ * from the draw method, you should make sure that your draw it at the 0, 0 coordinates.
18724
+ * @see Renderable#preDraw
18725
+ * @see Renderable#postDraw
18813
18726
  * @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
18814
18727
  * @param {Camera2d} [viewport] the viewport to (re)draw
18815
18728
  */
@@ -18818,11 +18731,9 @@
18818
18731
  };
18819
18732
 
18820
18733
  /**
18821
- * restore the rendering context after drawing. <br>
18822
- * automatically called by the game manager {@link game}
18823
- * @name postDraw
18824
- * @memberof Renderable
18825
- * @protected
18734
+ * restore the rendering context after drawing (automatically called by melonJS).
18735
+ * @see Renderable#preDraw
18736
+ * @see Renderable#draw
18826
18737
  * @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
18827
18738
  */
18828
18739
  Renderable.prototype.postDraw = function postDraw (renderer) {
@@ -18844,8 +18755,6 @@
18844
18755
  /**
18845
18756
  * onCollision callback, triggered in case of collision,
18846
18757
  * when this renderable body is colliding with another one
18847
- * @name onCollision
18848
- * @memberof Renderable
18849
18758
  * @param {ResponseObject} response the collision response object
18850
18759
  * @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
18851
18760
  * @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
@@ -18897,9 +18806,9 @@
18897
18806
  this.mask = undefined;
18898
18807
  }
18899
18808
 
18900
- if (typeof this.tint !== "undefined") {
18901
- pool.push(this.tint);
18902
- this.tint = undefined;
18809
+ if (typeof this._tint !== "undefined") {
18810
+ pool.push(this._tint);
18811
+ this._tint = undefined;
18903
18812
  }
18904
18813
 
18905
18814
  this.ancestor = undefined;
@@ -18920,8 +18829,6 @@
18920
18829
  /**
18921
18830
  * OnDestroy Notification function<br>
18922
18831
  * Called by engine before deleting the object
18923
- * @name onDestroyEvent
18924
- * @memberof Renderable
18925
18832
  */
18926
18833
  Renderable.prototype.onDestroyEvent = function onDestroyEvent () {
18927
18834
  // to be extended !
@@ -19790,7 +19697,7 @@
19790
19697
  /**
19791
19698
  * The collision shapes of the body
19792
19699
  * @ignore
19793
- * @type {Polygon[]|Line[]|Ellipse[]}
19700
+ * @type {Polygon[]|Line[]|Ellipse[]|Point|Point[]}
19794
19701
  */
19795
19702
  this.shapes = [];
19796
19703
  }
@@ -19984,7 +19891,7 @@
19984
19891
  /**
19985
19892
  * add a collision shape to this body <br>
19986
19893
  * (note: me.Rect objects will be converted to me.Polygon before being added)
19987
- * @param {Rect|Polygon|Line|Ellipse|Bounds|object} shape a shape or JSON object
19894
+ * @param {Rect|Polygon|Line|Ellipse|Point|Point[]|Bounds|object} shape a shape or JSON object
19988
19895
  * @returns {number} the shape array length
19989
19896
  * @example
19990
19897
  * // add a rectangle shape
@@ -20019,6 +19926,12 @@
20019
19926
  // update the body bounds
20020
19927
  this.bounds.add(shape.points);
20021
19928
  this.bounds.translate(shape.pos);
19929
+ } else if (shape instanceof Point) {
19930
+ if (!this.shapes.includes(shape)) {
19931
+ // see removeShape
19932
+ this.shapes.push(shape);
19933
+ }
19934
+ this.bounds.addPoint(shape);
20022
19935
  } else {
20023
19936
  // JSON object
20024
19937
  this.fromJSON(shape);
@@ -24548,8 +24461,10 @@
24548
24461
  * @memberof CanvasRenderer
24549
24462
  */
24550
24463
  CanvasRenderer.prototype.clear = function clear () {
24551
- if (this.settings.transparent) {
24552
- this.clearColor("rgba(0,0,0,0)", true);
24464
+ if (this.settings.transparent === false) {
24465
+ var canvas = this.getCanvas();
24466
+ var context = this.getContext();
24467
+ context.clearRect(0, 0, canvas.width, canvas.height);
24553
24468
  }
24554
24469
  };
24555
24470
 
@@ -24562,13 +24477,15 @@
24562
24477
  */
24563
24478
  CanvasRenderer.prototype.clearColor = function clearColor (color, opaque) {
24564
24479
  if ( color === void 0 ) color = "#000000";
24480
+ if ( opaque === void 0 ) opaque = false;
24565
24481
 
24566
24482
  var canvas = this.getCanvas();
24567
24483
  var context = this.getContext();
24568
24484
 
24569
24485
  this.save();
24570
24486
  this.resetTransform();
24571
- context.globalCompositeOperation = opaque ? "copy" : "source-over";
24487
+ context.globalAlpha = 1;
24488
+ context.globalCompositeOperation = opaque === true ? "copy" : "source-over";
24572
24489
  context.fillStyle = (color instanceof Color) ? color.toRGBA() : color;
24573
24490
  this.fillRect(0, 0, canvas.width, canvas.height);
24574
24491
  this.restore();
@@ -24940,6 +24857,30 @@
24940
24857
  this.strokeRoundRect(x, y, width, height, radius, true);
24941
24858
  };
24942
24859
 
24860
+ /**
24861
+ * Stroke a Point at the specified coordinates
24862
+ * @name strokePoint
24863
+ * @memberof CanvasRenderer
24864
+ * @param {number} x
24865
+ * @param {number} y
24866
+ */
24867
+ CanvasRenderer.prototype.strokePoint = function strokePoint (x, y) {
24868
+ this.strokeLine(x, y, x + 1, y + 1);
24869
+ };
24870
+
24871
+ /**
24872
+ * Draw a a point at the specified coordinates
24873
+ * @name fillPoint
24874
+ * @memberof CanvasRenderer
24875
+ * @param {number} x
24876
+ * @param {number} y
24877
+ * @param {number} width
24878
+ * @param {number} height
24879
+ */
24880
+ CanvasRenderer.prototype.fillPoint = function fillPoint (x, y) {
24881
+ this.strokePoint(x, y);
24882
+ };
24883
+
24943
24884
  /**
24944
24885
  * return a reference to the font 2d Context
24945
24886
  * @ignore
@@ -27146,7 +27087,7 @@
27146
27087
  this.type = settings.type;
27147
27088
 
27148
27089
  /**
27149
- * the åobject class
27090
+ * the object class
27150
27091
  * @public
27151
27092
  * @type {string}
27152
27093
  * @name class
@@ -27209,6 +27150,15 @@
27209
27150
  */
27210
27151
  this.isEllipse = false;
27211
27152
 
27153
+ /**
27154
+ * if true, the object is a Point
27155
+ * @public
27156
+ * @type {boolean}
27157
+ * @name isPoint
27158
+ * @memberof TMXObject
27159
+ */
27160
+ this.isPoint = false;
27161
+
27212
27162
  /**
27213
27163
  * if true, the object is a Polygon
27214
27164
  * @public
@@ -27232,12 +27182,14 @@
27232
27182
  this.setTile(map.tilesets);
27233
27183
  }
27234
27184
  else {
27235
- if (typeof(settings.ellipse) !== "undefined") {
27185
+ if (typeof settings.ellipse !== "undefined") {
27236
27186
  this.isEllipse = true;
27237
- } else if (typeof(settings.polygon) !== "undefined") {
27187
+ } else if (typeof settings.point !== "undefined") {
27188
+ this.isPoint = true;
27189
+ } else if (typeof settings.polygon !== "undefined") {
27238
27190
  this.points = settings.polygon;
27239
27191
  this.isPolygon = true;
27240
- } else if (typeof(settings.polyline) !== "undefined") {
27192
+ } else if (typeof settings.polyline !== "undefined") {
27241
27193
  this.points = settings.polyline;
27242
27194
  this.isPolyLine = true;
27243
27195
  }
@@ -27311,8 +27263,9 @@
27311
27263
  this.width,
27312
27264
  this.height
27313
27265
  )).rotate(this.rotation));
27266
+ } else if (this.isPoint === true) {
27267
+ shapes.push(pool.pull("Point", this.x, this.y));
27314
27268
  } else {
27315
-
27316
27269
  // add a polygon
27317
27270
  if (this.isPolygon === true) {
27318
27271
  var _polygon = pool.pull("Polygon", 0, 0, this.points);
@@ -27321,10 +27274,8 @@
27321
27274
  throw new Error("collision polygones in Tiled should be defined as Convex");
27322
27275
  }
27323
27276
  shapes.push(_polygon.rotate(this.rotation));
27324
- }
27325
27277
 
27326
- // add a polyline
27327
- else if (this.isPolyLine === true) {
27278
+ } else if (this.isPolyLine === true) {
27328
27279
  var p = this.points;
27329
27280
  var p1, p2;
27330
27281
  var segments = p.length - 1;
@@ -27356,7 +27307,9 @@
27356
27307
  // Apply isometric projection
27357
27308
  if (this.orientation === "isometric") {
27358
27309
  for (i = 0; i < shapes.length; i++) {
27359
- shapes[i].toIso();
27310
+ if (typeof shapes[i].toIso === "function") {
27311
+ shapes[i].toIso();
27312
+ }
27360
27313
  }
27361
27314
  }
27362
27315
 
@@ -29302,7 +29255,12 @@
29302
29255
  }
29303
29256
 
29304
29257
  if (typeof (settings.tint) !== "undefined") {
29305
- this.tint.setColor(settings.tint);
29258
+ if (settings.tint instanceof Color) {
29259
+ this.tint.copy(settings.tint);
29260
+ } else {
29261
+ // string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
29262
+ this.tint.parseCSS(settings.tint);
29263
+ }
29306
29264
  }
29307
29265
 
29308
29266
  // set the sprite name if specified
@@ -30829,8 +30787,6 @@
30829
30787
 
30830
30788
  /**
30831
30789
  * The WebGL version used by this renderer (1 or 2)
30832
- * @name WebGLVersion
30833
- * @memberof WebGLRenderer#
30834
30790
  * @type {number}
30835
30791
  * @default 1
30836
30792
  * @readonly
@@ -30839,8 +30795,6 @@
30839
30795
 
30840
30796
  /**
30841
30797
  * The vendor string of the underlying graphics driver.
30842
- * @name GPUVendor
30843
- * @memberof WebGLRenderer#
30844
30798
  * @type {string}
30845
30799
  * @default null
30846
30800
  * @readonly
@@ -30849,8 +30803,6 @@
30849
30803
 
30850
30804
  /**
30851
30805
  * The renderer string of the underlying graphics driver.
30852
- * @name GPURenderer
30853
- * @memberof WebGLRenderer#
30854
30806
  * @type {string}
30855
30807
  * @default null
30856
30808
  * @readonly
@@ -30860,15 +30812,12 @@
30860
30812
  /**
30861
30813
  * The WebGL context
30862
30814
  * @name gl
30863
- * @memberof WebGLRenderer
30864
30815
  * @type {WebGLRenderingContext}
30865
30816
  */
30866
30817
  this.context = this.gl = this.getContextGL(this.getCanvas(), options.transparent);
30867
30818
 
30868
30819
  /**
30869
30820
  * Maximum number of texture unit supported under the current context
30870
- * @name maxTextures
30871
- * @memberof WebGLRenderer#
30872
30821
  * @type {number}
30873
30822
  * @readonly
30874
30823
  */
@@ -30896,25 +30845,19 @@
30896
30845
 
30897
30846
  /**
30898
30847
  * The current transformation matrix used for transformations on the overall scene
30899
- * @name currentTransform
30900
30848
  * @type {Matrix2d}
30901
- * @memberof WebGLRenderer#
30902
30849
  */
30903
30850
  this.currentTransform = new Matrix2d();
30904
30851
 
30905
30852
  /**
30906
30853
  * The current compositor used by the renderer
30907
- * @name currentCompositor
30908
30854
  * @type {WebGLCompositor}
30909
- * @memberof WebGLRenderer#
30910
30855
  */
30911
30856
  this.currentCompositor = null;
30912
30857
 
30913
30858
  /**
30914
30859
  * The list of active compositors
30915
- * @name compositors
30916
30860
  * @type {Map<WebGLCompositor>}
30917
- * @memberof WebGLRenderer#
30918
30861
  */
30919
30862
  this.compositors = new Map();
30920
30863
 
@@ -30964,8 +30907,6 @@
30964
30907
 
30965
30908
  /**
30966
30909
  * Reset context state
30967
- * @name reset
30968
- * @memberof WebGLRenderer
30969
30910
  */
30970
30911
  WebGLRenderer.prototype.reset = function reset () {
30971
30912
  var this$1$1 = this;
@@ -30990,9 +30931,7 @@
30990
30931
 
30991
30932
  /**
30992
30933
  * set the active compositor for this renderer
30993
- * @name setCompositor
30994
30934
  * @param {WebGLCompositor|string} compositor a compositor name or instance
30995
- * @memberof WebGLRenderer
30996
30935
  */
30997
30936
  WebGLRenderer.prototype.setCompositor = function setCompositor (compositor) {
30998
30937
  if ( compositor === void 0 ) compositor = "default";
@@ -31018,8 +30957,6 @@
31018
30957
 
31019
30958
  /**
31020
30959
  * Reset the gl transform to identity
31021
- * @name resetTransform
31022
- * @memberof WebGLRenderer
31023
30960
  */
31024
30961
  WebGLRenderer.prototype.resetTransform = function resetTransform () {
31025
30962
  this.currentTransform.identity();
@@ -31064,8 +31001,6 @@
31064
31001
 
31065
31002
  /**
31066
31003
  * Create a pattern with the specified repetition
31067
- * @name createPattern
31068
- * @memberof WebGLRenderer
31069
31004
  * @param {Image} image Source image
31070
31005
  * @param {string} repeat Define how the pattern should be repeated
31071
31006
  * @returns {TextureAtlas}
@@ -31096,8 +31031,6 @@
31096
31031
 
31097
31032
  /**
31098
31033
  * Flush the compositor to the frame buffer
31099
- * @name flush
31100
- * @memberof WebGLRenderer
31101
31034
  */
31102
31035
  WebGLRenderer.prototype.flush = function flush () {
31103
31036
  this.currentCompositor.flush();
@@ -31105,8 +31038,6 @@
31105
31038
 
31106
31039
  /**
31107
31040
  * set/change the current projection matrix (WebGL only)
31108
- * @name setProjection
31109
- * @memberof WebGLRenderer
31110
31041
  * @param {Matrix3d} matrix
31111
31042
  */
31112
31043
  WebGLRenderer.prototype.setProjection = function setProjection (matrix) {
@@ -31114,10 +31045,15 @@
31114
31045
  this.currentCompositor.setProjection(matrix);
31115
31046
  };
31116
31047
 
31048
+ /**
31049
+ * prepare the framebuffer for drawing a new frame
31050
+ */
31051
+ WebGLRenderer.prototype.clear = function clear () {
31052
+ this.currentCompositor.clear(this.settings.transparent ? 0.0 : 1.0);
31053
+ };
31054
+
31117
31055
  /**
31118
31056
  * Clears the gl context with the given color.
31119
- * @name clearColor
31120
- * @memberof WebGLRenderer
31121
31057
  * @param {Color|string} [color="#000000"] CSS color.
31122
31058
  * @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
31123
31059
  */
@@ -31137,17 +31073,10 @@
31137
31073
  }
31138
31074
  // clear gl context with the specified color
31139
31075
  this.currentCompositor.clearColor(glArray[0], glArray[1], glArray[2], (opaque === true) ? 1.0 : glArray[3]);
31140
- this.currentCompositor.clear();
31141
-
31142
- // restore default clear Color black
31143
- this.currentCompositor.clearColor(0.0, 0.0, 0.0, 0.0);
31144
-
31145
31076
  };
31146
31077
 
31147
31078
  /**
31148
31079
  * Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
31149
- * @name clearRect
31150
- * @memberof WebGLRenderer
31151
31080
  * @param {number} x x axis of the coordinate for the rectangle starting point.
31152
31081
  * @param {number} y y axis of the coordinate for the rectangle starting point.
31153
31082
  * @param {number} width The rectangle's width.
@@ -31181,7 +31110,7 @@
31181
31110
  uvs[1],
31182
31111
  uvs[2],
31183
31112
  uvs[3],
31184
- this.currentTint.toUint32()
31113
+ this.currentTint.toUint32(this.getGlobalAlpha())
31185
31114
  );
31186
31115
 
31187
31116
  // Clear font context2D
@@ -31195,8 +31124,6 @@
31195
31124
 
31196
31125
  /**
31197
31126
  * Draw an image to the gl context
31198
- * @name drawImage
31199
- * @memberof WebGLRenderer
31200
31127
  * @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.
31201
31128
  * @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.
31202
31129
  * @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.
@@ -31242,13 +31169,11 @@
31242
31169
 
31243
31170
  var texture = this.cache.get(image);
31244
31171
  var uvs = texture.getUVs(sx + "," + sy + "," + sw + "," + sh);
31245
- this.currentCompositor.addQuad(texture, dx, dy, dw, dh, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32());
31172
+ this.currentCompositor.addQuad(texture, dx, dy, dw, dh, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32(this.getGlobalAlpha()));
31246
31173
  };
31247
31174
 
31248
31175
  /**
31249
31176
  * Draw a pattern within the given rectangle.
31250
- * @name drawPattern
31251
- * @memberof WebGLRenderer
31252
31177
  * @param {TextureAtlas} pattern Pattern object
31253
31178
  * @param {number} x
31254
31179
  * @param {number} y
@@ -31258,18 +31183,18 @@
31258
31183
  */
31259
31184
  WebGLRenderer.prototype.drawPattern = function drawPattern (pattern, x, y, width, height) {
31260
31185
  var uvs = pattern.getUVs("0,0," + width + "," + height);
31261
- this.currentCompositor.addQuad(pattern, x, y, width, height, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32());
31186
+ this.currentCompositor.addQuad(pattern, x, y, width, height, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32(this.getGlobalAlpha()));
31262
31187
  };
31263
31188
 
31264
31189
  /**
31265
- * Returns the WebGL Context object of the given Canvas
31266
- * @name getContextGL
31267
- * @memberof WebGLRenderer
31190
+ * Returns the WebGL Context object of the given canvas element
31268
31191
  * @param {HTMLCanvasElement} canvas
31269
- * @param {boolean} [transparent=true] use false to disable transparency
31192
+ * @param {boolean} [transparent=false] use true to enable transparency
31270
31193
  * @returns {WebGLRenderingContext}
31271
31194
  */
31272
31195
  WebGLRenderer.prototype.getContextGL = function getContextGL (canvas, transparent) {
31196
+ if ( transparent === void 0 ) transparent = false;
31197
+
31273
31198
  if (typeof canvas === "undefined" || canvas === null) {
31274
31199
  throw new Error(
31275
31200
  "You must pass a canvas element in order to create " +
@@ -31277,17 +31202,13 @@
31277
31202
  );
31278
31203
  }
31279
31204
 
31280
- if (typeof transparent !== "boolean") {
31281
- transparent = true;
31282
- }
31283
-
31284
31205
  var attr = {
31285
31206
  alpha : transparent,
31286
31207
  antialias : this.settings.antiAlias,
31287
31208
  depth : false,
31288
31209
  stencil: true,
31289
31210
  preserveDrawingBuffer : false,
31290
- premultipliedAlpha: transparent,
31211
+ premultipliedAlpha: transparent ? this.settings.premultipliedAlpha : false,
31291
31212
  powerPreference: this.settings.powerPreference,
31292
31213
  failIfMajorPerformanceCaveat : this.settings.failIfMajorPerformanceCaveat
31293
31214
  };
@@ -31320,8 +31241,6 @@
31320
31241
  /**
31321
31242
  * Returns the WebGLContext instance for the renderer
31322
31243
  * return a reference to the system 2d Context
31323
- * @name getContext
31324
- * @memberof WebGLRenderer
31325
31244
  * @returns {WebGLRenderingContext}
31326
31245
  */
31327
31246
  WebGLRenderer.prototype.getContext = function getContext () {
@@ -31339,9 +31258,7 @@
31339
31258
  * <img src="images/lighter-blendmode.png" width="510"/> <br>
31340
31259
  * - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
31341
31260
  * <img src="images/screen-blendmode.png" width="510"/> <br>
31342
- * @name setBlendMode
31343
31261
  * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
31344
- * @memberof WebGLRenderer
31345
31262
  * @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
31346
31263
  * @param {WebGLRenderingContext} [gl]
31347
31264
  */
@@ -31393,8 +31310,6 @@
31393
31310
 
31394
31311
  /**
31395
31312
  * restores the canvas context
31396
- * @name restore
31397
- * @memberof WebGLRenderer
31398
31313
  */
31399
31314
  WebGLRenderer.prototype.restore = function restore () {
31400
31315
  // do nothing if there is no saved states
@@ -31428,8 +31343,6 @@
31428
31343
 
31429
31344
  /**
31430
31345
  * saves the canvas context
31431
- * @name save
31432
- * @memberof WebGLRenderer
31433
31346
  */
31434
31347
  WebGLRenderer.prototype.save = function save () {
31435
31348
  this._colorStack.push(this.currentColor.clone());
@@ -31445,8 +31358,6 @@
31445
31358
 
31446
31359
  /**
31447
31360
  * rotates the uniform matrix
31448
- * @name rotate
31449
- * @memberof WebGLRenderer
31450
31361
  * @param {number} angle in radians
31451
31362
  */
31452
31363
  WebGLRenderer.prototype.rotate = function rotate (angle) {
@@ -31455,8 +31366,6 @@
31455
31366
 
31456
31367
  /**
31457
31368
  * scales the uniform matrix
31458
- * @name scale
31459
- * @memberof WebGLRenderer
31460
31369
  * @param {number} x
31461
31370
  * @param {number} y
31462
31371
  */
@@ -31475,8 +31384,6 @@
31475
31384
 
31476
31385
  /**
31477
31386
  * Set the global alpha
31478
- * @name setGlobalAlpha
31479
- * @memberof WebGLRenderer
31480
31387
  * @param {number} alpha 0.0 to 1.0 values accepted.
31481
31388
  */
31482
31389
  WebGLRenderer.prototype.setGlobalAlpha = function setGlobalAlpha (alpha) {
@@ -31485,8 +31392,6 @@
31485
31392
 
31486
31393
  /**
31487
31394
  * Return the global alpha
31488
- * @name getGlobalAlpha
31489
- * @memberof WebGLRenderer
31490
31395
  * @returns {number} global alpha value
31491
31396
  */
31492
31397
  WebGLRenderer.prototype.getGlobalAlpha = function getGlobalAlpha () {
@@ -31496,8 +31401,6 @@
31496
31401
  /**
31497
31402
  * Set the current fill & stroke style color.
31498
31403
  * By default, or upon reset, the value is set to #000000.
31499
- * @name setColor
31500
- * @memberof WebGLRenderer
31501
31404
  * @param {Color|string} color css color string.
31502
31405
  */
31503
31406
  WebGLRenderer.prototype.setColor = function setColor (color) {
@@ -31508,8 +31411,6 @@
31508
31411
 
31509
31412
  /**
31510
31413
  * Set the line width
31511
- * @name setLineWidth
31512
- * @memberof WebGLRenderer
31513
31414
  * @param {number} width Line width
31514
31415
  */
31515
31416
  WebGLRenderer.prototype.setLineWidth = function setLineWidth (width) {
@@ -31518,8 +31419,6 @@
31518
31419
 
31519
31420
  /**
31520
31421
  * Stroke an arc at the specified coordinates with given radius, start and end points
31521
- * @name strokeArc
31522
- * @memberof WebGLRenderer
31523
31422
  * @param {number} x arc center point x-axis
31524
31423
  * @param {number} y arc center point y-axis
31525
31424
  * @param {number} radius
@@ -31548,8 +31447,6 @@
31548
31447
 
31549
31448
  /**
31550
31449
  * Fill an arc at the specified coordinates with given radius, start and end points
31551
- * @name fillArc
31552
- * @memberof WebGLRenderer
31553
31450
  * @param {number} x arc center point x-axis
31554
31451
  * @param {number} y arc center point y-axis
31555
31452
  * @param {number} radius
@@ -31565,8 +31462,6 @@
31565
31462
 
31566
31463
  /**
31567
31464
  * Stroke an ellipse at the specified coordinates with given radius
31568
- * @name strokeEllipse
31569
- * @memberof WebGLRenderer
31570
31465
  * @param {number} x ellipse center point x-axis
31571
31466
  * @param {number} y ellipse center point y-axis
31572
31467
  * @param {number} w horizontal radius of the ellipse
@@ -31592,8 +31487,6 @@
31592
31487
 
31593
31488
  /**
31594
31489
  * Fill an ellipse at the specified coordinates with given radius
31595
- * @name fillEllipse
31596
- * @memberof WebGLRenderer
31597
31490
  * @param {number} x ellipse center point x-axis
31598
31491
  * @param {number} y ellipse center point y-axis
31599
31492
  * @param {number} w horizontal radius of the ellipse
@@ -31605,8 +31498,6 @@
31605
31498
 
31606
31499
  /**
31607
31500
  * Stroke a line of the given two points
31608
- * @name strokeLine
31609
- * @memberof WebGLRenderer
31610
31501
  * @param {number} startX the start x coordinate
31611
31502
  * @param {number} startY the start y coordinate
31612
31503
  * @param {number} endX the end x coordinate
@@ -31626,8 +31517,6 @@
31626
31517
 
31627
31518
  /**
31628
31519
  * Fill a line of the given two points
31629
- * @name fillLine
31630
- * @memberof WebGLRenderer
31631
31520
  * @param {number} startX the start x coordinate
31632
31521
  * @param {number} startY the start y coordinate
31633
31522
  * @param {number} endX the end x coordinate
@@ -31639,8 +31528,6 @@
31639
31528
 
31640
31529
  /**
31641
31530
  * Stroke a me.Polygon on the screen with a specified color
31642
- * @name strokePolygon
31643
- * @memberof WebGLRenderer
31644
31531
  * @param {Polygon} poly the shape to draw
31645
31532
  * @param {boolean} [fill=false] also fill the shape with the current color if true
31646
31533
  */
@@ -31672,8 +31559,6 @@
31672
31559
 
31673
31560
  /**
31674
31561
  * Fill a me.Polygon on the screen
31675
- * @name fillPolygon
31676
- * @memberof WebGLRenderer
31677
31562
  * @param {Polygon} poly the shape to draw
31678
31563
  */
31679
31564
  WebGLRenderer.prototype.fillPolygon = function fillPolygon (poly) {
@@ -31682,8 +31567,6 @@
31682
31567
 
31683
31568
  /**
31684
31569
  * Draw a stroke rectangle at the specified coordinates
31685
- * @name strokeRect
31686
- * @memberof WebGLRenderer
31687
31570
  * @param {number} x
31688
31571
  * @param {number} y
31689
31572
  * @param {number} width
@@ -31708,8 +31591,6 @@
31708
31591
 
31709
31592
  /**
31710
31593
  * Draw a filled rectangle at the specified coordinates
31711
- * @name fillRect
31712
- * @memberof WebGLRenderer
31713
31594
  * @param {number} x
31714
31595
  * @param {number} y
31715
31596
  * @param {number} width
@@ -31721,8 +31602,6 @@
31721
31602
 
31722
31603
  /**
31723
31604
  * Stroke a rounded rectangle at the specified coordinates
31724
- * @name strokeRoundRect
31725
- * @memberof WebGLRenderer
31726
31605
  * @param {number} x
31727
31606
  * @param {number} y
31728
31607
  * @param {number} width
@@ -31749,8 +31628,6 @@
31749
31628
 
31750
31629
  /**
31751
31630
  * Draw a rounded filled rectangle at the specified coordinates
31752
- * @name fillRoundRect
31753
- * @memberof WebGLRenderer
31754
31631
  * @param {number} x
31755
31632
  * @param {number} y
31756
31633
  * @param {number} width
@@ -31761,11 +31638,29 @@
31761
31638
  this.strokeRoundRect(x, y, width, height, radius, true);
31762
31639
  };
31763
31640
 
31641
+ /**
31642
+ * Stroke a Point at the specified coordinates
31643
+ * @param {number} x
31644
+ * @param {number} y
31645
+ */
31646
+ WebGLRenderer.prototype.strokePoint = function strokePoint (x, y) {
31647
+ this.strokeLine(x, y, x + 1, y + 1);
31648
+ };
31649
+
31650
+ /**
31651
+ * Draw a a point at the specified coordinates
31652
+ * @param {number} x
31653
+ * @param {number} y
31654
+ * @param {number} width
31655
+ * @param {number} height
31656
+ */
31657
+ WebGLRenderer.prototype.fillPoint = function fillPoint (x, y) {
31658
+ this.strokePoint(x, y);
31659
+ };
31660
+
31764
31661
  /**
31765
31662
  * Reset (overrides) the renderer transformation matrix to the
31766
31663
  * identity one, and then apply the given transformation matrix.
31767
- * @name setTransform
31768
- * @memberof WebGLRenderer
31769
31664
  * @param {Matrix2d} mat2d Matrix to transform by
31770
31665
  */
31771
31666
  WebGLRenderer.prototype.setTransform = function setTransform (mat2d) {
@@ -31775,8 +31670,6 @@
31775
31670
 
31776
31671
  /**
31777
31672
  * Multiply given matrix into the renderer tranformation matrix
31778
- * @name transform
31779
- * @memberof WebGLRenderer
31780
31673
  * @param {Matrix2d} mat2d Matrix to transform by
31781
31674
  */
31782
31675
  WebGLRenderer.prototype.transform = function transform (mat2d) {
@@ -31792,8 +31685,6 @@
31792
31685
 
31793
31686
  /**
31794
31687
  * Translates the uniform matrix by the given coordinates
31795
- * @name translate
31796
- * @memberof WebGLRenderer
31797
31688
  * @param {number} x
31798
31689
  * @param {number} y
31799
31690
  */
@@ -31814,8 +31705,6 @@
31814
31705
  * You can however save the current region using the save(),
31815
31706
  * and restore it (with the restore() method) any time in the future.
31816
31707
  * (<u>this is an experimental feature !</u>)
31817
- * @name clipRect
31818
- * @memberof WebGLRenderer
31819
31708
  * @param {number} x
31820
31709
  * @param {number} y
31821
31710
  * @param {number} width
@@ -31861,8 +31750,6 @@
31861
31750
  * A mask limits rendering elements to the shape and position of the given mask object.
31862
31751
  * So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
31863
31752
  * Mask are not preserved through renderer context save and restore.
31864
- * @name setMask
31865
- * @memberof WebGLRenderer
31866
31753
  * @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] a shape defining the mask to be applied
31867
31754
  * @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
31868
31755
  */
@@ -31878,8 +31765,6 @@
31878
31765
  // Enable and setup GL state to write to stencil buffer
31879
31766
  gl.enable(gl.STENCIL_TEST);
31880
31767
  gl.clear(gl.STENCIL_BUFFER_BIT);
31881
-
31882
-
31883
31768
  }
31884
31769
 
31885
31770
  this.maskLevel++;
@@ -31908,9 +31793,7 @@
31908
31793
 
31909
31794
  /**
31910
31795
  * disable (remove) the rendering mask set through setMask.
31911
- * @name clearMask
31912
31796
  * @see WebGLRenderer#setMask
31913
- * @memberof WebGLRenderer
31914
31797
  */
31915
31798
  WebGLRenderer.prototype.clearMask = function clearMask () {
31916
31799
  if (this.maskLevel > 0) {
@@ -31941,6 +31824,7 @@
31941
31824
  scale : 1.0,
31942
31825
  scaleMethod : "manual",
31943
31826
  transparent : false,
31827
+ premultipliedAlpha: true,
31944
31828
  blendMode : "normal",
31945
31829
  antiAlias : false,
31946
31830
  failIfMajorPerformanceCaveat : true,
@@ -33105,10 +32989,10 @@
33105
32989
  * this can be overridden by the plugin
33106
32990
  * @public
33107
32991
  * @type {string}
33108
- * @default "13.1.0"
32992
+ * @default "13.2.1"
33109
32993
  * @name plugin.Base#version
33110
32994
  */
33111
- this.version = "13.1.0";
32995
+ this.version = "13.2.1";
33112
32996
  };
33113
32997
 
33114
32998
  /**
@@ -34338,7 +34222,7 @@
34338
34222
  this.width = this.height = 0;
34339
34223
 
34340
34224
  for (var i = 0; i < strings.length; i++) {
34341
- this.width = Math.max(this.lineWidth(strings[i].trimRight(), context), this.width);
34225
+ this.width = Math.max(this.lineWidth(strings[i].trimEnd(), context), this.width);
34342
34226
  this.height += this.lineHeight();
34343
34227
  }
34344
34228
  this.width = Math.ceil(this.width);
@@ -34812,7 +34696,7 @@
34812
34696
  setContextStyle(context, this, stroke);
34813
34697
 
34814
34698
  for (var i = 0; i < text.length; i++) {
34815
- var string = text[i].trimRight();
34699
+ var string = text[i].trimEnd();
34816
34700
  // draw the string
34817
34701
  context[stroke ? "strokeText" : "fillText"](string, x, y);
34818
34702
  // add leading space
@@ -34930,12 +34814,7 @@
34930
34814
 
34931
34815
  // apply given fillstyle
34932
34816
  if (typeof settings.fillStyle !== "undefined") {
34933
- if (settings.fillStyle instanceof Color) {
34934
- this.fillStyle.setColor(settings.fillStyle);
34935
- } else {
34936
- // string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
34937
- this.fillStyle.parseCSS(settings.fillStyle);
34938
- }
34817
+ this.fillStyle = settings.fillStyle;
34939
34818
  }
34940
34819
 
34941
34820
  // update anchorPoint if provided
@@ -35016,7 +34895,12 @@
35016
34895
  return this.tint;
35017
34896
  };
35018
34897
  prototypeAccessors.fillStyle.set = function (value) {
35019
- this.tint = value;
34898
+ if (value instanceof Color) {
34899
+ this.tint.copy(value);
34900
+ } else {
34901
+ // string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
34902
+ this.tint.parseCSS(value);
34903
+ }
35020
34904
  };
35021
34905
 
35022
34906
  /**
@@ -35075,7 +34959,7 @@
35075
34959
 
35076
34960
  for (var i = 0; i < this._text.length; i++) {
35077
34961
  x = lX;
35078
- var string = this._text[i].trimRight();
34962
+ var string = this._text[i].trimEnd();
35079
34963
  // adjust x pos based on alignment value
35080
34964
  var stringWidth = this.metrics.lineWidth(string);
35081
34965
  switch (this.textAlign) {
@@ -37802,7 +37686,7 @@
37802
37686
  * @name version
37803
37687
  * @type {string}
37804
37688
  */
37805
- var version = "13.1.0";
37689
+ var version = "13.2.1";
37806
37690
 
37807
37691
 
37808
37692
  /**
@@ -37861,6 +37745,7 @@
37861
37745
  pool.register("me.RoundRect", RoundRect, true);
37862
37746
  pool.register("me.Polygon", Polygon, true);
37863
37747
  pool.register("me.Line", Line, true);
37748
+ pool.register("me.Point", Point, true);
37864
37749
  pool.register("me.Ellipse", Ellipse, true);
37865
37750
  pool.register("me.Bounds", Bounds, true);
37866
37751
 
@@ -37890,6 +37775,7 @@
37890
37775
  pool.register("RoundRect", RoundRect, true);
37891
37776
  pool.register("Polygon", Polygon, true);
37892
37777
  pool.register("Line", Line, true);
37778
+ pool.register("Point", Point, true);
37893
37779
  pool.register("Ellipse", Ellipse, true);
37894
37780
  pool.register("Bounds", Bounds, true);
37895
37781
  pool.register("CanvasTexture", CanvasTexture, true);
@@ -37943,6 +37829,7 @@
37943
37829
  exports.Particle = Particle;
37944
37830
  exports.ParticleEmitter = ParticleEmitter;
37945
37831
  exports.ParticleEmitterSettings = ParticleEmitterSettings;
37832
+ exports.Point = Point;
37946
37833
  exports.Pointer = Pointer;
37947
37834
  exports.Polygon = Polygon;
37948
37835
  exports.QuadTree = QuadTree;