melonjs 13.1.1 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/melonjs.js +327 -425
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +185 -387
- package/dist/melonjs.module.js +316 -430
- package/package.json +7 -7
- package/src/geometries/point.js +80 -0
- package/src/index.js +4 -0
- package/src/level/tiled/TMXObject.js +21 -9
- package/src/math/color.js +1 -1
- package/src/physics/body.js +10 -3
- package/src/physics/bounds.js +10 -9
- package/src/polyfill/index.js +2 -2
- 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 +31 -4
- package/src/video/renderer.js +8 -50
- package/src/video/video.js +1 -0
- package/src/video/webgl/glshader.js +0 -28
- package/src/video/webgl/webgl_compositor.js +19 -48
- package/src/video/webgl/webgl_renderer.js +36 -112
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v13.
|
|
2
|
+
* melonJS Game Engine - v13.3.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -122,12 +122,20 @@ var indexedObject = fails$6(function () {
|
|
|
122
122
|
return classof$2(it) == 'String' ? split(it, '') : $Object$3(it);
|
|
123
123
|
} : $Object$3;
|
|
124
124
|
|
|
125
|
+
// we can't use just `it == null` since of `document.all` special case
|
|
126
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
127
|
+
var isNullOrUndefined$2 = function (it) {
|
|
128
|
+
return it === null || it === undefined;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
var isNullOrUndefined$1 = isNullOrUndefined$2;
|
|
132
|
+
|
|
125
133
|
var $TypeError$5 = TypeError;
|
|
126
134
|
|
|
127
135
|
// `RequireObjectCoercible` abstract operation
|
|
128
136
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
129
137
|
var requireObjectCoercible$3 = function (it) {
|
|
130
|
-
if (it
|
|
138
|
+
if (isNullOrUndefined$1(it)) throw $TypeError$5("Can't call method on " + it);
|
|
131
139
|
return it;
|
|
132
140
|
};
|
|
133
141
|
|
|
@@ -147,7 +155,14 @@ var isCallable$b = function (argument) {
|
|
|
147
155
|
|
|
148
156
|
var isCallable$a = isCallable$b;
|
|
149
157
|
|
|
150
|
-
var
|
|
158
|
+
var documentAll = typeof document == 'object' && document.all;
|
|
159
|
+
|
|
160
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
161
|
+
var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
162
|
+
|
|
163
|
+
var isObject$5 = SPECIAL_DOCUMENT_ALL ? function (it) {
|
|
164
|
+
return typeof it == 'object' ? it !== null : isCallable$a(it) || it === documentAll;
|
|
165
|
+
} : function (it) {
|
|
151
166
|
return typeof it == 'object' ? it !== null : isCallable$a(it);
|
|
152
167
|
};
|
|
153
168
|
|
|
@@ -204,7 +219,7 @@ var V8_VERSION = engineV8Version;
|
|
|
204
219
|
var fails$5 = fails$9;
|
|
205
220
|
|
|
206
221
|
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
207
|
-
var
|
|
222
|
+
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
|
|
208
223
|
var symbol = Symbol();
|
|
209
224
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
210
225
|
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
@@ -215,7 +230,7 @@ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$5(function () {
|
|
|
215
230
|
|
|
216
231
|
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
217
232
|
|
|
218
|
-
var NATIVE_SYMBOL$1 =
|
|
233
|
+
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
219
234
|
|
|
220
235
|
var useSymbolAsUid = NATIVE_SYMBOL$1
|
|
221
236
|
&& !Symbol.sham
|
|
@@ -257,12 +272,13 @@ var aCallable$1 = function (argument) {
|
|
|
257
272
|
};
|
|
258
273
|
|
|
259
274
|
var aCallable = aCallable$1;
|
|
275
|
+
var isNullOrUndefined = isNullOrUndefined$2;
|
|
260
276
|
|
|
261
277
|
// `GetMethod` abstract operation
|
|
262
278
|
// https://tc39.es/ecma262/#sec-getmethod
|
|
263
279
|
var getMethod$1 = function (V, P) {
|
|
264
280
|
var func = V[P];
|
|
265
|
-
return func
|
|
281
|
+
return isNullOrUndefined(func) ? undefined : aCallable(func);
|
|
266
282
|
};
|
|
267
283
|
|
|
268
284
|
var call$2 = functionCall;
|
|
@@ -309,10 +325,10 @@ var store$2 = sharedStore;
|
|
|
309
325
|
(shared$3.exports = function (key, value) {
|
|
310
326
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
311
327
|
})('versions', []).push({
|
|
312
|
-
version: '3.
|
|
328
|
+
version: '3.25.0',
|
|
313
329
|
mode: 'global',
|
|
314
330
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
315
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
331
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.25.0/LICENSE',
|
|
316
332
|
source: 'https://github.com/zloirock/core-js'
|
|
317
333
|
});
|
|
318
334
|
|
|
@@ -352,7 +368,7 @@ var global$7 = global$c;
|
|
|
352
368
|
var shared$2 = shared$3.exports;
|
|
353
369
|
var hasOwn$6 = hasOwnProperty_1;
|
|
354
370
|
var uid$1 = uid$2;
|
|
355
|
-
var NATIVE_SYMBOL =
|
|
371
|
+
var NATIVE_SYMBOL = symbolConstructorDetection;
|
|
356
372
|
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
357
373
|
|
|
358
374
|
var WellKnownSymbolsStore = shared$2('wks');
|
|
@@ -569,15 +585,14 @@ if (!isCallable$5(store$1.inspectSource)) {
|
|
|
569
585
|
};
|
|
570
586
|
}
|
|
571
587
|
|
|
572
|
-
var inspectSource$
|
|
588
|
+
var inspectSource$1 = store$1.inspectSource;
|
|
573
589
|
|
|
574
590
|
var global$5 = global$c;
|
|
575
591
|
var isCallable$4 = isCallable$b;
|
|
576
|
-
var inspectSource$1 = inspectSource$2;
|
|
577
592
|
|
|
578
593
|
var WeakMap$1 = global$5.WeakMap;
|
|
579
594
|
|
|
580
|
-
var
|
|
595
|
+
var weakMapBasicDetection = isCallable$4(WeakMap$1) && /native code/.test(String(WeakMap$1));
|
|
581
596
|
|
|
582
597
|
var shared$1 = shared$3.exports;
|
|
583
598
|
var uid = uid$2;
|
|
@@ -590,7 +605,7 @@ var sharedKey$1 = function (key) {
|
|
|
590
605
|
|
|
591
606
|
var hiddenKeys$3 = {};
|
|
592
607
|
|
|
593
|
-
var NATIVE_WEAK_MAP =
|
|
608
|
+
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
594
609
|
var global$4 = global$c;
|
|
595
610
|
var uncurryThis$4 = functionUncurryThis;
|
|
596
611
|
var isObject = isObject$5;
|
|
@@ -624,7 +639,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
|
|
|
624
639
|
var wmhas = uncurryThis$4(store.has);
|
|
625
640
|
var wmset = uncurryThis$4(store.set);
|
|
626
641
|
set = function (it, metadata) {
|
|
627
|
-
if (wmhas(store, it)) throw
|
|
642
|
+
if (wmhas(store, it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
628
643
|
metadata.facade = it;
|
|
629
644
|
wmset(store, it, metadata);
|
|
630
645
|
return metadata;
|
|
@@ -639,7 +654,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
|
|
|
639
654
|
var STATE = sharedKey('state');
|
|
640
655
|
hiddenKeys$2[STATE] = true;
|
|
641
656
|
set = function (it, metadata) {
|
|
642
|
-
if (hasOwn$3(it, STATE)) throw
|
|
657
|
+
if (hasOwn$3(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
643
658
|
metadata.facade = it;
|
|
644
659
|
createNonEnumerableProperty$1(it, STATE, metadata);
|
|
645
660
|
return metadata;
|
|
@@ -665,7 +680,7 @@ var isCallable$3 = isCallable$b;
|
|
|
665
680
|
var hasOwn$2 = hasOwnProperty_1;
|
|
666
681
|
var DESCRIPTORS = descriptors;
|
|
667
682
|
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
668
|
-
var inspectSource = inspectSource$
|
|
683
|
+
var inspectSource = inspectSource$1;
|
|
669
684
|
var InternalStateModule = internalState;
|
|
670
685
|
|
|
671
686
|
var enforceInternalState = InternalStateModule.enforce;
|
|
@@ -2971,7 +2986,7 @@ class Color {
|
|
|
2971
2986
|
* @param {number} [alpha=1.0] alpha value [0.0 .. 1.0]
|
|
2972
2987
|
* @returns {number}
|
|
2973
2988
|
*/
|
|
2974
|
-
toUint32(alpha =
|
|
2989
|
+
toUint32(alpha = 1.0) {
|
|
2975
2990
|
var ur = this.r & 0xff;
|
|
2976
2991
|
var ug = this.g & 0xff;
|
|
2977
2992
|
var ub = this.b & 0xff;
|
|
@@ -6524,56 +6539,38 @@ class GLShader {
|
|
|
6524
6539
|
|
|
6525
6540
|
/**
|
|
6526
6541
|
* the active gl rendering context
|
|
6527
|
-
* @public
|
|
6528
6542
|
* @type {WebGLRenderingContext}
|
|
6529
|
-
* @name gl
|
|
6530
|
-
* @memberof GLShader
|
|
6531
6543
|
*/
|
|
6532
6544
|
this.gl = gl;
|
|
6533
6545
|
|
|
6534
6546
|
/**
|
|
6535
6547
|
* the vertex shader source code
|
|
6536
|
-
* @public
|
|
6537
6548
|
* @type {string}
|
|
6538
|
-
* @name vertex
|
|
6539
|
-
* @memberof GLShader
|
|
6540
6549
|
*/
|
|
6541
6550
|
this.vertex = setPrecision(minify(vertex), precision || getMaxShaderPrecision(this.gl));
|
|
6542
6551
|
|
|
6543
6552
|
/**
|
|
6544
6553
|
* the fragment shader source code
|
|
6545
|
-
* @public
|
|
6546
6554
|
* @type {string}
|
|
6547
|
-
* @name vertex
|
|
6548
|
-
* @memberof GLShader
|
|
6549
6555
|
*/
|
|
6550
6556
|
this.fragment = setPrecision(minify(fragment), precision || getMaxShaderPrecision(this.gl));
|
|
6551
6557
|
|
|
6552
6558
|
/**
|
|
6553
6559
|
* the location attributes of the shader
|
|
6554
|
-
* @public
|
|
6555
6560
|
* @type {GLint[]}
|
|
6556
|
-
* @name attributes
|
|
6557
|
-
* @memberof GLShader
|
|
6558
6561
|
*/
|
|
6559
6562
|
this.attributes = extractAttributes(this.gl, this);
|
|
6560
6563
|
|
|
6561
6564
|
|
|
6562
6565
|
/**
|
|
6563
6566
|
* a reference to the shader program (once compiled)
|
|
6564
|
-
* @public
|
|
6565
6567
|
* @type {WebGLProgram}
|
|
6566
|
-
* @name program
|
|
6567
|
-
* @memberof GLShader
|
|
6568
6568
|
*/
|
|
6569
6569
|
this.program = compileProgram(this.gl, this.vertex, this.fragment, this.attributes);
|
|
6570
6570
|
|
|
6571
6571
|
/**
|
|
6572
6572
|
* the uniforms of the shader
|
|
6573
|
-
* @public
|
|
6574
6573
|
* @type {object}
|
|
6575
|
-
* @name uniforms
|
|
6576
|
-
* @memberof GLShader
|
|
6577
6574
|
*/
|
|
6578
6575
|
this.uniforms = extractUniforms(this.gl, this);
|
|
6579
6576
|
|
|
@@ -6583,8 +6580,6 @@ class GLShader {
|
|
|
6583
6580
|
|
|
6584
6581
|
/**
|
|
6585
6582
|
* Installs this shader program as part of current rendering state
|
|
6586
|
-
* @name bind
|
|
6587
|
-
* @memberof GLShader
|
|
6588
6583
|
*/
|
|
6589
6584
|
bind() {
|
|
6590
6585
|
this.gl.useProgram(this.program);
|
|
@@ -6592,8 +6587,6 @@ class GLShader {
|
|
|
6592
6587
|
|
|
6593
6588
|
/**
|
|
6594
6589
|
* returns the location of an attribute variable in this shader program
|
|
6595
|
-
* @name getAttribLocation
|
|
6596
|
-
* @memberof GLShader
|
|
6597
6590
|
* @param {string} name the name of the attribute variable whose location to get.
|
|
6598
6591
|
* @returns {GLint} number indicating the location of the variable name if found. Returns -1 otherwise
|
|
6599
6592
|
*/
|
|
@@ -6608,8 +6601,6 @@ class GLShader {
|
|
|
6608
6601
|
|
|
6609
6602
|
/**
|
|
6610
6603
|
* Set the uniform to the given value
|
|
6611
|
-
* @name setUniform
|
|
6612
|
-
* @memberof GLShader
|
|
6613
6604
|
* @param {string} name the uniform name
|
|
6614
6605
|
* @param {object|Float32Array} value the value to assign to that uniform
|
|
6615
6606
|
* @example
|
|
@@ -6630,8 +6621,6 @@ class GLShader {
|
|
|
6630
6621
|
|
|
6631
6622
|
/**
|
|
6632
6623
|
* activate the given vertex attribute for this shader
|
|
6633
|
-
* @name setVertexAttributes
|
|
6634
|
-
* @memberof GLShader
|
|
6635
6624
|
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
6636
6625
|
* @param {object[]} attributes an array of vertex attributes
|
|
6637
6626
|
* @param {number} vertexByteSize the size of a single vertex in bytes
|
|
@@ -6653,8 +6642,6 @@ class GLShader {
|
|
|
6653
6642
|
|
|
6654
6643
|
/**
|
|
6655
6644
|
* destroy this shader objects resources (program, attributes, uniforms)
|
|
6656
|
-
* @name destroy
|
|
6657
|
-
* @memberof GLShader
|
|
6658
6645
|
*/
|
|
6659
6646
|
destroy() {
|
|
6660
6647
|
this.uniforms = null;
|
|
@@ -6856,44 +6843,37 @@ class WebGLCompositor {
|
|
|
6856
6843
|
|
|
6857
6844
|
/**
|
|
6858
6845
|
* a reference to the active WebGL shader
|
|
6859
|
-
* @name activeShader
|
|
6860
|
-
* @memberof WebGLCompositor
|
|
6861
6846
|
* @type {GLShader}
|
|
6862
6847
|
*/
|
|
6863
6848
|
this.activeShader = null;
|
|
6864
6849
|
|
|
6865
6850
|
/**
|
|
6866
6851
|
* primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
6867
|
-
* @
|
|
6868
|
-
* @see WebGLCompositor
|
|
6869
|
-
* @memberof WebGLCompositor
|
|
6852
|
+
* @type {number}
|
|
6870
6853
|
* @default gl.TRIANGLES
|
|
6871
6854
|
*/
|
|
6872
6855
|
this.mode = gl.TRIANGLES;
|
|
6873
6856
|
|
|
6874
6857
|
/**
|
|
6875
6858
|
* an array of vertex attribute properties
|
|
6876
|
-
* @name attributes
|
|
6877
6859
|
* @see WebGLCompositor.addAttribute
|
|
6878
|
-
* @
|
|
6860
|
+
* @type {Array}
|
|
6879
6861
|
*/
|
|
6880
6862
|
this.attributes = [];
|
|
6881
6863
|
|
|
6882
6864
|
/**
|
|
6883
6865
|
* the size of a single vertex in bytes
|
|
6884
6866
|
* (will automatically be calculated as attributes definitions are added)
|
|
6885
|
-
* @name vertexByteSize
|
|
6886
6867
|
* @see WebGLCompositor.addAttribute
|
|
6887
|
-
* @
|
|
6868
|
+
* @type {number}
|
|
6888
6869
|
*/
|
|
6889
6870
|
this.vertexByteSize = 0;
|
|
6890
6871
|
|
|
6891
6872
|
/**
|
|
6892
6873
|
* the size of a single vertex in floats
|
|
6893
6874
|
* (will automatically be calculated as attributes definitions are added)
|
|
6894
|
-
* @name vertexSize
|
|
6895
6875
|
* @see WebGLCompositor.addAttribute
|
|
6896
|
-
* @
|
|
6876
|
+
* @type {number}
|
|
6897
6877
|
*/
|
|
6898
6878
|
this.vertexSize = 0;
|
|
6899
6879
|
|
|
@@ -6954,8 +6934,6 @@ class WebGLCompositor {
|
|
|
6954
6934
|
|
|
6955
6935
|
/**
|
|
6956
6936
|
* add vertex attribute property definition to the compositor
|
|
6957
|
-
* @name addAttribute
|
|
6958
|
-
* @memberof WebGLCompositor
|
|
6959
6937
|
* @param {string} name name of the attribute in the vertex shader
|
|
6960
6938
|
* @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
|
|
6961
6939
|
* @param {GLenum} type data type of each component in the array
|
|
@@ -7001,8 +6979,6 @@ class WebGLCompositor {
|
|
|
7001
6979
|
|
|
7002
6980
|
/**
|
|
7003
6981
|
* Sets the viewport
|
|
7004
|
-
* @name setViewport
|
|
7005
|
-
* @memberof WebGLCompositor
|
|
7006
6982
|
* @param {number} x x position of viewport
|
|
7007
6983
|
* @param {number} y y position of viewport
|
|
7008
6984
|
* @param {number} w width of viewport
|
|
@@ -7014,8 +6990,6 @@ class WebGLCompositor {
|
|
|
7014
6990
|
|
|
7015
6991
|
/**
|
|
7016
6992
|
* Create a WebGL texture from an image
|
|
7017
|
-
* @name createTexture2D
|
|
7018
|
-
* @memberof WebGLCompositor
|
|
7019
6993
|
* @param {number} unit Destination texture unit
|
|
7020
6994
|
* @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
|
|
7021
6995
|
* @param {number} filter gl.LINEAR or gl.NEAREST
|
|
@@ -7058,8 +7032,6 @@ class WebGLCompositor {
|
|
|
7058
7032
|
|
|
7059
7033
|
/**
|
|
7060
7034
|
* delete the given WebGL texture
|
|
7061
|
-
* @name bindTexture2D
|
|
7062
|
-
* @memberof WebGLCompositor
|
|
7063
7035
|
* @param {WebGLTexture} [texture] a WebGL texture to delete
|
|
7064
7036
|
* @param {number} [unit] Texture unit to delete
|
|
7065
7037
|
*/
|
|
@@ -7070,8 +7042,6 @@ class WebGLCompositor {
|
|
|
7070
7042
|
|
|
7071
7043
|
/**
|
|
7072
7044
|
* returns the WebGL texture associated to the given texture unit
|
|
7073
|
-
* @name bindTexture2D
|
|
7074
|
-
* @memberof WebGLCompositor
|
|
7075
7045
|
* @param {number} unit Texture unit to which a texture is bound
|
|
7076
7046
|
* @returns {WebGLTexture} texture a WebGL texture
|
|
7077
7047
|
*/
|
|
@@ -7081,8 +7051,6 @@ class WebGLCompositor {
|
|
|
7081
7051
|
|
|
7082
7052
|
/**
|
|
7083
7053
|
* assign the given WebGL texture to the current batch
|
|
7084
|
-
* @name bindTexture2D
|
|
7085
|
-
* @memberof WebGLCompositor
|
|
7086
7054
|
* @param {WebGLTexture} texture a WebGL texture
|
|
7087
7055
|
* @param {number} unit Texture unit to which the given texture is bound
|
|
7088
7056
|
*/
|
|
@@ -7108,8 +7076,6 @@ class WebGLCompositor {
|
|
|
7108
7076
|
|
|
7109
7077
|
/**
|
|
7110
7078
|
* unbind the given WebGL texture, forcing it to be reuploaded
|
|
7111
|
-
* @name unbindTexture2D
|
|
7112
|
-
* @memberof WebGLCompositor
|
|
7113
7079
|
* @param {WebGLTexture} [texture] a WebGL texture
|
|
7114
7080
|
* @param {number} [unit] a WebGL texture
|
|
7115
7081
|
* @returns {number} unit the unit number that was associated with the given texture
|
|
@@ -7154,8 +7120,6 @@ class WebGLCompositor {
|
|
|
7154
7120
|
|
|
7155
7121
|
/**
|
|
7156
7122
|
* set/change the current projection matrix
|
|
7157
|
-
* @name setProjection
|
|
7158
|
-
* @memberof WebGLCompositor
|
|
7159
7123
|
* @param {Matrix3d} matrix
|
|
7160
7124
|
*/
|
|
7161
7125
|
setProjection(matrix) {
|
|
@@ -7164,9 +7128,7 @@ class WebGLCompositor {
|
|
|
7164
7128
|
|
|
7165
7129
|
/**
|
|
7166
7130
|
* Select the shader to use for compositing
|
|
7167
|
-
* @name useShader
|
|
7168
7131
|
* @see GLShader
|
|
7169
|
-
* @memberof WebGLCompositor
|
|
7170
7132
|
* @param {GLShader} shader a reference to a GLShader instance
|
|
7171
7133
|
*/
|
|
7172
7134
|
useShader(shader) {
|
|
@@ -7181,8 +7143,6 @@ class WebGLCompositor {
|
|
|
7181
7143
|
|
|
7182
7144
|
/**
|
|
7183
7145
|
* Add a textured quad
|
|
7184
|
-
* @name addQuad
|
|
7185
|
-
* @memberof WebGLCompositor
|
|
7186
7146
|
* @param {TextureAtlas} texture Source texture atlas
|
|
7187
7147
|
* @param {number} x Destination x-coordinate
|
|
7188
7148
|
* @param {number} y Destination y-coordinate
|
|
@@ -7238,7 +7198,6 @@ class WebGLCompositor {
|
|
|
7238
7198
|
/**
|
|
7239
7199
|
* Flush batched texture operations to the GPU
|
|
7240
7200
|
* @param {number} [mode=gl.TRIANGLES] the GL drawing mode
|
|
7241
|
-
* @memberof WebGLCompositor
|
|
7242
7201
|
*/
|
|
7243
7202
|
flush(mode = this.mode) {
|
|
7244
7203
|
var vertex = this.vertexBuffer;
|
|
@@ -7264,8 +7223,6 @@ class WebGLCompositor {
|
|
|
7264
7223
|
|
|
7265
7224
|
/**
|
|
7266
7225
|
* Draw an array of vertices
|
|
7267
|
-
* @name drawVertices
|
|
7268
|
-
* @memberof WebGLCompositor
|
|
7269
7226
|
* @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)
|
|
7270
7227
|
* @param {Vector2d[]} verts vertices
|
|
7271
7228
|
* @param {number} [vertexCount=verts.length] amount of points defined in the points array
|
|
@@ -7292,25 +7249,26 @@ class WebGLCompositor {
|
|
|
7292
7249
|
}
|
|
7293
7250
|
|
|
7294
7251
|
/**
|
|
7295
|
-
*
|
|
7296
|
-
* @
|
|
7297
|
-
* @memberof WebGLCompositor
|
|
7298
|
-
* @param {number} [r=0] - the red color value used when the color buffers are cleared
|
|
7299
|
-
* @param {number} [g=0] - the green color value used when the color buffers are cleared
|
|
7300
|
-
* @param {number} [b=0] - the blue color value used when the color buffers are cleared
|
|
7301
|
-
* @param {number} [a=0] - the alpha color value used when the color buffers are cleared
|
|
7252
|
+
* Clear the frame buffer
|
|
7253
|
+
* @param {number} [alpha = 0.0] - the alpha value used when clearing the framebuffer
|
|
7302
7254
|
*/
|
|
7303
|
-
|
|
7304
|
-
this.gl
|
|
7255
|
+
clear(alpha = 0) {
|
|
7256
|
+
var gl = this.gl;
|
|
7257
|
+
gl.clearColor(0, 0, 0, alpha);
|
|
7258
|
+
gl.clear(gl.COLOR_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
|
|
7305
7259
|
}
|
|
7306
7260
|
|
|
7307
7261
|
/**
|
|
7308
|
-
*
|
|
7309
|
-
* @
|
|
7310
|
-
* @
|
|
7262
|
+
* Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
|
|
7263
|
+
* @param {number} [r = 0] - the red color value used when the color buffers are cleared
|
|
7264
|
+
* @param {number} [g = 0] - the green color value used when the color buffers are cleared
|
|
7265
|
+
* @param {number} [b = 0] - the blue color value used when the color buffers are cleared
|
|
7266
|
+
* @param {number} [a = 0] - the alpha color value used when the color buffers are cleared
|
|
7311
7267
|
*/
|
|
7312
|
-
|
|
7313
|
-
|
|
7268
|
+
clearColor(r = 0, g = 0, b = 0, a = 0) {
|
|
7269
|
+
var gl = this.gl;
|
|
7270
|
+
gl.clearColor(r, g, b, a);
|
|
7271
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
7314
7272
|
}
|
|
7315
7273
|
}
|
|
7316
7274
|
|
|
@@ -9619,17 +9577,18 @@ class Bounds {
|
|
|
9619
9577
|
* add the given point to the bounds definition.
|
|
9620
9578
|
* @name addPoint
|
|
9621
9579
|
* @memberof Bounds
|
|
9622
|
-
* @param {Vector2d}
|
|
9623
|
-
* @param {Matrix2d} [m] an optional transform to apply to the given point
|
|
9580
|
+
* @param {Vector2d|Point} point the point to be added to the bounds
|
|
9581
|
+
* @param {Matrix2d} [m] an optional transform to apply to the given point (only if the given point is a vector)
|
|
9624
9582
|
*/
|
|
9625
|
-
addPoint(
|
|
9626
|
-
if (typeof m !== "undefined") {
|
|
9627
|
-
|
|
9583
|
+
addPoint(point, m) {
|
|
9584
|
+
if ((typeof m !== "undefined") && (typeof point.rotate === "function")) {
|
|
9585
|
+
// only Vectors object have a rotate function
|
|
9586
|
+
point = m.apply(point);
|
|
9628
9587
|
}
|
|
9629
|
-
this.min.x = Math.min(this.min.x,
|
|
9630
|
-
this.max.x = Math.max(this.max.x,
|
|
9631
|
-
this.min.y = Math.min(this.min.y,
|
|
9632
|
-
this.max.y = Math.max(this.max.y,
|
|
9588
|
+
this.min.x = Math.min(this.min.x, point.x);
|
|
9589
|
+
this.max.x = Math.max(this.max.x, point.x);
|
|
9590
|
+
this.min.y = Math.min(this.min.y, point.y);
|
|
9591
|
+
this.max.y = Math.max(this.max.y, point.y);
|
|
9633
9592
|
}
|
|
9634
9593
|
|
|
9635
9594
|
/**
|
|
@@ -10118,6 +10077,86 @@ class Path2D {
|
|
|
10118
10077
|
}
|
|
10119
10078
|
}
|
|
10120
10079
|
|
|
10080
|
+
/**
|
|
10081
|
+
* @classdesc
|
|
10082
|
+
* represents a point in a 2d space
|
|
10083
|
+
*/
|
|
10084
|
+
class Point {
|
|
10085
|
+
constructor(x = 0, y = 0) {
|
|
10086
|
+
/**
|
|
10087
|
+
* the position of the point on the horizontal axis
|
|
10088
|
+
* @public
|
|
10089
|
+
* @type {Number}
|
|
10090
|
+
* @default 0
|
|
10091
|
+
*/
|
|
10092
|
+
this.x = x;
|
|
10093
|
+
|
|
10094
|
+
/**
|
|
10095
|
+
* the position of the point on the vertical axis
|
|
10096
|
+
* @public
|
|
10097
|
+
* @type {Number}
|
|
10098
|
+
* @default 0
|
|
10099
|
+
*/
|
|
10100
|
+
this.y = y;
|
|
10101
|
+
}
|
|
10102
|
+
|
|
10103
|
+
/** @ignore */
|
|
10104
|
+
onResetEvent(x = 0, y = 0) {
|
|
10105
|
+
this.set(x, y);
|
|
10106
|
+
}
|
|
10107
|
+
|
|
10108
|
+
/**
|
|
10109
|
+
* set the Point x and y properties to the given values
|
|
10110
|
+
* @param {number} x
|
|
10111
|
+
* @param {number} y
|
|
10112
|
+
* @returns {Point} Reference to this object for method chaining
|
|
10113
|
+
*/
|
|
10114
|
+
set(x = 0, y = 0) {
|
|
10115
|
+
this.x = x;
|
|
10116
|
+
this.y = y;
|
|
10117
|
+
return this;
|
|
10118
|
+
}
|
|
10119
|
+
|
|
10120
|
+
/**
|
|
10121
|
+
* return true if the two points are the same
|
|
10122
|
+
* @name equals
|
|
10123
|
+
* @memberof Point
|
|
10124
|
+
* @method
|
|
10125
|
+
* @param {Point} point
|
|
10126
|
+
* @returns {boolean}
|
|
10127
|
+
*/
|
|
10128
|
+
/**
|
|
10129
|
+
* return true if this point is equal to the given values
|
|
10130
|
+
* @name equals
|
|
10131
|
+
* @memberof Point
|
|
10132
|
+
* @param {number} x
|
|
10133
|
+
* @param {number} y
|
|
10134
|
+
* @returns {boolean}
|
|
10135
|
+
*/
|
|
10136
|
+
equals() {
|
|
10137
|
+
var _x, _y;
|
|
10138
|
+
if (arguments.length === 2) {
|
|
10139
|
+
// x, y
|
|
10140
|
+
_x = arguments[0];
|
|
10141
|
+
_y = arguments[1];
|
|
10142
|
+
} else {
|
|
10143
|
+
// point
|
|
10144
|
+
_x = arguments[0].x;
|
|
10145
|
+
_y = arguments[0].y;
|
|
10146
|
+
}
|
|
10147
|
+
return ((this.x === _x) && (this.y === _y));
|
|
10148
|
+
}
|
|
10149
|
+
|
|
10150
|
+
/**
|
|
10151
|
+
* clone this Point
|
|
10152
|
+
* @name clone
|
|
10153
|
+
* @returns {Point} new Point
|
|
10154
|
+
*/
|
|
10155
|
+
clone() {
|
|
10156
|
+
return new Point(this.x, this.y);
|
|
10157
|
+
}
|
|
10158
|
+
}
|
|
10159
|
+
|
|
10121
10160
|
/**
|
|
10122
10161
|
* @classdesc
|
|
10123
10162
|
* a base renderer object
|
|
@@ -10130,7 +10169,8 @@ class Renderer {
|
|
|
10130
10169
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
10131
10170
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing, use false (default) for a pixelated effect.
|
|
10132
10171
|
* @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.
|
|
10133
|
-
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
10172
|
+
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
10173
|
+
* @param {boolean} [options.premultipliedAlpha=true] in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
10134
10174
|
* @param {boolean} [options.blendMode="normal"] the default blend mode to use ("normal", "multiply")
|
|
10135
10175
|
* @param {boolean} [options.subPixel=false] Whether to enable subpixel rendering (performance hit when enabled)
|
|
10136
10176
|
* @param {boolean} [options.verbose=false] Enable the verbose mode that provides additional details as to what the renderer is doing
|
|
@@ -10141,26 +10181,20 @@ class Renderer {
|
|
|
10141
10181
|
/**
|
|
10142
10182
|
* The given constructor options
|
|
10143
10183
|
* @public
|
|
10144
|
-
* @name settings
|
|
10145
|
-
* @memberof Renderer#
|
|
10146
10184
|
* @type {object}
|
|
10147
10185
|
*/
|
|
10148
10186
|
this.settings = options;
|
|
10149
10187
|
|
|
10150
10188
|
/**
|
|
10151
10189
|
* true if the current rendering context is valid
|
|
10152
|
-
* @name isContextValid
|
|
10153
|
-
* @memberof Renderer#
|
|
10154
10190
|
* @default true
|
|
10155
|
-
* type {boolean}
|
|
10191
|
+
* @type {boolean}
|
|
10156
10192
|
*/
|
|
10157
10193
|
this.isContextValid = true;
|
|
10158
10194
|
|
|
10159
10195
|
/**
|
|
10160
10196
|
* The Path2D instance used by the renderer to draw primitives
|
|
10161
|
-
* @name path2D
|
|
10162
10197
|
* @type {Path2D}
|
|
10163
|
-
* @memberof Renderer#
|
|
10164
10198
|
*/
|
|
10165
10199
|
this.path2D = new Path2D();
|
|
10166
10200
|
|
|
@@ -10212,22 +10246,16 @@ class Renderer {
|
|
|
10212
10246
|
|
|
10213
10247
|
/**
|
|
10214
10248
|
* prepare the framebuffer for drawing a new frame
|
|
10215
|
-
* @name clear
|
|
10216
|
-
* @memberof Renderer
|
|
10217
10249
|
*/
|
|
10218
10250
|
clear() {}
|
|
10219
10251
|
|
|
10220
10252
|
/**
|
|
10221
10253
|
* render the main framebuffer on screen
|
|
10222
|
-
* @name flush
|
|
10223
|
-
* @memberof Renderer
|
|
10224
10254
|
*/
|
|
10225
10255
|
flush() {}
|
|
10226
10256
|
|
|
10227
10257
|
/**
|
|
10228
10258
|
* Reset context state
|
|
10229
|
-
* @name reset
|
|
10230
|
-
* @memberof Renderer
|
|
10231
10259
|
*/
|
|
10232
10260
|
reset() {
|
|
10233
10261
|
this.resetTransform();
|
|
@@ -10244,8 +10272,6 @@ class Renderer {
|
|
|
10244
10272
|
|
|
10245
10273
|
/**
|
|
10246
10274
|
* return a reference to the canvas which this renderer draws to
|
|
10247
|
-
* @name getCanvas
|
|
10248
|
-
* @memberof Renderer
|
|
10249
10275
|
* @returns {HTMLCanvasElement}
|
|
10250
10276
|
*/
|
|
10251
10277
|
getCanvas() {
|
|
@@ -10255,8 +10281,6 @@ class Renderer {
|
|
|
10255
10281
|
|
|
10256
10282
|
/**
|
|
10257
10283
|
* return a reference to this renderer canvas corresponding Context
|
|
10258
|
-
* @name getContext
|
|
10259
|
-
* @memberof Renderer
|
|
10260
10284
|
* @returns {CanvasRenderingContext2D|WebGLRenderingContext}
|
|
10261
10285
|
*/
|
|
10262
10286
|
getContext() {
|
|
@@ -10265,8 +10289,6 @@ class Renderer {
|
|
|
10265
10289
|
|
|
10266
10290
|
/**
|
|
10267
10291
|
* returns the current blend mode for this renderer
|
|
10268
|
-
* @name getBlendMode
|
|
10269
|
-
* @memberof Renderer
|
|
10270
10292
|
* @returns {string} blend mode
|
|
10271
10293
|
*/
|
|
10272
10294
|
getBlendMode() {
|
|
@@ -10276,8 +10298,6 @@ class Renderer {
|
|
|
10276
10298
|
/**
|
|
10277
10299
|
* Returns the 2D Context object of the given Canvas<br>
|
|
10278
10300
|
* Also configures anti-aliasing and blend modes based on constructor options.
|
|
10279
|
-
* @name getContext2d
|
|
10280
|
-
* @memberof Renderer
|
|
10281
10301
|
* @param {HTMLCanvasElement} canvas
|
|
10282
10302
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
10283
10303
|
* @returns {CanvasRenderingContext2D}
|
|
@@ -10313,8 +10333,6 @@ class Renderer {
|
|
|
10313
10333
|
|
|
10314
10334
|
/**
|
|
10315
10335
|
* return the width of the system Canvas
|
|
10316
|
-
* @name getWidth
|
|
10317
|
-
* @memberof Renderer
|
|
10318
10336
|
* @returns {number}
|
|
10319
10337
|
*/
|
|
10320
10338
|
getWidth() {
|
|
@@ -10323,8 +10341,6 @@ class Renderer {
|
|
|
10323
10341
|
|
|
10324
10342
|
/**
|
|
10325
10343
|
* return the height of the system Canvas
|
|
10326
|
-
* @name getHeight
|
|
10327
|
-
* @memberof Renderer
|
|
10328
10344
|
* @returns {number} height of the system Canvas
|
|
10329
10345
|
*/
|
|
10330
10346
|
getHeight() {
|
|
@@ -10333,8 +10349,6 @@ class Renderer {
|
|
|
10333
10349
|
|
|
10334
10350
|
/**
|
|
10335
10351
|
* get the current fill & stroke style color.
|
|
10336
|
-
* @name getColor
|
|
10337
|
-
* @memberof Renderer
|
|
10338
10352
|
* @returns {Color} current global color
|
|
10339
10353
|
*/
|
|
10340
10354
|
getColor() {
|
|
@@ -10343,8 +10357,6 @@ class Renderer {
|
|
|
10343
10357
|
|
|
10344
10358
|
/**
|
|
10345
10359
|
* return the current global alpha
|
|
10346
|
-
* @name globalAlpha
|
|
10347
|
-
* @memberof Renderer
|
|
10348
10360
|
* @returns {number}
|
|
10349
10361
|
*/
|
|
10350
10362
|
globalAlpha() {
|
|
@@ -10353,8 +10365,6 @@ class Renderer {
|
|
|
10353
10365
|
|
|
10354
10366
|
/**
|
|
10355
10367
|
* check if the given rect or bounds overlaps with the renderer screen coordinates
|
|
10356
|
-
* @name overlaps
|
|
10357
|
-
* @memberof Renderer
|
|
10358
10368
|
* @param {Rect|Bounds} bounds
|
|
10359
10369
|
* @returns {boolean} true if overlaps
|
|
10360
10370
|
*/
|
|
@@ -10368,8 +10378,6 @@ class Renderer {
|
|
|
10368
10378
|
|
|
10369
10379
|
/**
|
|
10370
10380
|
* resizes the system canvas
|
|
10371
|
-
* @name resize
|
|
10372
|
-
* @memberof Renderer
|
|
10373
10381
|
* @param {number} width new width of the canvas
|
|
10374
10382
|
* @param {number} height new height of the canvas
|
|
10375
10383
|
*/
|
|
@@ -10389,8 +10397,6 @@ class Renderer {
|
|
|
10389
10397
|
|
|
10390
10398
|
/**
|
|
10391
10399
|
* enable/disable image smoothing (scaling interpolation) for the given context
|
|
10392
|
-
* @name setAntiAlias
|
|
10393
|
-
* @memberof Renderer
|
|
10394
10400
|
* @param {CanvasRenderingContext2D} context
|
|
10395
10401
|
* @param {boolean} [enable=false]
|
|
10396
10402
|
*/
|
|
@@ -10418,8 +10424,6 @@ class Renderer {
|
|
|
10418
10424
|
|
|
10419
10425
|
/**
|
|
10420
10426
|
* set/change the current projection matrix (WebGL only)
|
|
10421
|
-
* @name setProjection
|
|
10422
|
-
* @memberof Renderer
|
|
10423
10427
|
* @param {Matrix3d} matrix
|
|
10424
10428
|
*/
|
|
10425
10429
|
setProjection(matrix) {
|
|
@@ -10428,8 +10432,6 @@ class Renderer {
|
|
|
10428
10432
|
|
|
10429
10433
|
/**
|
|
10430
10434
|
* stroke the given shape
|
|
10431
|
-
* @name stroke
|
|
10432
|
-
* @memberof Renderer
|
|
10433
10435
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
10434
10436
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
10435
10437
|
*/
|
|
@@ -10456,6 +10458,10 @@ class Renderer {
|
|
|
10456
10458
|
);
|
|
10457
10459
|
return;
|
|
10458
10460
|
}
|
|
10461
|
+
if (shape instanceof Point) {
|
|
10462
|
+
this.strokePoint(shape.x, shape.y);
|
|
10463
|
+
return;
|
|
10464
|
+
}
|
|
10459
10465
|
throw new Error("Invalid geometry for fill/stroke");
|
|
10460
10466
|
}
|
|
10461
10467
|
|
|
@@ -10471,8 +10477,6 @@ class Renderer {
|
|
|
10471
10477
|
|
|
10472
10478
|
/**
|
|
10473
10479
|
* tint the given image or canvas using the given color
|
|
10474
|
-
* @name tint
|
|
10475
|
-
* @memberof Renderer
|
|
10476
10480
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
|
|
10477
10481
|
* @param {Color|string} color the color that will be used to tint the image
|
|
10478
10482
|
* @param {string} [mode="multiply"] the composition mode used to tint the image
|
|
@@ -10501,8 +10505,6 @@ class Renderer {
|
|
|
10501
10505
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
10502
10506
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
10503
10507
|
* Mask are not preserved through renderer context save and restore.
|
|
10504
|
-
* @name setMask
|
|
10505
|
-
* @memberof Renderer
|
|
10506
10508
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
10507
10509
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
10508
10510
|
*/
|
|
@@ -10511,16 +10513,12 @@ class Renderer {
|
|
|
10511
10513
|
|
|
10512
10514
|
/**
|
|
10513
10515
|
* disable (remove) the rendering mask set through setMask.
|
|
10514
|
-
* @name clearMask
|
|
10515
10516
|
* @see Renderer#setMask
|
|
10516
|
-
* @memberof Renderer
|
|
10517
10517
|
*/
|
|
10518
10518
|
clearMask() {}
|
|
10519
10519
|
|
|
10520
10520
|
/**
|
|
10521
10521
|
* set a coloring tint for sprite based renderables
|
|
10522
|
-
* @name setTint
|
|
10523
|
-
* @memberof Renderer
|
|
10524
10522
|
* @param {Color} tint the tint color
|
|
10525
10523
|
* @param {number} [alpha] an alpha value to be applied to the tint
|
|
10526
10524
|
*/
|
|
@@ -10532,9 +10530,7 @@ class Renderer {
|
|
|
10532
10530
|
|
|
10533
10531
|
/**
|
|
10534
10532
|
* clear the rendering tint set through setTint.
|
|
10535
|
-
* @name clearTint
|
|
10536
10533
|
* @see Renderer#setTint
|
|
10537
|
-
* @memberof Renderer
|
|
10538
10534
|
*/
|
|
10539
10535
|
clearTint() {
|
|
10540
10536
|
// reset to default
|
|
@@ -18045,21 +18041,14 @@ class Renderable extends Rect {
|
|
|
18045
18041
|
|
|
18046
18042
|
/**
|
|
18047
18043
|
* If true then physic collision and input events will not impact this renderable
|
|
18048
|
-
* @public
|
|
18049
18044
|
* @type {boolean}
|
|
18050
18045
|
* @default true
|
|
18051
|
-
* @name isKinematic
|
|
18052
|
-
* @memberof Renderable
|
|
18053
18046
|
*/
|
|
18054
18047
|
this.isKinematic = true;
|
|
18055
18048
|
|
|
18056
18049
|
/**
|
|
18057
18050
|
* the renderable physic body
|
|
18058
|
-
* @public
|
|
18059
18051
|
* @type {Body}
|
|
18060
|
-
* @see Body
|
|
18061
|
-
* @name body
|
|
18062
|
-
* @memberof Renderable#
|
|
18063
18052
|
* @example
|
|
18064
18053
|
* // define a new Player Class
|
|
18065
18054
|
* class PlayerEntity extends me.Sprite {
|
|
@@ -18097,10 +18086,7 @@ class Renderable extends Rect {
|
|
|
18097
18086
|
if (typeof this.currentTransform === "undefined") {
|
|
18098
18087
|
/**
|
|
18099
18088
|
* the renderable default transformation matrix
|
|
18100
|
-
* @public
|
|
18101
18089
|
* @type {Matrix2d}
|
|
18102
|
-
* @name currentTransform
|
|
18103
|
-
* @memberof Renderable#
|
|
18104
18090
|
*/
|
|
18105
18091
|
this.currentTransform = pool.pull("Matrix2d");
|
|
18106
18092
|
}
|
|
@@ -18110,20 +18096,14 @@ class Renderable extends Rect {
|
|
|
18110
18096
|
* (G)ame (U)nique (Id)entifier" <br>
|
|
18111
18097
|
* a GUID will be allocated for any renderable object added <br>
|
|
18112
18098
|
* to an object container (including the `me.game.world` container)
|
|
18113
|
-
* @public
|
|
18114
18099
|
* @type {string}
|
|
18115
|
-
* @name GUID
|
|
18116
|
-
* @memberof Renderable
|
|
18117
18100
|
*/
|
|
18118
18101
|
this.GUID = undefined;
|
|
18119
18102
|
|
|
18120
18103
|
/**
|
|
18121
18104
|
* an event handler that is called when the renderable leave or enter a camera viewport
|
|
18122
|
-
* @public
|
|
18123
18105
|
* @type {Function}
|
|
18124
18106
|
* @default undefined
|
|
18125
|
-
* @name onVisibilityChange
|
|
18126
|
-
* @memberof Renderable#
|
|
18127
18107
|
* @example
|
|
18128
18108
|
* this.onVisibilityChange = function(inViewport) {
|
|
18129
18109
|
* if (inViewport === true) {
|
|
@@ -18135,42 +18115,30 @@ class Renderable extends Rect {
|
|
|
18135
18115
|
|
|
18136
18116
|
/**
|
|
18137
18117
|
* Whether the renderable object will always update, even when outside of the viewport<br>
|
|
18138
|
-
* @public
|
|
18139
18118
|
* @type {boolean}
|
|
18140
18119
|
* @default false
|
|
18141
|
-
* @name alwaysUpdate
|
|
18142
|
-
* @memberof Renderable
|
|
18143
18120
|
*/
|
|
18144
18121
|
this.alwaysUpdate = false;
|
|
18145
18122
|
|
|
18146
18123
|
/**
|
|
18147
18124
|
* Whether to update this object when the game is paused.
|
|
18148
|
-
* @public
|
|
18149
18125
|
* @type {boolean}
|
|
18150
18126
|
* @default false
|
|
18151
|
-
* @name updateWhenPaused
|
|
18152
|
-
* @memberof Renderable
|
|
18153
18127
|
*/
|
|
18154
18128
|
this.updateWhenPaused = false;
|
|
18155
18129
|
|
|
18156
18130
|
/**
|
|
18157
18131
|
* make the renderable object persistent over level changes<br>
|
|
18158
|
-
* @public
|
|
18159
18132
|
* @type {boolean}
|
|
18160
18133
|
* @default false
|
|
18161
|
-
* @name isPersistent
|
|
18162
|
-
* @memberof Renderable
|
|
18163
18134
|
*/
|
|
18164
18135
|
this.isPersistent = false;
|
|
18165
18136
|
|
|
18166
18137
|
/**
|
|
18167
18138
|
* If true, this renderable will be rendered using screen coordinates,
|
|
18168
18139
|
* as opposed to world coordinates. Use this, for example, to define UI elements.
|
|
18169
|
-
* @public
|
|
18170
18140
|
* @type {boolean}
|
|
18171
18141
|
* @default false
|
|
18172
|
-
* @name floating
|
|
18173
|
-
* @memberof Renderable
|
|
18174
18142
|
*/
|
|
18175
18143
|
this.floating = false;
|
|
18176
18144
|
|
|
@@ -18185,11 +18153,8 @@ class Renderable extends Rect {
|
|
|
18185
18153
|
* <br>
|
|
18186
18154
|
* <i><b>Note:</b> Object created through Tiled will have their anchorPoint set to (0, 0) to match Tiled Level editor implementation.
|
|
18187
18155
|
* To specify a value through Tiled, use a json expression like `json:{"x":0.5,"y":0.5}`. </i>
|
|
18188
|
-
* @public
|
|
18189
18156
|
* @type {ObservableVector2d}
|
|
18190
18157
|
* @default <0.5,0.5>
|
|
18191
|
-
* @name anchorPoint
|
|
18192
|
-
* @memberof Renderable#
|
|
18193
18158
|
*/
|
|
18194
18159
|
this.anchorPoint = pool.pull("ObservableVector2d", 0.5, 0.5, { onUpdate: this.onAnchorUpdate, scope: this });
|
|
18195
18160
|
}
|
|
@@ -18197,11 +18162,8 @@ class Renderable extends Rect {
|
|
|
18197
18162
|
/**
|
|
18198
18163
|
* When enabled, an object container will automatically apply
|
|
18199
18164
|
* any defined transformation before calling the child draw method.
|
|
18200
|
-
* @public
|
|
18201
18165
|
* @type {boolean}
|
|
18202
18166
|
* @default true
|
|
18203
|
-
* @name autoTransform
|
|
18204
|
-
* @memberof Renderable
|
|
18205
18167
|
* @example
|
|
18206
18168
|
* // enable "automatic" transformation when the object is activated
|
|
18207
18169
|
* onActivateEvent: function () {
|
|
@@ -18221,30 +18183,23 @@ class Renderable extends Rect {
|
|
|
18221
18183
|
* Set to zero if you do not wish an object to be drawn
|
|
18222
18184
|
* @see Renderable#setOpacity
|
|
18223
18185
|
* @see Renderable#getOpacity
|
|
18224
|
-
* @public
|
|
18225
18186
|
* @type {number}
|
|
18226
18187
|
* @default 1.0
|
|
18227
|
-
* @name Renderable#alpha
|
|
18228
18188
|
*/
|
|
18229
18189
|
this.alpha = 1.0;
|
|
18230
18190
|
|
|
18231
18191
|
/**
|
|
18232
18192
|
* a reference to the parent object that contains this renderable
|
|
18233
|
-
* @public
|
|
18234
18193
|
* @type {Container|Entity}
|
|
18235
18194
|
* @default undefined
|
|
18236
|
-
* @name Renderable#ancestor
|
|
18237
18195
|
*/
|
|
18238
18196
|
this.ancestor = undefined;
|
|
18239
18197
|
|
|
18240
18198
|
/**
|
|
18241
18199
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
18242
18200
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
18243
|
-
* @public
|
|
18244
18201
|
* @type {Rect|RoundRect|Polygon|Line|Ellipse}
|
|
18245
|
-
* @name mask
|
|
18246
18202
|
* @default undefined
|
|
18247
|
-
* @memberof Renderable#
|
|
18248
18203
|
* @example
|
|
18249
18204
|
* // apply a mask in the shape of a Star
|
|
18250
18205
|
* myNPCSprite.mask = new me.Polygon(myNPCSprite.width / 2, 0, [
|
|
@@ -18263,40 +18218,19 @@ class Renderable extends Rect {
|
|
|
18263
18218
|
*/
|
|
18264
18219
|
this.mask = undefined;
|
|
18265
18220
|
|
|
18266
|
-
/**
|
|
18267
|
-
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
18268
|
-
* @public
|
|
18269
|
-
* @type {Color}
|
|
18270
|
-
* @name tint
|
|
18271
|
-
* @default (255, 255, 255)
|
|
18272
|
-
* @memberof Renderable#
|
|
18273
|
-
* @example
|
|
18274
|
-
* // add a red tint to this renderable
|
|
18275
|
-
* this.tint.setColor(255, 128, 128);
|
|
18276
|
-
* // remove the tint
|
|
18277
|
-
* this.tint.setColor(255, 255, 255);
|
|
18278
|
-
*/
|
|
18279
|
-
this.tint = pool.pull("Color", 255, 255, 255, 1.0);
|
|
18280
|
-
|
|
18281
18221
|
/**
|
|
18282
18222
|
* the blend mode to be applied to this renderable (see renderer setBlendMode for available blend mode)
|
|
18283
|
-
* @public
|
|
18284
18223
|
* @type {string}
|
|
18285
|
-
* @name blendMode
|
|
18286
18224
|
* @default "normal"
|
|
18287
18225
|
* @see CanvasRenderer#setBlendMode
|
|
18288
18226
|
* @see WebGLRenderer#setBlendMode
|
|
18289
|
-
* @memberof Renderable#
|
|
18290
18227
|
*/
|
|
18291
18228
|
this.blendMode = "normal";
|
|
18292
18229
|
|
|
18293
18230
|
/**
|
|
18294
18231
|
* The name of the renderable
|
|
18295
|
-
* @public
|
|
18296
18232
|
* @type {string}
|
|
18297
|
-
* @name name
|
|
18298
18233
|
* @default ""
|
|
18299
|
-
* @memberof Renderable
|
|
18300
18234
|
*/
|
|
18301
18235
|
this.name = "";
|
|
18302
18236
|
|
|
@@ -18307,8 +18241,6 @@ class Renderable extends Rect {
|
|
|
18307
18241
|
* Position of the Renderable relative to its parent container
|
|
18308
18242
|
* @public
|
|
18309
18243
|
* @type {ObservableVector3d}
|
|
18310
|
-
* @name pos
|
|
18311
|
-
* @memberof Renderable#
|
|
18312
18244
|
*/
|
|
18313
18245
|
this.pos = pool.pull("ObservableVector3d", x, y, 0, { onUpdate: this.updateBoundsPos, scope: this});
|
|
18314
18246
|
}
|
|
@@ -18316,9 +18248,7 @@ class Renderable extends Rect {
|
|
|
18316
18248
|
/**
|
|
18317
18249
|
* when true the renderable will be redrawn during the next update cycle
|
|
18318
18250
|
* @type {boolean}
|
|
18319
|
-
* @name isDirty
|
|
18320
18251
|
* @default false
|
|
18321
|
-
* @memberof Renderable#
|
|
18322
18252
|
*/
|
|
18323
18253
|
this.isDirty = false;
|
|
18324
18254
|
|
|
@@ -18337,23 +18267,45 @@ class Renderable extends Rect {
|
|
|
18337
18267
|
|
|
18338
18268
|
/**
|
|
18339
18269
|
* Whether the renderable object is floating, or contained in a floating container
|
|
18340
|
-
* @public
|
|
18341
18270
|
* @see Renderable#floating
|
|
18342
18271
|
* @type {boolean}
|
|
18343
|
-
* @name isFloating
|
|
18344
|
-
* @memberof Renderable
|
|
18345
18272
|
*/
|
|
18346
18273
|
get isFloating() {
|
|
18347
18274
|
return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.floating === true);
|
|
18348
18275
|
}
|
|
18349
18276
|
|
|
18277
|
+
/**
|
|
18278
|
+
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
18279
|
+
* @type {Color}
|
|
18280
|
+
* @default (255, 255, 255)
|
|
18281
|
+
* @example
|
|
18282
|
+
* // add a red tint to this renderable
|
|
18283
|
+
* this.tint.setColor(255, 128, 128);
|
|
18284
|
+
* // remove the tint
|
|
18285
|
+
* this.tint.setColor(255, 255, 255);
|
|
18286
|
+
*/
|
|
18287
|
+
get tint() {
|
|
18288
|
+
if (typeof this._tint === "undefined") {
|
|
18289
|
+
this._tint = pool.pull("Color", 255, 255, 255, 1.0);
|
|
18290
|
+
}
|
|
18291
|
+
return this._tint;
|
|
18292
|
+
}
|
|
18293
|
+
set tint(value) {
|
|
18294
|
+
if (typeof this._tint === "undefined") {
|
|
18295
|
+
this._tint = pool.pull("Color", 255, 255, 255, 1.0);
|
|
18296
|
+
}
|
|
18297
|
+
if (value instanceof Color) {
|
|
18298
|
+
this._tint.copy(value);
|
|
18299
|
+
} else {
|
|
18300
|
+
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
18301
|
+
this._tint.parseCSS(value);
|
|
18302
|
+
}
|
|
18303
|
+
}
|
|
18304
|
+
|
|
18350
18305
|
/**
|
|
18351
18306
|
* Whether the renderable object is visible and within the viewport
|
|
18352
|
-
* @public
|
|
18353
18307
|
* @type {boolean}
|
|
18354
18308
|
* @default false
|
|
18355
|
-
* @name inViewport
|
|
18356
|
-
* @memberof Renderable
|
|
18357
18309
|
*/
|
|
18358
18310
|
get inViewport() {
|
|
18359
18311
|
return this._inViewport;
|
|
@@ -18372,8 +18324,6 @@ class Renderable extends Rect {
|
|
|
18372
18324
|
* @public
|
|
18373
18325
|
* @see Renderable#flipX
|
|
18374
18326
|
* @type {boolean}
|
|
18375
|
-
* @name isFlippedX
|
|
18376
|
-
* @memberof Renderable
|
|
18377
18327
|
*/
|
|
18378
18328
|
get isFlippedX() {
|
|
18379
18329
|
return this._flip.x === true;
|
|
@@ -18384,8 +18334,6 @@ class Renderable extends Rect {
|
|
|
18384
18334
|
* @public
|
|
18385
18335
|
* @see Renderable#flipY
|
|
18386
18336
|
* @type {boolean}
|
|
18387
|
-
* @name isFlippedY
|
|
18388
|
-
* @memberof Renderable
|
|
18389
18337
|
*/
|
|
18390
18338
|
get isFlippedY() {
|
|
18391
18339
|
return this._flip.y === true;
|
|
@@ -18393,8 +18341,6 @@ class Renderable extends Rect {
|
|
|
18393
18341
|
|
|
18394
18342
|
/**
|
|
18395
18343
|
* returns the bounding box for this renderable
|
|
18396
|
-
* @name getBounds
|
|
18397
|
-
* @memberof Renderable
|
|
18398
18344
|
* @returns {Bounds} bounding box Rectangle object
|
|
18399
18345
|
*/
|
|
18400
18346
|
getBounds() {
|
|
@@ -18413,8 +18359,6 @@ class Renderable extends Rect {
|
|
|
18413
18359
|
|
|
18414
18360
|
/**
|
|
18415
18361
|
* get the renderable alpha channel value<br>
|
|
18416
|
-
* @name getOpacity
|
|
18417
|
-
* @memberof Renderable
|
|
18418
18362
|
* @returns {number} current opacity value between 0 and 1
|
|
18419
18363
|
*/
|
|
18420
18364
|
getOpacity() {
|
|
@@ -18423,8 +18367,6 @@ class Renderable extends Rect {
|
|
|
18423
18367
|
|
|
18424
18368
|
/**
|
|
18425
18369
|
* set the renderable alpha channel value<br>
|
|
18426
|
-
* @name setOpacity
|
|
18427
|
-
* @memberof Renderable
|
|
18428
18370
|
* @param {number} alpha opacity value between 0.0 and 1.0
|
|
18429
18371
|
*/
|
|
18430
18372
|
setOpacity(alpha) {
|
|
@@ -18441,8 +18383,6 @@ class Renderable extends Rect {
|
|
|
18441
18383
|
/**
|
|
18442
18384
|
* flip the renderable on the horizontal axis (around the center of the renderable)
|
|
18443
18385
|
* @see Matrix2d#scaleX
|
|
18444
|
-
* @name flipX
|
|
18445
|
-
* @memberof Renderable
|
|
18446
18386
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
18447
18387
|
* @returns {Renderable} Reference to this object for method chaining
|
|
18448
18388
|
*/
|
|
@@ -18455,8 +18395,6 @@ class Renderable extends Rect {
|
|
|
18455
18395
|
/**
|
|
18456
18396
|
* flip the renderable on the vertical axis (around the center of the renderable)
|
|
18457
18397
|
* @see Matrix2d#scaleY
|
|
18458
|
-
* @name flipY
|
|
18459
|
-
* @memberof Renderable
|
|
18460
18398
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
18461
18399
|
* @returns {Renderable} Reference to this object for method chaining
|
|
18462
18400
|
*/
|
|
@@ -18468,8 +18406,6 @@ class Renderable extends Rect {
|
|
|
18468
18406
|
|
|
18469
18407
|
/**
|
|
18470
18408
|
* multiply the renderable currentTransform with the given matrix
|
|
18471
|
-
* @name transform
|
|
18472
|
-
* @memberof Renderable
|
|
18473
18409
|
* @see Renderable#currentTransform
|
|
18474
18410
|
* @param {Matrix2d} m the transformation matrix
|
|
18475
18411
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -18484,8 +18420,6 @@ class Renderable extends Rect {
|
|
|
18484
18420
|
|
|
18485
18421
|
/**
|
|
18486
18422
|
* return the angle to the specified target
|
|
18487
|
-
* @name angleTo
|
|
18488
|
-
* @memberof Renderable
|
|
18489
18423
|
* @param {Renderable|Vector2d|Vector3d} target
|
|
18490
18424
|
* @returns {number} angle in radians
|
|
18491
18425
|
*/
|
|
@@ -18507,8 +18441,6 @@ class Renderable extends Rect {
|
|
|
18507
18441
|
|
|
18508
18442
|
/**
|
|
18509
18443
|
* return the distance to the specified target
|
|
18510
|
-
* @name distanceTo
|
|
18511
|
-
* @memberof Renderable
|
|
18512
18444
|
* @param {Renderable|Vector2d|Vector3d} target
|
|
18513
18445
|
* @returns {number} distance
|
|
18514
18446
|
*/
|
|
@@ -18530,8 +18462,6 @@ class Renderable extends Rect {
|
|
|
18530
18462
|
|
|
18531
18463
|
/**
|
|
18532
18464
|
* Rotate this renderable towards the given target.
|
|
18533
|
-
* @name lookAt
|
|
18534
|
-
* @memberof Renderable
|
|
18535
18465
|
* @param {Renderable|Vector2d|Vector3d} target the renderable or position to look at
|
|
18536
18466
|
* @returns {Renderable} Reference to this object for method chaining
|
|
18537
18467
|
*/
|
|
@@ -18553,8 +18483,6 @@ class Renderable extends Rect {
|
|
|
18553
18483
|
|
|
18554
18484
|
/**
|
|
18555
18485
|
* Rotate this renderable by the specified angle (in radians).
|
|
18556
|
-
* @name rotate
|
|
18557
|
-
* @memberof Renderable
|
|
18558
18486
|
* @param {number} angle The angle to rotate (in radians)
|
|
18559
18487
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
18560
18488
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -18574,8 +18502,6 @@ class Renderable extends Rect {
|
|
|
18574
18502
|
* when rendering. It does not scale the object itself. For example if the renderable
|
|
18575
18503
|
* is an image, the image.width and image.height properties are unaltered but the currentTransform
|
|
18576
18504
|
* member will be changed.
|
|
18577
|
-
* @name scale
|
|
18578
|
-
* @memberof Renderable
|
|
18579
18505
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
18580
18506
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
18581
18507
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -18589,8 +18515,6 @@ class Renderable extends Rect {
|
|
|
18589
18515
|
|
|
18590
18516
|
/**
|
|
18591
18517
|
* scale the renderable around his anchor point
|
|
18592
|
-
* @name scaleV
|
|
18593
|
-
* @memberof Renderable
|
|
18594
18518
|
* @param {Vector2d} v scaling vector
|
|
18595
18519
|
* @returns {Renderable} Reference to this object for method chaining
|
|
18596
18520
|
*/
|
|
@@ -18600,11 +18524,7 @@ class Renderable extends Rect {
|
|
|
18600
18524
|
}
|
|
18601
18525
|
|
|
18602
18526
|
/**
|
|
18603
|
-
* update function.
|
|
18604
|
-
* automatically called by the game manager {@link game}
|
|
18605
|
-
* @name update
|
|
18606
|
-
* @memberof Renderable
|
|
18607
|
-
* @protected
|
|
18527
|
+
* update function (automatically called by melonJS).
|
|
18608
18528
|
* @param {number} dt time since the last update in milliseconds.
|
|
18609
18529
|
* @returns {boolean} true if the renderable is dirty
|
|
18610
18530
|
*/
|
|
@@ -18615,8 +18535,6 @@ class Renderable extends Rect {
|
|
|
18615
18535
|
/**
|
|
18616
18536
|
* update the bounding box for this shape.
|
|
18617
18537
|
* @ignore
|
|
18618
|
-
* @name updateBounds
|
|
18619
|
-
* @memberof Renderable
|
|
18620
18538
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
18621
18539
|
*/
|
|
18622
18540
|
updateBounds() {
|
|
@@ -18628,8 +18546,6 @@ class Renderable extends Rect {
|
|
|
18628
18546
|
/**
|
|
18629
18547
|
* update the renderable's bounding rect (private)
|
|
18630
18548
|
* @ignore
|
|
18631
|
-
* @name updateBoundsPos
|
|
18632
|
-
* @memberof Renderable
|
|
18633
18549
|
*/
|
|
18634
18550
|
updateBoundsPos(newX, newY) {
|
|
18635
18551
|
var bounds = this.getBounds();
|
|
@@ -18660,8 +18576,6 @@ class Renderable extends Rect {
|
|
|
18660
18576
|
|
|
18661
18577
|
/**
|
|
18662
18578
|
* return the renderable absolute position in the game world
|
|
18663
|
-
* @name getAbsolutePosition
|
|
18664
|
-
* @memberof Renderable
|
|
18665
18579
|
* @returns {Vector2d}
|
|
18666
18580
|
*/
|
|
18667
18581
|
getAbsolutePosition() {
|
|
@@ -18679,8 +18593,6 @@ class Renderable extends Rect {
|
|
|
18679
18593
|
/**
|
|
18680
18594
|
* called when the anchor point value is changed
|
|
18681
18595
|
* @private
|
|
18682
|
-
* @name onAnchorUpdate
|
|
18683
|
-
* @memberof Renderable
|
|
18684
18596
|
* @param {number} x the new X value to be set for the anchor
|
|
18685
18597
|
* @param {number} y the new Y value to be set for the anchor
|
|
18686
18598
|
*/
|
|
@@ -18693,12 +18605,10 @@ class Renderable extends Rect {
|
|
|
18693
18605
|
}
|
|
18694
18606
|
|
|
18695
18607
|
/**
|
|
18696
|
-
*
|
|
18697
|
-
*
|
|
18698
|
-
*
|
|
18699
|
-
* @
|
|
18700
|
-
* @memberof Renderable
|
|
18701
|
-
* @protected
|
|
18608
|
+
* Prepare the rendering context before drawing (automatically called by melonJS).
|
|
18609
|
+
* This will apply any defined transforms, anchor point, tint or blend mode and translate the context accordingly to this renderable position.
|
|
18610
|
+
* @see Renderable#draw
|
|
18611
|
+
* @see Renderable#postDraw
|
|
18702
18612
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
18703
18613
|
*/
|
|
18704
18614
|
preDraw(renderer) {
|
|
@@ -18749,10 +18659,15 @@ class Renderable extends Rect {
|
|
|
18749
18659
|
}
|
|
18750
18660
|
|
|
18751
18661
|
/**
|
|
18752
|
-
*
|
|
18753
|
-
*
|
|
18754
|
-
*
|
|
18755
|
-
*
|
|
18662
|
+
* Draw this renderable (automatically called by melonJS).
|
|
18663
|
+
* All draw operations for renderable are made respectively
|
|
18664
|
+
* to the position or transforms set or applied by the preDraw method.
|
|
18665
|
+
* The main draw loop will first call preDraw() to prepare the context for drawing the renderable,
|
|
18666
|
+
* then draw() to draw the renderable, and finally postDraw() to clear the context.
|
|
18667
|
+
* If you override this method, be mindful about the drawing logic; for example if you draw a shape
|
|
18668
|
+
* from the draw method, you should make sure that your draw it at the 0, 0 coordinates.
|
|
18669
|
+
* @see Renderable#preDraw
|
|
18670
|
+
* @see Renderable#postDraw
|
|
18756
18671
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
18757
18672
|
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
18758
18673
|
*/
|
|
@@ -18761,11 +18676,9 @@ class Renderable extends Rect {
|
|
|
18761
18676
|
}
|
|
18762
18677
|
|
|
18763
18678
|
/**
|
|
18764
|
-
* restore the rendering context after drawing.
|
|
18765
|
-
*
|
|
18766
|
-
* @
|
|
18767
|
-
* @memberof Renderable
|
|
18768
|
-
* @protected
|
|
18679
|
+
* restore the rendering context after drawing (automatically called by melonJS).
|
|
18680
|
+
* @see Renderable#preDraw
|
|
18681
|
+
* @see Renderable#draw
|
|
18769
18682
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
18770
18683
|
*/
|
|
18771
18684
|
postDraw(renderer) {
|
|
@@ -18787,8 +18700,6 @@ class Renderable extends Rect {
|
|
|
18787
18700
|
/**
|
|
18788
18701
|
* onCollision callback, triggered in case of collision,
|
|
18789
18702
|
* when this renderable body is colliding with another one
|
|
18790
|
-
* @name onCollision
|
|
18791
|
-
* @memberof Renderable
|
|
18792
18703
|
* @param {ResponseObject} response the collision response object
|
|
18793
18704
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
18794
18705
|
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
@@ -18840,9 +18751,9 @@ class Renderable extends Rect {
|
|
|
18840
18751
|
this.mask = undefined;
|
|
18841
18752
|
}
|
|
18842
18753
|
|
|
18843
|
-
if (typeof this.
|
|
18844
|
-
pool.push(this.
|
|
18845
|
-
this.
|
|
18754
|
+
if (typeof this._tint !== "undefined") {
|
|
18755
|
+
pool.push(this._tint);
|
|
18756
|
+
this._tint = undefined;
|
|
18846
18757
|
}
|
|
18847
18758
|
|
|
18848
18759
|
this.ancestor = undefined;
|
|
@@ -18863,8 +18774,6 @@ class Renderable extends Rect {
|
|
|
18863
18774
|
/**
|
|
18864
18775
|
* OnDestroy Notification function<br>
|
|
18865
18776
|
* Called by engine before deleting the object
|
|
18866
|
-
* @name onDestroyEvent
|
|
18867
|
-
* @memberof Renderable
|
|
18868
18777
|
*/
|
|
18869
18778
|
onDestroyEvent() {
|
|
18870
18779
|
// to be extended !
|
|
@@ -19707,7 +19616,7 @@ var collision = {
|
|
|
19707
19616
|
class Body {
|
|
19708
19617
|
/**
|
|
19709
19618
|
* @param {Renderable} ancestor the parent object this body is attached to
|
|
19710
|
-
* @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
|
|
19619
|
+
* @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
|
|
19711
19620
|
* @param {Function} [onBodyUpdate] callback for when the body is updated (e.g. add/remove shapes)
|
|
19712
19621
|
*/
|
|
19713
19622
|
constructor(ancestor, shapes, onBodyUpdate) {
|
|
@@ -19734,7 +19643,7 @@ class Body {
|
|
|
19734
19643
|
/**
|
|
19735
19644
|
* The collision shapes of the body
|
|
19736
19645
|
* @ignore
|
|
19737
|
-
* @type {Polygon[]|Line[]|Ellipse[]}
|
|
19646
|
+
* @type {Polygon[]|Line[]|Ellipse[]|Point|Point[]}
|
|
19738
19647
|
*/
|
|
19739
19648
|
this.shapes = [];
|
|
19740
19649
|
}
|
|
@@ -19926,7 +19835,7 @@ class Body {
|
|
|
19926
19835
|
/**
|
|
19927
19836
|
* add a collision shape to this body <br>
|
|
19928
19837
|
* (note: me.Rect objects will be converted to me.Polygon before being added)
|
|
19929
|
-
* @param {Rect|Polygon|Line|Ellipse|Bounds|object} shape a shape or JSON object
|
|
19838
|
+
* @param {Rect|Polygon|Line|Ellipse|Point|Point[]|Bounds|object} shape a shape or JSON object
|
|
19930
19839
|
* @returns {number} the shape array length
|
|
19931
19840
|
* @example
|
|
19932
19841
|
* // add a rectangle shape
|
|
@@ -19961,6 +19870,12 @@ class Body {
|
|
|
19961
19870
|
// update the body bounds
|
|
19962
19871
|
this.bounds.add(shape.points);
|
|
19963
19872
|
this.bounds.translate(shape.pos);
|
|
19873
|
+
} else if (shape instanceof Point) {
|
|
19874
|
+
if (!this.shapes.includes(shape)) {
|
|
19875
|
+
// see removeShape
|
|
19876
|
+
this.shapes.push(shape);
|
|
19877
|
+
}
|
|
19878
|
+
this.bounds.addPoint(shape);
|
|
19964
19879
|
} else {
|
|
19965
19880
|
// JSON object
|
|
19966
19881
|
this.fromJSON(shape);
|
|
@@ -24446,8 +24361,10 @@ class CanvasRenderer extends Renderer {
|
|
|
24446
24361
|
* @memberof CanvasRenderer
|
|
24447
24362
|
*/
|
|
24448
24363
|
clear() {
|
|
24449
|
-
if (this.settings.transparent) {
|
|
24450
|
-
this.
|
|
24364
|
+
if (this.settings.transparent === false) {
|
|
24365
|
+
var canvas = this.getCanvas();
|
|
24366
|
+
var context = this.getContext();
|
|
24367
|
+
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
24451
24368
|
}
|
|
24452
24369
|
}
|
|
24453
24370
|
|
|
@@ -24458,13 +24375,14 @@ class CanvasRenderer extends Renderer {
|
|
|
24458
24375
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
24459
24376
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
24460
24377
|
*/
|
|
24461
|
-
clearColor(color = "#000000", opaque) {
|
|
24378
|
+
clearColor(color = "#000000", opaque = false) {
|
|
24462
24379
|
var canvas = this.getCanvas();
|
|
24463
24380
|
var context = this.getContext();
|
|
24464
24381
|
|
|
24465
24382
|
this.save();
|
|
24466
24383
|
this.resetTransform();
|
|
24467
|
-
context.
|
|
24384
|
+
context.globalAlpha = 1;
|
|
24385
|
+
context.globalCompositeOperation = opaque === true ? "copy" : "source-over";
|
|
24468
24386
|
context.fillStyle = (color instanceof Color) ? color.toRGBA() : color;
|
|
24469
24387
|
this.fillRect(0, 0, canvas.width, canvas.height);
|
|
24470
24388
|
this.restore();
|
|
@@ -24826,6 +24744,30 @@ class CanvasRenderer extends Renderer {
|
|
|
24826
24744
|
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
24827
24745
|
}
|
|
24828
24746
|
|
|
24747
|
+
/**
|
|
24748
|
+
* Stroke a Point at the specified coordinates
|
|
24749
|
+
* @name strokePoint
|
|
24750
|
+
* @memberof CanvasRenderer
|
|
24751
|
+
* @param {number} x
|
|
24752
|
+
* @param {number} y
|
|
24753
|
+
*/
|
|
24754
|
+
strokePoint(x, y) {
|
|
24755
|
+
this.strokeLine(x, y, x + 1, y + 1);
|
|
24756
|
+
}
|
|
24757
|
+
|
|
24758
|
+
/**
|
|
24759
|
+
* Draw a a point at the specified coordinates
|
|
24760
|
+
* @name fillPoint
|
|
24761
|
+
* @memberof CanvasRenderer
|
|
24762
|
+
* @param {number} x
|
|
24763
|
+
* @param {number} y
|
|
24764
|
+
* @param {number} width
|
|
24765
|
+
* @param {number} height
|
|
24766
|
+
*/
|
|
24767
|
+
fillPoint(x, y) {
|
|
24768
|
+
this.strokePoint(x, y);
|
|
24769
|
+
}
|
|
24770
|
+
|
|
24829
24771
|
/**
|
|
24830
24772
|
* return a reference to the font 2d Context
|
|
24831
24773
|
* @ignore
|
|
@@ -27036,7 +26978,7 @@ class TMXObject {
|
|
|
27036
26978
|
this.type = settings.type;
|
|
27037
26979
|
|
|
27038
26980
|
/**
|
|
27039
|
-
* the
|
|
26981
|
+
* the object class
|
|
27040
26982
|
* @public
|
|
27041
26983
|
* @type {string}
|
|
27042
26984
|
* @name class
|
|
@@ -27099,6 +27041,15 @@ class TMXObject {
|
|
|
27099
27041
|
*/
|
|
27100
27042
|
this.isEllipse = false;
|
|
27101
27043
|
|
|
27044
|
+
/**
|
|
27045
|
+
* if true, the object is a Point
|
|
27046
|
+
* @public
|
|
27047
|
+
* @type {boolean}
|
|
27048
|
+
* @name isPoint
|
|
27049
|
+
* @memberof TMXObject
|
|
27050
|
+
*/
|
|
27051
|
+
this.isPoint = false;
|
|
27052
|
+
|
|
27102
27053
|
/**
|
|
27103
27054
|
* if true, the object is a Polygon
|
|
27104
27055
|
* @public
|
|
@@ -27122,12 +27073,14 @@ class TMXObject {
|
|
|
27122
27073
|
this.setTile(map.tilesets);
|
|
27123
27074
|
}
|
|
27124
27075
|
else {
|
|
27125
|
-
if (typeof
|
|
27076
|
+
if (typeof settings.ellipse !== "undefined") {
|
|
27126
27077
|
this.isEllipse = true;
|
|
27127
|
-
} else if (typeof
|
|
27078
|
+
} else if (typeof settings.point !== "undefined") {
|
|
27079
|
+
this.isPoint = true;
|
|
27080
|
+
} else if (typeof settings.polygon !== "undefined") {
|
|
27128
27081
|
this.points = settings.polygon;
|
|
27129
27082
|
this.isPolygon = true;
|
|
27130
|
-
} else if (typeof
|
|
27083
|
+
} else if (typeof settings.polyline !== "undefined") {
|
|
27131
27084
|
this.points = settings.polyline;
|
|
27132
27085
|
this.isPolyLine = true;
|
|
27133
27086
|
}
|
|
@@ -27201,8 +27154,9 @@ class TMXObject {
|
|
|
27201
27154
|
this.width,
|
|
27202
27155
|
this.height
|
|
27203
27156
|
)).rotate(this.rotation));
|
|
27157
|
+
} else if (this.isPoint === true) {
|
|
27158
|
+
shapes.push(pool.pull("Point", this.x, this.y));
|
|
27204
27159
|
} else {
|
|
27205
|
-
|
|
27206
27160
|
// add a polygon
|
|
27207
27161
|
if (this.isPolygon === true) {
|
|
27208
27162
|
var _polygon = pool.pull("Polygon", 0, 0, this.points);
|
|
@@ -27211,10 +27165,8 @@ class TMXObject {
|
|
|
27211
27165
|
throw new Error("collision polygones in Tiled should be defined as Convex");
|
|
27212
27166
|
}
|
|
27213
27167
|
shapes.push(_polygon.rotate(this.rotation));
|
|
27214
|
-
}
|
|
27215
27168
|
|
|
27216
|
-
|
|
27217
|
-
else if (this.isPolyLine === true) {
|
|
27169
|
+
} else if (this.isPolyLine === true) {
|
|
27218
27170
|
var p = this.points;
|
|
27219
27171
|
var p1, p2;
|
|
27220
27172
|
var segments = p.length - 1;
|
|
@@ -27246,7 +27198,9 @@ class TMXObject {
|
|
|
27246
27198
|
// Apply isometric projection
|
|
27247
27199
|
if (this.orientation === "isometric") {
|
|
27248
27200
|
for (i = 0; i < shapes.length; i++) {
|
|
27249
|
-
shapes[i].toIso
|
|
27201
|
+
if (typeof shapes[i].toIso === "function") {
|
|
27202
|
+
shapes[i].toIso();
|
|
27203
|
+
}
|
|
27250
27204
|
}
|
|
27251
27205
|
}
|
|
27252
27206
|
|
|
@@ -29233,7 +29187,12 @@ class Sprite extends Renderable {
|
|
|
29233
29187
|
}
|
|
29234
29188
|
|
|
29235
29189
|
if (typeof (settings.tint) !== "undefined") {
|
|
29236
|
-
|
|
29190
|
+
if (settings.tint instanceof Color) {
|
|
29191
|
+
this.tint.copy(settings.tint);
|
|
29192
|
+
} else {
|
|
29193
|
+
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
29194
|
+
this.tint.parseCSS(settings.tint);
|
|
29195
|
+
}
|
|
29237
29196
|
}
|
|
29238
29197
|
|
|
29239
29198
|
// set the sprite name if specified
|
|
@@ -30777,7 +30736,8 @@ class WebGLRenderer extends Renderer {
|
|
|
30777
30736
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
30778
30737
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
|
|
30779
30738
|
* @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.
|
|
30780
|
-
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
30739
|
+
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
30740
|
+
* @param {boolean} [options.premultipliedAlpha=true] in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
30781
30741
|
* @param {boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
|
|
30782
30742
|
* @param {boolean} [options.preferWebGL1=false] if true the renderer will only use WebGL 1
|
|
30783
30743
|
* @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.
|
|
@@ -30792,8 +30752,6 @@ class WebGLRenderer extends Renderer {
|
|
|
30792
30752
|
|
|
30793
30753
|
/**
|
|
30794
30754
|
* The WebGL version used by this renderer (1 or 2)
|
|
30795
|
-
* @name WebGLVersion
|
|
30796
|
-
* @memberof WebGLRenderer#
|
|
30797
30755
|
* @type {number}
|
|
30798
30756
|
* @default 1
|
|
30799
30757
|
* @readonly
|
|
@@ -30802,8 +30760,6 @@ class WebGLRenderer extends Renderer {
|
|
|
30802
30760
|
|
|
30803
30761
|
/**
|
|
30804
30762
|
* The vendor string of the underlying graphics driver.
|
|
30805
|
-
* @name GPUVendor
|
|
30806
|
-
* @memberof WebGLRenderer#
|
|
30807
30763
|
* @type {string}
|
|
30808
30764
|
* @default null
|
|
30809
30765
|
* @readonly
|
|
@@ -30812,8 +30768,6 @@ class WebGLRenderer extends Renderer {
|
|
|
30812
30768
|
|
|
30813
30769
|
/**
|
|
30814
30770
|
* The renderer string of the underlying graphics driver.
|
|
30815
|
-
* @name GPURenderer
|
|
30816
|
-
* @memberof WebGLRenderer#
|
|
30817
30771
|
* @type {string}
|
|
30818
30772
|
* @default null
|
|
30819
30773
|
* @readonly
|
|
@@ -30823,15 +30777,12 @@ class WebGLRenderer extends Renderer {
|
|
|
30823
30777
|
/**
|
|
30824
30778
|
* The WebGL context
|
|
30825
30779
|
* @name gl
|
|
30826
|
-
* @memberof WebGLRenderer
|
|
30827
30780
|
* @type {WebGLRenderingContext}
|
|
30828
30781
|
*/
|
|
30829
30782
|
this.context = this.gl = this.getContextGL(this.getCanvas(), options.transparent);
|
|
30830
30783
|
|
|
30831
30784
|
/**
|
|
30832
30785
|
* Maximum number of texture unit supported under the current context
|
|
30833
|
-
* @name maxTextures
|
|
30834
|
-
* @memberof WebGLRenderer#
|
|
30835
30786
|
* @type {number}
|
|
30836
30787
|
* @readonly
|
|
30837
30788
|
*/
|
|
@@ -30859,25 +30810,19 @@ class WebGLRenderer extends Renderer {
|
|
|
30859
30810
|
|
|
30860
30811
|
/**
|
|
30861
30812
|
* The current transformation matrix used for transformations on the overall scene
|
|
30862
|
-
* @name currentTransform
|
|
30863
30813
|
* @type {Matrix2d}
|
|
30864
|
-
* @memberof WebGLRenderer#
|
|
30865
30814
|
*/
|
|
30866
30815
|
this.currentTransform = new Matrix2d();
|
|
30867
30816
|
|
|
30868
30817
|
/**
|
|
30869
30818
|
* The current compositor used by the renderer
|
|
30870
|
-
* @name currentCompositor
|
|
30871
30819
|
* @type {WebGLCompositor}
|
|
30872
|
-
* @memberof WebGLRenderer#
|
|
30873
30820
|
*/
|
|
30874
30821
|
this.currentCompositor = null;
|
|
30875
30822
|
|
|
30876
30823
|
/**
|
|
30877
30824
|
* The list of active compositors
|
|
30878
|
-
* @name compositors
|
|
30879
30825
|
* @type {Map<WebGLCompositor>}
|
|
30880
|
-
* @memberof WebGLRenderer#
|
|
30881
30826
|
*/
|
|
30882
30827
|
this.compositors = new Map();
|
|
30883
30828
|
|
|
@@ -30923,8 +30868,6 @@ class WebGLRenderer extends Renderer {
|
|
|
30923
30868
|
|
|
30924
30869
|
/**
|
|
30925
30870
|
* Reset context state
|
|
30926
|
-
* @name reset
|
|
30927
|
-
* @memberof WebGLRenderer
|
|
30928
30871
|
*/
|
|
30929
30872
|
reset() {
|
|
30930
30873
|
super.reset();
|
|
@@ -30947,9 +30890,7 @@ class WebGLRenderer extends Renderer {
|
|
|
30947
30890
|
|
|
30948
30891
|
/**
|
|
30949
30892
|
* set the active compositor for this renderer
|
|
30950
|
-
* @name setCompositor
|
|
30951
30893
|
* @param {WebGLCompositor|string} compositor a compositor name or instance
|
|
30952
|
-
* @memberof WebGLRenderer
|
|
30953
30894
|
*/
|
|
30954
30895
|
setCompositor(compositor = "default") {
|
|
30955
30896
|
|
|
@@ -30973,8 +30914,6 @@ class WebGLRenderer extends Renderer {
|
|
|
30973
30914
|
|
|
30974
30915
|
/**
|
|
30975
30916
|
* Reset the gl transform to identity
|
|
30976
|
-
* @name resetTransform
|
|
30977
|
-
* @memberof WebGLRenderer
|
|
30978
30917
|
*/
|
|
30979
30918
|
resetTransform() {
|
|
30980
30919
|
this.currentTransform.identity();
|
|
@@ -31019,8 +30958,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31019
30958
|
|
|
31020
30959
|
/**
|
|
31021
30960
|
* Create a pattern with the specified repetition
|
|
31022
|
-
* @name createPattern
|
|
31023
|
-
* @memberof WebGLRenderer
|
|
31024
30961
|
* @param {Image} image Source image
|
|
31025
30962
|
* @param {string} repeat Define how the pattern should be repeated
|
|
31026
30963
|
* @returns {TextureAtlas}
|
|
@@ -31051,8 +30988,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31051
30988
|
|
|
31052
30989
|
/**
|
|
31053
30990
|
* Flush the compositor to the frame buffer
|
|
31054
|
-
* @name flush
|
|
31055
|
-
* @memberof WebGLRenderer
|
|
31056
30991
|
*/
|
|
31057
30992
|
flush() {
|
|
31058
30993
|
this.currentCompositor.flush();
|
|
@@ -31060,8 +30995,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31060
30995
|
|
|
31061
30996
|
/**
|
|
31062
30997
|
* set/change the current projection matrix (WebGL only)
|
|
31063
|
-
* @name setProjection
|
|
31064
|
-
* @memberof WebGLRenderer
|
|
31065
30998
|
* @param {Matrix3d} matrix
|
|
31066
30999
|
*/
|
|
31067
31000
|
setProjection(matrix) {
|
|
@@ -31069,10 +31002,15 @@ class WebGLRenderer extends Renderer {
|
|
|
31069
31002
|
this.currentCompositor.setProjection(matrix);
|
|
31070
31003
|
}
|
|
31071
31004
|
|
|
31005
|
+
/**
|
|
31006
|
+
* prepare the framebuffer for drawing a new frame
|
|
31007
|
+
*/
|
|
31008
|
+
clear() {
|
|
31009
|
+
this.currentCompositor.clear(this.settings.transparent ? 0.0 : 1.0);
|
|
31010
|
+
}
|
|
31011
|
+
|
|
31072
31012
|
/**
|
|
31073
31013
|
* Clears the gl context with the given color.
|
|
31074
|
-
* @name clearColor
|
|
31075
|
-
* @memberof WebGLRenderer
|
|
31076
31014
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
31077
31015
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
31078
31016
|
*/
|
|
@@ -31089,17 +31027,10 @@ class WebGLRenderer extends Renderer {
|
|
|
31089
31027
|
}
|
|
31090
31028
|
// clear gl context with the specified color
|
|
31091
31029
|
this.currentCompositor.clearColor(glArray[0], glArray[1], glArray[2], (opaque === true) ? 1.0 : glArray[3]);
|
|
31092
|
-
this.currentCompositor.clear();
|
|
31093
|
-
|
|
31094
|
-
// restore default clear Color black
|
|
31095
|
-
this.currentCompositor.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
31096
|
-
|
|
31097
31030
|
}
|
|
31098
31031
|
|
|
31099
31032
|
/**
|
|
31100
31033
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
31101
|
-
* @name clearRect
|
|
31102
|
-
* @memberof WebGLRenderer
|
|
31103
31034
|
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
31104
31035
|
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
31105
31036
|
* @param {number} width The rectangle's width.
|
|
@@ -31133,7 +31064,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31133
31064
|
uvs[1],
|
|
31134
31065
|
uvs[2],
|
|
31135
31066
|
uvs[3],
|
|
31136
|
-
this.currentTint.toUint32()
|
|
31067
|
+
this.currentTint.toUint32(this.getGlobalAlpha())
|
|
31137
31068
|
);
|
|
31138
31069
|
|
|
31139
31070
|
// Clear font context2D
|
|
@@ -31147,8 +31078,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31147
31078
|
|
|
31148
31079
|
/**
|
|
31149
31080
|
* Draw an image to the gl context
|
|
31150
|
-
* @name drawImage
|
|
31151
|
-
* @memberof WebGLRenderer
|
|
31152
31081
|
* @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.
|
|
31153
31082
|
* @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.
|
|
31154
31083
|
* @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.
|
|
@@ -31194,13 +31123,11 @@ class WebGLRenderer extends Renderer {
|
|
|
31194
31123
|
|
|
31195
31124
|
var texture = this.cache.get(image);
|
|
31196
31125
|
var uvs = texture.getUVs(sx + "," + sy + "," + sw + "," + sh);
|
|
31197
|
-
this.currentCompositor.addQuad(texture, dx, dy, dw, dh, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32());
|
|
31126
|
+
this.currentCompositor.addQuad(texture, dx, dy, dw, dh, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32(this.getGlobalAlpha()));
|
|
31198
31127
|
}
|
|
31199
31128
|
|
|
31200
31129
|
/**
|
|
31201
31130
|
* Draw a pattern within the given rectangle.
|
|
31202
|
-
* @name drawPattern
|
|
31203
|
-
* @memberof WebGLRenderer
|
|
31204
31131
|
* @param {TextureAtlas} pattern Pattern object
|
|
31205
31132
|
* @param {number} x
|
|
31206
31133
|
* @param {number} y
|
|
@@ -31210,18 +31137,16 @@ class WebGLRenderer extends Renderer {
|
|
|
31210
31137
|
*/
|
|
31211
31138
|
drawPattern(pattern, x, y, width, height) {
|
|
31212
31139
|
var uvs = pattern.getUVs("0,0," + width + "," + height);
|
|
31213
|
-
this.currentCompositor.addQuad(pattern, x, y, width, height, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32());
|
|
31140
|
+
this.currentCompositor.addQuad(pattern, x, y, width, height, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32(this.getGlobalAlpha()));
|
|
31214
31141
|
}
|
|
31215
31142
|
|
|
31216
31143
|
/**
|
|
31217
|
-
* Returns the WebGL Context object of the given
|
|
31218
|
-
* @name getContextGL
|
|
31219
|
-
* @memberof WebGLRenderer
|
|
31144
|
+
* Returns the WebGL Context object of the given canvas element
|
|
31220
31145
|
* @param {HTMLCanvasElement} canvas
|
|
31221
|
-
* @param {boolean} [transparent=
|
|
31146
|
+
* @param {boolean} [transparent=false] use true to enable transparency
|
|
31222
31147
|
* @returns {WebGLRenderingContext}
|
|
31223
31148
|
*/
|
|
31224
|
-
getContextGL(canvas, transparent) {
|
|
31149
|
+
getContextGL(canvas, transparent = false) {
|
|
31225
31150
|
if (typeof canvas === "undefined" || canvas === null) {
|
|
31226
31151
|
throw new Error(
|
|
31227
31152
|
"You must pass a canvas element in order to create " +
|
|
@@ -31229,17 +31154,13 @@ class WebGLRenderer extends Renderer {
|
|
|
31229
31154
|
);
|
|
31230
31155
|
}
|
|
31231
31156
|
|
|
31232
|
-
if (typeof transparent !== "boolean") {
|
|
31233
|
-
transparent = true;
|
|
31234
|
-
}
|
|
31235
|
-
|
|
31236
31157
|
var attr = {
|
|
31237
31158
|
alpha : transparent,
|
|
31238
31159
|
antialias : this.settings.antiAlias,
|
|
31239
31160
|
depth : false,
|
|
31240
31161
|
stencil: true,
|
|
31241
31162
|
preserveDrawingBuffer : false,
|
|
31242
|
-
premultipliedAlpha: transparent,
|
|
31163
|
+
premultipliedAlpha: transparent ? this.settings.premultipliedAlpha : false,
|
|
31243
31164
|
powerPreference: this.settings.powerPreference,
|
|
31244
31165
|
failIfMajorPerformanceCaveat : this.settings.failIfMajorPerformanceCaveat
|
|
31245
31166
|
};
|
|
@@ -31272,8 +31193,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31272
31193
|
/**
|
|
31273
31194
|
* Returns the WebGLContext instance for the renderer
|
|
31274
31195
|
* return a reference to the system 2d Context
|
|
31275
|
-
* @name getContext
|
|
31276
|
-
* @memberof WebGLRenderer
|
|
31277
31196
|
* @returns {WebGLRenderingContext}
|
|
31278
31197
|
*/
|
|
31279
31198
|
getContext() {
|
|
@@ -31291,9 +31210,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31291
31210
|
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
31292
31211
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
31293
31212
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
31294
|
-
* @name setBlendMode
|
|
31295
31213
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
31296
|
-
* @memberof WebGLRenderer
|
|
31297
31214
|
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
31298
31215
|
* @param {WebGLRenderingContext} [gl]
|
|
31299
31216
|
*/
|
|
@@ -31342,8 +31259,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31342
31259
|
|
|
31343
31260
|
/**
|
|
31344
31261
|
* restores the canvas context
|
|
31345
|
-
* @name restore
|
|
31346
|
-
* @memberof WebGLRenderer
|
|
31347
31262
|
*/
|
|
31348
31263
|
restore() {
|
|
31349
31264
|
// do nothing if there is no saved states
|
|
@@ -31377,8 +31292,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31377
31292
|
|
|
31378
31293
|
/**
|
|
31379
31294
|
* saves the canvas context
|
|
31380
|
-
* @name save
|
|
31381
|
-
* @memberof WebGLRenderer
|
|
31382
31295
|
*/
|
|
31383
31296
|
save() {
|
|
31384
31297
|
this._colorStack.push(this.currentColor.clone());
|
|
@@ -31394,8 +31307,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31394
31307
|
|
|
31395
31308
|
/**
|
|
31396
31309
|
* rotates the uniform matrix
|
|
31397
|
-
* @name rotate
|
|
31398
|
-
* @memberof WebGLRenderer
|
|
31399
31310
|
* @param {number} angle in radians
|
|
31400
31311
|
*/
|
|
31401
31312
|
rotate(angle) {
|
|
@@ -31404,8 +31315,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31404
31315
|
|
|
31405
31316
|
/**
|
|
31406
31317
|
* scales the uniform matrix
|
|
31407
|
-
* @name scale
|
|
31408
|
-
* @memberof WebGLRenderer
|
|
31409
31318
|
* @param {number} x
|
|
31410
31319
|
* @param {number} y
|
|
31411
31320
|
*/
|
|
@@ -31424,8 +31333,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31424
31333
|
|
|
31425
31334
|
/**
|
|
31426
31335
|
* Set the global alpha
|
|
31427
|
-
* @name setGlobalAlpha
|
|
31428
|
-
* @memberof WebGLRenderer
|
|
31429
31336
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
31430
31337
|
*/
|
|
31431
31338
|
setGlobalAlpha(alpha) {
|
|
@@ -31434,8 +31341,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31434
31341
|
|
|
31435
31342
|
/**
|
|
31436
31343
|
* Return the global alpha
|
|
31437
|
-
* @name getGlobalAlpha
|
|
31438
|
-
* @memberof WebGLRenderer
|
|
31439
31344
|
* @returns {number} global alpha value
|
|
31440
31345
|
*/
|
|
31441
31346
|
getGlobalAlpha() {
|
|
@@ -31445,8 +31350,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31445
31350
|
/**
|
|
31446
31351
|
* Set the current fill & stroke style color.
|
|
31447
31352
|
* By default, or upon reset, the value is set to #000000.
|
|
31448
|
-
* @name setColor
|
|
31449
|
-
* @memberof WebGLRenderer
|
|
31450
31353
|
* @param {Color|string} color css color string.
|
|
31451
31354
|
*/
|
|
31452
31355
|
setColor(color) {
|
|
@@ -31457,8 +31360,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31457
31360
|
|
|
31458
31361
|
/**
|
|
31459
31362
|
* Set the line width
|
|
31460
|
-
* @name setLineWidth
|
|
31461
|
-
* @memberof WebGLRenderer
|
|
31462
31363
|
* @param {number} width Line width
|
|
31463
31364
|
*/
|
|
31464
31365
|
setLineWidth(width) {
|
|
@@ -31467,8 +31368,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31467
31368
|
|
|
31468
31369
|
/**
|
|
31469
31370
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
31470
|
-
* @name strokeArc
|
|
31471
|
-
* @memberof WebGLRenderer
|
|
31472
31371
|
* @param {number} x arc center point x-axis
|
|
31473
31372
|
* @param {number} y arc center point y-axis
|
|
31474
31373
|
* @param {number} radius
|
|
@@ -31494,8 +31393,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31494
31393
|
|
|
31495
31394
|
/**
|
|
31496
31395
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
31497
|
-
* @name fillArc
|
|
31498
|
-
* @memberof WebGLRenderer
|
|
31499
31396
|
* @param {number} x arc center point x-axis
|
|
31500
31397
|
* @param {number} y arc center point y-axis
|
|
31501
31398
|
* @param {number} radius
|
|
@@ -31509,8 +31406,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31509
31406
|
|
|
31510
31407
|
/**
|
|
31511
31408
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
31512
|
-
* @name strokeEllipse
|
|
31513
|
-
* @memberof WebGLRenderer
|
|
31514
31409
|
* @param {number} x ellipse center point x-axis
|
|
31515
31410
|
* @param {number} y ellipse center point y-axis
|
|
31516
31411
|
* @param {number} w horizontal radius of the ellipse
|
|
@@ -31534,8 +31429,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31534
31429
|
|
|
31535
31430
|
/**
|
|
31536
31431
|
* Fill an ellipse at the specified coordinates with given radius
|
|
31537
|
-
* @name fillEllipse
|
|
31538
|
-
* @memberof WebGLRenderer
|
|
31539
31432
|
* @param {number} x ellipse center point x-axis
|
|
31540
31433
|
* @param {number} y ellipse center point y-axis
|
|
31541
31434
|
* @param {number} w horizontal radius of the ellipse
|
|
@@ -31547,8 +31440,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31547
31440
|
|
|
31548
31441
|
/**
|
|
31549
31442
|
* Stroke a line of the given two points
|
|
31550
|
-
* @name strokeLine
|
|
31551
|
-
* @memberof WebGLRenderer
|
|
31552
31443
|
* @param {number} startX the start x coordinate
|
|
31553
31444
|
* @param {number} startY the start y coordinate
|
|
31554
31445
|
* @param {number} endX the end x coordinate
|
|
@@ -31568,8 +31459,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31568
31459
|
|
|
31569
31460
|
/**
|
|
31570
31461
|
* Fill a line of the given two points
|
|
31571
|
-
* @name fillLine
|
|
31572
|
-
* @memberof WebGLRenderer
|
|
31573
31462
|
* @param {number} startX the start x coordinate
|
|
31574
31463
|
* @param {number} startY the start y coordinate
|
|
31575
31464
|
* @param {number} endX the end x coordinate
|
|
@@ -31581,8 +31470,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31581
31470
|
|
|
31582
31471
|
/**
|
|
31583
31472
|
* Stroke a me.Polygon on the screen with a specified color
|
|
31584
|
-
* @name strokePolygon
|
|
31585
|
-
* @memberof WebGLRenderer
|
|
31586
31473
|
* @param {Polygon} poly the shape to draw
|
|
31587
31474
|
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
31588
31475
|
*/
|
|
@@ -31612,8 +31499,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31612
31499
|
|
|
31613
31500
|
/**
|
|
31614
31501
|
* Fill a me.Polygon on the screen
|
|
31615
|
-
* @name fillPolygon
|
|
31616
|
-
* @memberof WebGLRenderer
|
|
31617
31502
|
* @param {Polygon} poly the shape to draw
|
|
31618
31503
|
*/
|
|
31619
31504
|
fillPolygon(poly) {
|
|
@@ -31622,8 +31507,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31622
31507
|
|
|
31623
31508
|
/**
|
|
31624
31509
|
* Draw a stroke rectangle at the specified coordinates
|
|
31625
|
-
* @name strokeRect
|
|
31626
|
-
* @memberof WebGLRenderer
|
|
31627
31510
|
* @param {number} x
|
|
31628
31511
|
* @param {number} y
|
|
31629
31512
|
* @param {number} width
|
|
@@ -31646,8 +31529,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31646
31529
|
|
|
31647
31530
|
/**
|
|
31648
31531
|
* Draw a filled rectangle at the specified coordinates
|
|
31649
|
-
* @name fillRect
|
|
31650
|
-
* @memberof WebGLRenderer
|
|
31651
31532
|
* @param {number} x
|
|
31652
31533
|
* @param {number} y
|
|
31653
31534
|
* @param {number} width
|
|
@@ -31659,8 +31540,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31659
31540
|
|
|
31660
31541
|
/**
|
|
31661
31542
|
* Stroke a rounded rectangle at the specified coordinates
|
|
31662
|
-
* @name strokeRoundRect
|
|
31663
|
-
* @memberof WebGLRenderer
|
|
31664
31543
|
* @param {number} x
|
|
31665
31544
|
* @param {number} y
|
|
31666
31545
|
* @param {number} width
|
|
@@ -31685,8 +31564,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31685
31564
|
|
|
31686
31565
|
/**
|
|
31687
31566
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
31688
|
-
* @name fillRoundRect
|
|
31689
|
-
* @memberof WebGLRenderer
|
|
31690
31567
|
* @param {number} x
|
|
31691
31568
|
* @param {number} y
|
|
31692
31569
|
* @param {number} width
|
|
@@ -31697,11 +31574,29 @@ class WebGLRenderer extends Renderer {
|
|
|
31697
31574
|
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
31698
31575
|
}
|
|
31699
31576
|
|
|
31577
|
+
/**
|
|
31578
|
+
* Stroke a Point at the specified coordinates
|
|
31579
|
+
* @param {number} x
|
|
31580
|
+
* @param {number} y
|
|
31581
|
+
*/
|
|
31582
|
+
strokePoint(x, y) {
|
|
31583
|
+
this.strokeLine(x, y, x + 1, y + 1);
|
|
31584
|
+
}
|
|
31585
|
+
|
|
31586
|
+
/**
|
|
31587
|
+
* Draw a a point at the specified coordinates
|
|
31588
|
+
* @param {number} x
|
|
31589
|
+
* @param {number} y
|
|
31590
|
+
* @param {number} width
|
|
31591
|
+
* @param {number} height
|
|
31592
|
+
*/
|
|
31593
|
+
fillPoint(x, y) {
|
|
31594
|
+
this.strokePoint(x, y);
|
|
31595
|
+
}
|
|
31596
|
+
|
|
31700
31597
|
/**
|
|
31701
31598
|
* Reset (overrides) the renderer transformation matrix to the
|
|
31702
31599
|
* identity one, and then apply the given transformation matrix.
|
|
31703
|
-
* @name setTransform
|
|
31704
|
-
* @memberof WebGLRenderer
|
|
31705
31600
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
31706
31601
|
*/
|
|
31707
31602
|
setTransform(mat2d) {
|
|
@@ -31711,8 +31606,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31711
31606
|
|
|
31712
31607
|
/**
|
|
31713
31608
|
* Multiply given matrix into the renderer tranformation matrix
|
|
31714
|
-
* @name transform
|
|
31715
|
-
* @memberof WebGLRenderer
|
|
31716
31609
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
31717
31610
|
*/
|
|
31718
31611
|
transform(mat2d) {
|
|
@@ -31728,8 +31621,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31728
31621
|
|
|
31729
31622
|
/**
|
|
31730
31623
|
* Translates the uniform matrix by the given coordinates
|
|
31731
|
-
* @name translate
|
|
31732
|
-
* @memberof WebGLRenderer
|
|
31733
31624
|
* @param {number} x
|
|
31734
31625
|
* @param {number} y
|
|
31735
31626
|
*/
|
|
@@ -31750,8 +31641,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31750
31641
|
* You can however save the current region using the save(),
|
|
31751
31642
|
* and restore it (with the restore() method) any time in the future.
|
|
31752
31643
|
* (<u>this is an experimental feature !</u>)
|
|
31753
|
-
* @name clipRect
|
|
31754
|
-
* @memberof WebGLRenderer
|
|
31755
31644
|
* @param {number} x
|
|
31756
31645
|
* @param {number} y
|
|
31757
31646
|
* @param {number} width
|
|
@@ -31797,8 +31686,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31797
31686
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
31798
31687
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
31799
31688
|
* Mask are not preserved through renderer context save and restore.
|
|
31800
|
-
* @name setMask
|
|
31801
|
-
* @memberof WebGLRenderer
|
|
31802
31689
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] a shape defining the mask to be applied
|
|
31803
31690
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
31804
31691
|
*/
|
|
@@ -31812,8 +31699,6 @@ class WebGLRenderer extends Renderer {
|
|
|
31812
31699
|
// Enable and setup GL state to write to stencil buffer
|
|
31813
31700
|
gl.enable(gl.STENCIL_TEST);
|
|
31814
31701
|
gl.clear(gl.STENCIL_BUFFER_BIT);
|
|
31815
|
-
|
|
31816
|
-
|
|
31817
31702
|
}
|
|
31818
31703
|
|
|
31819
31704
|
this.maskLevel++;
|
|
@@ -31842,9 +31727,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31842
31727
|
|
|
31843
31728
|
/**
|
|
31844
31729
|
* disable (remove) the rendering mask set through setMask.
|
|
31845
|
-
* @name clearMask
|
|
31846
31730
|
* @see WebGLRenderer#setMask
|
|
31847
|
-
* @memberof WebGLRenderer
|
|
31848
31731
|
*/
|
|
31849
31732
|
clearMask() {
|
|
31850
31733
|
if (this.maskLevel > 0) {
|
|
@@ -31873,6 +31756,7 @@ var settings = {
|
|
|
31873
31756
|
scale : 1.0,
|
|
31874
31757
|
scaleMethod : "manual",
|
|
31875
31758
|
transparent : false,
|
|
31759
|
+
premultipliedAlpha: true,
|
|
31876
31760
|
blendMode : "normal",
|
|
31877
31761
|
antiAlias : false,
|
|
31878
31762
|
failIfMajorPerformanceCaveat : true,
|
|
@@ -33010,10 +32894,10 @@ class BasePlugin {
|
|
|
33010
32894
|
* this can be overridden by the plugin
|
|
33011
32895
|
* @public
|
|
33012
32896
|
* @type {string}
|
|
33013
|
-
* @default "13.
|
|
32897
|
+
* @default "13.3.0"
|
|
33014
32898
|
* @name plugin.Base#version
|
|
33015
32899
|
*/
|
|
33016
|
-
this.version = "13.
|
|
32900
|
+
this.version = "13.3.0";
|
|
33017
32901
|
}
|
|
33018
32902
|
}
|
|
33019
32903
|
|
|
@@ -34256,7 +34140,7 @@ class TextMetrics extends Bounds {
|
|
|
34256
34140
|
this.width = this.height = 0;
|
|
34257
34141
|
|
|
34258
34142
|
for (var i = 0; i < strings.length; i++) {
|
|
34259
|
-
this.width = Math.max(this.lineWidth(strings[i].
|
|
34143
|
+
this.width = Math.max(this.lineWidth(strings[i].trimEnd(), context), this.width);
|
|
34260
34144
|
this.height += this.lineHeight();
|
|
34261
34145
|
}
|
|
34262
34146
|
this.width = Math.ceil(this.width);
|
|
@@ -34731,7 +34615,7 @@ class Text extends Renderable {
|
|
|
34731
34615
|
setContextStyle(context, this, stroke);
|
|
34732
34616
|
|
|
34733
34617
|
for (var i = 0; i < text.length; i++) {
|
|
34734
|
-
var string = text[i].
|
|
34618
|
+
var string = text[i].trimEnd();
|
|
34735
34619
|
// draw the string
|
|
34736
34620
|
context[stroke ? "strokeText" : "fillText"](string, x, y);
|
|
34737
34621
|
// add leading space
|
|
@@ -34876,12 +34760,7 @@ class BitmapText extends Renderable {
|
|
|
34876
34760
|
|
|
34877
34761
|
// apply given fillstyle
|
|
34878
34762
|
if (typeof settings.fillStyle !== "undefined") {
|
|
34879
|
-
|
|
34880
|
-
this.fillStyle.setColor(settings.fillStyle);
|
|
34881
|
-
} else {
|
|
34882
|
-
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
34883
|
-
this.fillStyle.parseCSS(settings.fillStyle);
|
|
34884
|
-
}
|
|
34763
|
+
this.fillStyle = settings.fillStyle;
|
|
34885
34764
|
}
|
|
34886
34765
|
|
|
34887
34766
|
// update anchorPoint if provided
|
|
@@ -34954,7 +34833,12 @@ class BitmapText extends Renderable {
|
|
|
34954
34833
|
return this.tint;
|
|
34955
34834
|
}
|
|
34956
34835
|
set fillStyle(value) {
|
|
34957
|
-
|
|
34836
|
+
if (value instanceof Color) {
|
|
34837
|
+
this.tint.copy(value);
|
|
34838
|
+
} else {
|
|
34839
|
+
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
34840
|
+
this.tint.parseCSS(value);
|
|
34841
|
+
}
|
|
34958
34842
|
}
|
|
34959
34843
|
|
|
34960
34844
|
/**
|
|
@@ -35011,7 +34895,7 @@ class BitmapText extends Renderable {
|
|
|
35011
34895
|
|
|
35012
34896
|
for (var i = 0; i < this._text.length; i++) {
|
|
35013
34897
|
x = lX;
|
|
35014
|
-
var string = this._text[i].
|
|
34898
|
+
var string = this._text[i].trimEnd();
|
|
35015
34899
|
// adjust x pos based on alignment value
|
|
35016
34900
|
var stringWidth = this.metrics.lineWidth(string);
|
|
35017
34901
|
switch (this.textAlign) {
|
|
@@ -37822,7 +37706,7 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
37822
37706
|
* @name version
|
|
37823
37707
|
* @type {string}
|
|
37824
37708
|
*/
|
|
37825
|
-
const version = "13.
|
|
37709
|
+
const version = "13.3.0";
|
|
37826
37710
|
|
|
37827
37711
|
|
|
37828
37712
|
/**
|
|
@@ -37881,6 +37765,7 @@ function boot() {
|
|
|
37881
37765
|
pool.register("me.RoundRect", RoundRect, true);
|
|
37882
37766
|
pool.register("me.Polygon", Polygon, true);
|
|
37883
37767
|
pool.register("me.Line", Line, true);
|
|
37768
|
+
pool.register("me.Point", Point, true);
|
|
37884
37769
|
pool.register("me.Ellipse", Ellipse, true);
|
|
37885
37770
|
pool.register("me.Bounds", Bounds, true);
|
|
37886
37771
|
|
|
@@ -37910,6 +37795,7 @@ function boot() {
|
|
|
37910
37795
|
pool.register("RoundRect", RoundRect, true);
|
|
37911
37796
|
pool.register("Polygon", Polygon, true);
|
|
37912
37797
|
pool.register("Line", Line, true);
|
|
37798
|
+
pool.register("Point", Point, true);
|
|
37913
37799
|
pool.register("Ellipse", Ellipse, true);
|
|
37914
37800
|
pool.register("Bounds", Bounds, true);
|
|
37915
37801
|
pool.register("CanvasTexture", CanvasTexture, true);
|
|
@@ -37933,4 +37819,4 @@ onReady(function () {
|
|
|
37933
37819
|
}
|
|
37934
37820
|
});
|
|
37935
37821
|
|
|
37936
|
-
export { BitmapText, BitmapTextData, Body, Bounds, Camera2d, CanvasRenderer, Collectable, Color, ColorLayer, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Light2d, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, Pointer, Polygon, QuadTree, Rect, Renderable, Renderer, RoundRect, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, Text, TextureAtlas, Tile, Trigger, Tween, Vector2d, Vector3d, WebGLCompositor, WebGLRenderer, World, audio, boot, collision, device, event, game, initialized, input, level, loader, plugin, plugins, pool, save, skipAutoInit, state, timer, utils, version, video, warning };
|
|
37822
|
+
export { BitmapText, BitmapTextData, Body, Bounds, Camera2d, CanvasRenderer, Collectable, Color, ColorLayer, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Light2d, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, Point, Pointer, Polygon, QuadTree, Rect, Renderable, Renderer, RoundRect, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, Text, TextureAtlas, Tile, Trigger, Tween, Vector2d, Vector3d, WebGLCompositor, WebGLRenderer, World, audio, boot, collision, device, event, game, initialized, input, level, loader, plugin, plugins, pool, save, skipAutoInit, state, timer, utils, version, video, warning };
|