@vpmedia/phaser 1.17.0 → 1.18.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 +1 -1
- package/package.json +3 -3
- package/src/phaser/core/animation.js +3 -2
- package/src/phaser/core/animation_manager.js +3 -2
- package/src/phaser/core/cache.js +1 -1
- package/src/phaser/core/const.js +66 -0
- package/src/phaser/core/device.js +87 -0
- package/src/phaser/core/dom.js +13 -8
- package/src/phaser/core/event_manager.js +2 -1
- package/src/phaser/core/factory.js +11 -11
- package/src/phaser/core/game.js +1 -0
- package/src/phaser/core/input_mspointer.js +6 -6
- package/src/phaser/core/input_pointer.js +1 -1
- package/src/phaser/core/scale_manager.js +41 -24
- package/src/phaser/core/scene_manager.js +10 -6
- package/src/phaser/core/sound_manager.js +14 -7
- package/src/phaser/core/sound_sprite.js +7 -4
- package/src/phaser/core/timer.js +33 -21
- package/src/phaser/core/timer_event.js +8 -6
- package/src/phaser/core/tween.js +65 -45
- package/src/phaser/core/tween_data.js +22 -15
- package/src/phaser/core/tween_manager.js +10 -6
- package/src/phaser/display/bitmap_text.js +7 -6
- package/src/phaser/display/canvas/pool.js +1 -1
- package/src/phaser/display/canvas/renderer.js +5 -4
- package/src/phaser/display/canvas/util.js +2 -2
- package/src/phaser/display/display_object.js +33 -16
- package/src/phaser/display/graphics.js +57 -36
- package/src/phaser/display/graphics_data.js +7 -7
- package/src/phaser/display/image.js +16 -11
- package/src/phaser/display/sprite_util.js +3 -2
- package/src/phaser/display/text.js +27 -14
- package/src/phaser/display/webgl/abstract_filter.js +2 -2
- package/src/phaser/display/webgl/base_texture.js +2 -2
- package/src/phaser/display/webgl/blend_manager.js +3 -2
- package/src/phaser/display/webgl/earcut_node.js +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.js +6 -6
- package/src/phaser/display/webgl/filter_manager.js +1 -1
- package/src/phaser/display/webgl/filter_texture.js +2 -2
- package/src/phaser/display/webgl/graphics_data.js +1 -1
- package/src/phaser/display/webgl/render_texture.js +7 -3
- package/src/phaser/display/webgl/renderer.js +9 -6
- package/src/phaser/display/webgl/shader/complex.js +1 -1
- package/src/phaser/display/webgl/shader/fast.js +1 -1
- package/src/phaser/display/webgl/shader/normal.js +2 -2
- package/src/phaser/display/webgl/shader/primitive.js +1 -1
- package/src/phaser/display/webgl/shader/strip.js +1 -1
- package/src/phaser/display/webgl/shader_manager.js +3 -3
- package/src/phaser/display/webgl/sprite_batch.js +9 -7
- package/src/phaser/display/webgl/stencil_manager.js +7 -7
- package/src/phaser/display/webgl/texture.js +8 -6
- package/types/phaser/core/animation.d.ts +5 -4
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +7 -6
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +2 -2
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/const.d.ts +88 -22
- package/types/phaser/core/const.d.ts.map +1 -1
- package/types/phaser/core/device.d.ts +87 -0
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +19 -27
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +4 -3
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +15 -15
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +1 -0
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +2 -2
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +13 -13
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +2 -2
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +57 -40
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +15 -10
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +16 -9
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +10 -7
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +41 -29
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +12 -11
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +79 -59
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +26 -19
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +16 -12
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +10 -9
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +2 -2
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +2 -2
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +5 -4
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts +2 -2
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +50 -33
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +65 -47
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/graphics_data.d.ts +16 -16
- package/types/phaser/display/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +17 -18
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +5 -4
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +33 -55
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +3 -3
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts +4 -4
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/blend_manager.d.ts +6 -5
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut_node.d.ts +3 -3
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +12 -12
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_manager.d.ts +3 -3
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_texture.d.ts +7 -7
- package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics_data.d.ts +5 -5
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +9 -9
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +10 -7
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/complex.d.ts +11 -11
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/fast.d.ts +15 -15
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +11 -11
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/primitive.d.ts +12 -12
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/strip.d.ts +12 -12
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +5 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +16 -14
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +12 -12
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +15 -12
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
|
@@ -7,6 +7,7 @@ import { Polygon } from '../geom/polygon';
|
|
|
7
7
|
import { Circle } from '../geom/circle';
|
|
8
8
|
import { Ellipse } from '../geom/ellipse';
|
|
9
9
|
import { Point } from '../geom/point';
|
|
10
|
+
import { Matrix } from '../geom/matrix';
|
|
10
11
|
import { GraphicsData } from './graphics_data';
|
|
11
12
|
import { CanvasBuffer } from './canvas/buffer';
|
|
12
13
|
import { textureFromCanvas } from './webgl/texture_util';
|
|
@@ -51,6 +52,7 @@ export class Graphics extends DisplayObject {
|
|
|
51
52
|
this._localBounds = new Rectangle(0, 0, 1, 1);
|
|
52
53
|
this.dirty = true;
|
|
53
54
|
this._boundsDirty = false;
|
|
55
|
+
this._cacheAsBitmap = false;
|
|
54
56
|
this.webGLDirty = false;
|
|
55
57
|
this.cachedSpriteDirty = false;
|
|
56
58
|
}
|
|
@@ -66,9 +68,10 @@ export class Graphics extends DisplayObject {
|
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* TBD.
|
|
69
|
-
* @param lineWidth - TBD.
|
|
70
|
-
* @param color - TBD.
|
|
71
|
-
* @param alpha - TBD.
|
|
71
|
+
* @param {number} lineWidth - TBD.
|
|
72
|
+
* @param {number} color - TBD.
|
|
73
|
+
* @param {number} alpha - TBD.
|
|
74
|
+
* @returns {Graphics} TBD.
|
|
72
75
|
*/
|
|
73
76
|
lineStyle(lineWidth = 0, color = 0, alpha = 1) {
|
|
74
77
|
this.lineWidth = lineWidth || 0;
|
|
@@ -92,6 +95,7 @@ export class Graphics extends DisplayObject {
|
|
|
92
95
|
* TBD.
|
|
93
96
|
* @param {number} x - TBD.
|
|
94
97
|
* @param {number} y - TBD.
|
|
98
|
+
* @returns {Graphics} TBD.
|
|
95
99
|
*/
|
|
96
100
|
moveTo(x, y) {
|
|
97
101
|
this.drawShape(new Polygon([x, y]));
|
|
@@ -102,6 +106,7 @@ export class Graphics extends DisplayObject {
|
|
|
102
106
|
* TBD.
|
|
103
107
|
* @param {number} x - TBD.
|
|
104
108
|
* @param {number} y - TBD.
|
|
109
|
+
* @returns {Graphics} TBD.
|
|
105
110
|
*/
|
|
106
111
|
lineTo(x, y) {
|
|
107
112
|
if (!this.currentPath) {
|
|
@@ -115,10 +120,11 @@ export class Graphics extends DisplayObject {
|
|
|
115
120
|
|
|
116
121
|
/**
|
|
117
122
|
* TBD.
|
|
118
|
-
* @param cpX - TBD.
|
|
119
|
-
* @param cpY - TBD.
|
|
120
|
-
* @param toX - TBD.
|
|
121
|
-
* @param toY - TBD.
|
|
123
|
+
* @param {number} cpX - TBD.
|
|
124
|
+
* @param {number} cpY - TBD.
|
|
125
|
+
* @param {number} toX - TBD.
|
|
126
|
+
* @param {number} toY - TBD.
|
|
127
|
+
* @returns {Graphics} TBD.
|
|
122
128
|
*/
|
|
123
129
|
quadraticCurveTo(cpX, cpY, toX, toY) {
|
|
124
130
|
if (this.currentPath) {
|
|
@@ -151,12 +157,13 @@ export class Graphics extends DisplayObject {
|
|
|
151
157
|
|
|
152
158
|
/**
|
|
153
159
|
* TBD.
|
|
154
|
-
* @param cpX - TBD.
|
|
155
|
-
* @param cpY - TBD.
|
|
156
|
-
* @param cpX2 - TBD.
|
|
157
|
-
* @param cpY2 - TBD.
|
|
158
|
-
* @param toX - TBD.
|
|
159
|
-
* @param toY - TBD.
|
|
160
|
+
* @param {number} cpX - TBD.
|
|
161
|
+
* @param {number} cpY - TBD.
|
|
162
|
+
* @param {number} cpX2 - TBD.
|
|
163
|
+
* @param {number} cpY2 - TBD.
|
|
164
|
+
* @param {number} toX - TBD.
|
|
165
|
+
* @param {number} toY - TBD.
|
|
166
|
+
* @returns {Graphics} TBD.
|
|
160
167
|
*/
|
|
161
168
|
bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) {
|
|
162
169
|
if (this.currentPath) {
|
|
@@ -195,11 +202,12 @@ export class Graphics extends DisplayObject {
|
|
|
195
202
|
|
|
196
203
|
/**
|
|
197
204
|
* TBD.
|
|
198
|
-
* @param x1 - TBD.
|
|
199
|
-
* @param y1 - TBD.
|
|
200
|
-
* @param x2 - TBD.
|
|
201
|
-
* @param y2 - TBD.
|
|
202
|
-
* @param radius - TBD.
|
|
205
|
+
* @param {number} x1 - TBD.
|
|
206
|
+
* @param {number} y1 - TBD.
|
|
207
|
+
* @param {number} x2 - TBD.
|
|
208
|
+
* @param {number} y2 - TBD.
|
|
209
|
+
* @param {number} radius - TBD.
|
|
210
|
+
* @returns {Graphics} TBD.
|
|
203
211
|
*/
|
|
204
212
|
arcTo(x1, y1, x2, y2, radius) {
|
|
205
213
|
if (this.currentPath) {
|
|
@@ -246,13 +254,14 @@ export class Graphics extends DisplayObject {
|
|
|
246
254
|
|
|
247
255
|
/**
|
|
248
256
|
* TBD.
|
|
249
|
-
* @param cx - TBD.
|
|
250
|
-
* @param cy - TBD.
|
|
251
|
-
* @param radius - TBD.
|
|
252
|
-
* @param startAngle - TBD.
|
|
253
|
-
* @param endAngle - TBD.
|
|
254
|
-
* @param anticlockwise - TBD.
|
|
255
|
-
* @param segments - TBD.
|
|
257
|
+
* @param {number} cx - TBD.
|
|
258
|
+
* @param {number} cy - TBD.
|
|
259
|
+
* @param {number} radius - TBD.
|
|
260
|
+
* @param {number} startAngle - TBD.
|
|
261
|
+
* @param {number} endAngle - TBD.
|
|
262
|
+
* @param {boolean} anticlockwise - TBD.
|
|
263
|
+
* @param {number} segments - TBD.
|
|
264
|
+
* @returns {Graphics} TBD.
|
|
256
265
|
*/
|
|
257
266
|
arc(cx, cy, radius, startAngle, endAngle, anticlockwise = false, segments = 40) {
|
|
258
267
|
// If we do this we can never draw a full circle
|
|
@@ -299,8 +308,9 @@ export class Graphics extends DisplayObject {
|
|
|
299
308
|
|
|
300
309
|
/**
|
|
301
310
|
* TBD.
|
|
302
|
-
* @param color - TBD.
|
|
303
|
-
* @param alpha - TBD.
|
|
311
|
+
* @param {number} color - TBD.
|
|
312
|
+
* @param {number} alpha - TBD.
|
|
313
|
+
* @returns {Graphics} TBD.
|
|
304
314
|
*/
|
|
305
315
|
beginFill(color = 0, alpha = 1) {
|
|
306
316
|
this.filling = true;
|
|
@@ -318,6 +328,7 @@ export class Graphics extends DisplayObject {
|
|
|
318
328
|
|
|
319
329
|
/**
|
|
320
330
|
* TBD.
|
|
331
|
+
* @returns {Graphics} TBD.
|
|
321
332
|
*/
|
|
322
333
|
endFill() {
|
|
323
334
|
this.filling = false;
|
|
@@ -332,6 +343,7 @@ export class Graphics extends DisplayObject {
|
|
|
332
343
|
* @param {number} y - TBD.
|
|
333
344
|
* @param {number} width - TBD.
|
|
334
345
|
* @param {number} height - TBD.
|
|
346
|
+
* @returns {Graphics} TBD.
|
|
335
347
|
*/
|
|
336
348
|
drawRect(x, y, width, height) {
|
|
337
349
|
this.drawShape(new Rectangle(x, y, width, height));
|
|
@@ -344,7 +356,8 @@ export class Graphics extends DisplayObject {
|
|
|
344
356
|
* @param {number} y - TBD.
|
|
345
357
|
* @param {number} width - TBD.
|
|
346
358
|
* @param {number} height - TBD.
|
|
347
|
-
* @param radius - TBD.
|
|
359
|
+
* @param {number} radius - TBD.
|
|
360
|
+
* @returns {Graphics} TBD.
|
|
348
361
|
*/
|
|
349
362
|
drawRoundedRect(x, y, width, height, radius) {
|
|
350
363
|
this.drawShape(new RoundedRectangle(x, y, width, height, radius));
|
|
@@ -355,7 +368,8 @@ export class Graphics extends DisplayObject {
|
|
|
355
368
|
* TBD.
|
|
356
369
|
* @param {number} x - TBD.
|
|
357
370
|
* @param {number} y - TBD.
|
|
358
|
-
* @param diameter - TBD.
|
|
371
|
+
* @param {number} diameter - TBD.
|
|
372
|
+
* @returns {Graphics} TBD.
|
|
359
373
|
*/
|
|
360
374
|
drawCircle(x, y, diameter) {
|
|
361
375
|
this.drawShape(new Circle(x, y, diameter));
|
|
@@ -368,6 +382,7 @@ export class Graphics extends DisplayObject {
|
|
|
368
382
|
* @param {number} y - TBD.
|
|
369
383
|
* @param {number} width - TBD.
|
|
370
384
|
* @param {number} height - TBD.
|
|
385
|
+
* @returns {Graphics} TBD.
|
|
371
386
|
*/
|
|
372
387
|
drawEllipse(x, y, width, height) {
|
|
373
388
|
this.drawShape(new Ellipse(x, y, width, height));
|
|
@@ -376,7 +391,8 @@ export class Graphics extends DisplayObject {
|
|
|
376
391
|
|
|
377
392
|
/**
|
|
378
393
|
* TBD.
|
|
379
|
-
* @param path - TBD.
|
|
394
|
+
* @param {Polygon} path - TBD.
|
|
395
|
+
* @returns {Graphics} TBD.
|
|
380
396
|
*/
|
|
381
397
|
drawPolygon(path) {
|
|
382
398
|
let points;
|
|
@@ -400,6 +416,7 @@ export class Graphics extends DisplayObject {
|
|
|
400
416
|
|
|
401
417
|
/**
|
|
402
418
|
* TBD.
|
|
419
|
+
* @returns {Graphics} TBD.
|
|
403
420
|
*/
|
|
404
421
|
clear() {
|
|
405
422
|
this.lineWidth = 0;
|
|
@@ -422,7 +439,7 @@ export class Graphics extends DisplayObject {
|
|
|
422
439
|
|
|
423
440
|
/**
|
|
424
441
|
* TBD.
|
|
425
|
-
* @param renderSession - TBD.
|
|
442
|
+
* @param {object} renderSession - TBD.
|
|
426
443
|
*/
|
|
427
444
|
renderWebGL(renderSession) {
|
|
428
445
|
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
|
@@ -482,7 +499,7 @@ export class Graphics extends DisplayObject {
|
|
|
482
499
|
|
|
483
500
|
/**
|
|
484
501
|
* TBD.
|
|
485
|
-
* @param renderSession - TBD.
|
|
502
|
+
* @param {object} renderSession - TBD.
|
|
486
503
|
*/
|
|
487
504
|
renderCanvas(renderSession) {
|
|
488
505
|
// if the sprite is not visible or the alpha is 0 then no need to render this element
|
|
@@ -538,7 +555,8 @@ export class Graphics extends DisplayObject {
|
|
|
538
555
|
|
|
539
556
|
/**
|
|
540
557
|
* TBD.
|
|
541
|
-
* @param matrix - TBD.
|
|
558
|
+
* @param {Matrix} matrix - TBD.
|
|
559
|
+
* @returns {Rectangle} TBD.
|
|
542
560
|
*/
|
|
543
561
|
getBounds(matrix = null) {
|
|
544
562
|
if (!this.renderable) {
|
|
@@ -598,6 +616,7 @@ export class Graphics extends DisplayObject {
|
|
|
598
616
|
|
|
599
617
|
/**
|
|
600
618
|
* TBD.
|
|
619
|
+
* @returns {Rectangle} TBD.
|
|
601
620
|
*/
|
|
602
621
|
getLocalBounds() {
|
|
603
622
|
const matrixCache = this.worldTransform;
|
|
@@ -615,8 +634,9 @@ export class Graphics extends DisplayObject {
|
|
|
615
634
|
|
|
616
635
|
/**
|
|
617
636
|
* TBD.
|
|
618
|
-
* @param point - TBD.
|
|
619
|
-
* @param tempPoint - TBD.
|
|
637
|
+
* @param {Point} point - TBD.
|
|
638
|
+
* @param {Point} tempPoint - TBD.
|
|
639
|
+
* @returns {boolean} TBD.
|
|
620
640
|
*/
|
|
621
641
|
containsPoint(point, tempPoint) {
|
|
622
642
|
this.worldTransform.applyInverse(point, tempPoint);
|
|
@@ -772,6 +792,7 @@ export class Graphics extends DisplayObject {
|
|
|
772
792
|
/**
|
|
773
793
|
* TBD.
|
|
774
794
|
* @param shape - TBD.
|
|
795
|
+
* @returns {GraphicsData} TBD.
|
|
775
796
|
*/
|
|
776
797
|
drawShape(shape) {
|
|
777
798
|
if (this.currentPath) {
|
|
@@ -842,7 +863,7 @@ export class Graphics extends DisplayObject {
|
|
|
842
863
|
* TBD.
|
|
843
864
|
* @param vertices - TBD.
|
|
844
865
|
* @param indices - TBD.
|
|
845
|
-
* @param cull - TBD.
|
|
866
|
+
* @param {boolean} cull - TBD.
|
|
846
867
|
*/
|
|
847
868
|
drawTriangles(vertices, indices, cull = false) {
|
|
848
869
|
const point1 = new Point();
|
|
@@ -3,13 +3,13 @@ import { clone } from './graphics_data_util';
|
|
|
3
3
|
export class GraphicsData {
|
|
4
4
|
/**
|
|
5
5
|
* TBD.
|
|
6
|
-
* @param lineWidth - TBD.
|
|
7
|
-
* @param lineColor - TBD.
|
|
8
|
-
* @param lineAlpha - TBD.
|
|
9
|
-
* @param fillColor - TBD.
|
|
10
|
-
* @param fillAlpha - TBD.
|
|
11
|
-
* @param fill - TBD.
|
|
12
|
-
* @param shape - TBD.
|
|
6
|
+
* @param {number} lineWidth - TBD.
|
|
7
|
+
* @param {number} lineColor - TBD.
|
|
8
|
+
* @param {number} lineAlpha - TBD.
|
|
9
|
+
* @param {number} fillColor - TBD.
|
|
10
|
+
* @param {number} fillAlpha - TBD.
|
|
11
|
+
* @param {boolean} fill - TBD.
|
|
12
|
+
* @param {object} shape - TBD.
|
|
13
13
|
*/
|
|
14
14
|
constructor(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) {
|
|
15
15
|
this.lineWidth = lineWidth;
|
|
@@ -2,6 +2,7 @@ import { Texture } from './webgl/texture';
|
|
|
2
2
|
import { AnimationManager } from '../core/animation_manager';
|
|
3
3
|
import { EventManager } from '../core/event_manager';
|
|
4
4
|
import { Rectangle } from '../geom/rectangle';
|
|
5
|
+
import { Matrix } from '../geom/matrix';
|
|
5
6
|
import { DisplayObject } from './display_object';
|
|
6
7
|
import { Game } from '../core/game';
|
|
7
8
|
import { clone } from '../geom/util/rectangle';
|
|
@@ -96,7 +97,7 @@ export class Image extends DisplayObject {
|
|
|
96
97
|
/**
|
|
97
98
|
* TBD.
|
|
98
99
|
* @param {string} key - TBD.
|
|
99
|
-
* @param frame - TBD.
|
|
100
|
+
* @param {number} frame - TBD.
|
|
100
101
|
* @param {boolean} stopAnimation - TBD.
|
|
101
102
|
*/
|
|
102
103
|
loadTexture(key, frame = 0, stopAnimation = true) {
|
|
@@ -184,7 +185,7 @@ export class Image extends DisplayObject {
|
|
|
184
185
|
|
|
185
186
|
/**
|
|
186
187
|
* TBD.
|
|
187
|
-
* @param parent
|
|
188
|
+
* @param parent - TBD.
|
|
188
189
|
* @param {number} width - TBD.
|
|
189
190
|
* @param {number} height - TBD.
|
|
190
191
|
*/
|
|
@@ -235,8 +236,8 @@ export class Image extends DisplayObject {
|
|
|
235
236
|
|
|
236
237
|
/**
|
|
237
238
|
* TBD.
|
|
238
|
-
* @param rect
|
|
239
|
-
* @param copy
|
|
239
|
+
* @param rect - TBD.
|
|
240
|
+
* @param {boolean} copy - TBD.
|
|
240
241
|
*/
|
|
241
242
|
crop(rect, copy = false) {
|
|
242
243
|
if (rect) {
|
|
@@ -289,6 +290,7 @@ export class Image extends DisplayObject {
|
|
|
289
290
|
|
|
290
291
|
/**
|
|
291
292
|
* TBD.
|
|
293
|
+
* @returns {number} TBD.
|
|
292
294
|
*/
|
|
293
295
|
get width() {
|
|
294
296
|
return this.scale.x * this.texture.frame.width;
|
|
@@ -304,6 +306,7 @@ export class Image extends DisplayObject {
|
|
|
304
306
|
|
|
305
307
|
/**
|
|
306
308
|
* TBD.
|
|
309
|
+
* @returns {number} TBD.
|
|
307
310
|
*/
|
|
308
311
|
get height() {
|
|
309
312
|
return this.scale.y * this.texture.frame.height;
|
|
@@ -332,8 +335,8 @@ export class Image extends DisplayObject {
|
|
|
332
335
|
|
|
333
336
|
/**
|
|
334
337
|
* TBD.
|
|
335
|
-
* @param texture
|
|
336
|
-
* @param destroyBase
|
|
338
|
+
* @param texture - TBD.
|
|
339
|
+
* @param {boolean} destroyBase - TBD.
|
|
337
340
|
*/
|
|
338
341
|
setTexture(texture, destroyBase = false) {
|
|
339
342
|
setTexture(this, texture, destroyBase);
|
|
@@ -341,7 +344,8 @@ export class Image extends DisplayObject {
|
|
|
341
344
|
|
|
342
345
|
/**
|
|
343
346
|
* TBD.
|
|
344
|
-
* @param matrix - TBD.
|
|
347
|
+
* @param {Matrix} matrix - TBD.
|
|
348
|
+
* @returns {Rectangle} TBD.
|
|
345
349
|
*/
|
|
346
350
|
getBounds(matrix = null) {
|
|
347
351
|
return getBounds(this, matrix);
|
|
@@ -349,6 +353,7 @@ export class Image extends DisplayObject {
|
|
|
349
353
|
|
|
350
354
|
/**
|
|
351
355
|
* TBD.
|
|
356
|
+
* @returns {Rectangle} TBD.
|
|
352
357
|
*/
|
|
353
358
|
getLocalBounds() {
|
|
354
359
|
return getLocalBounds(this);
|
|
@@ -356,8 +361,8 @@ export class Image extends DisplayObject {
|
|
|
356
361
|
|
|
357
362
|
/**
|
|
358
363
|
* TBD.
|
|
359
|
-
* @param renderSession - TBD.
|
|
360
|
-
* @param matrix - TBD.
|
|
364
|
+
* @param {object} renderSession - TBD.
|
|
365
|
+
* @param {Matrix} matrix - TBD.
|
|
361
366
|
*/
|
|
362
367
|
renderWebGL(renderSession, matrix = null) {
|
|
363
368
|
renderWebGL(this, renderSession, matrix);
|
|
@@ -365,8 +370,8 @@ export class Image extends DisplayObject {
|
|
|
365
370
|
|
|
366
371
|
/**
|
|
367
372
|
* TBD.
|
|
368
|
-
* @param renderSession - TBD.
|
|
369
|
-
* @param matrix - TBD.
|
|
373
|
+
* @param {object} renderSession - TBD.
|
|
374
|
+
* @param {Matrix} matrix - TBD.
|
|
370
375
|
*/
|
|
371
376
|
renderCanvas(renderSession, matrix = null) {
|
|
372
377
|
renderCanvas(this, renderSession, matrix);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getTintedTexture } from './canvas/tinter';
|
|
2
2
|
import { getIdentityMatrix } from '../geom/util/matrix';
|
|
3
|
+
import { Rectangle } from '../geom/rectangle';
|
|
3
4
|
import { SCALE_LINEAR } from '../core/const';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -22,7 +23,7 @@ export function setTexture(target, texture, destroyBase = false) {
|
|
|
22
23
|
* TBD.
|
|
23
24
|
* @param {object} target - TBD.
|
|
24
25
|
* @param {object} matrix - TBD.
|
|
25
|
-
* @returns {
|
|
26
|
+
* @returns {Rectangle} TBD.
|
|
26
27
|
*/
|
|
27
28
|
export function getBounds(target, matrix = null) {
|
|
28
29
|
// TODO verify
|
|
@@ -104,7 +105,7 @@ export function getBounds(target, matrix = null) {
|
|
|
104
105
|
/**
|
|
105
106
|
* TBD.
|
|
106
107
|
* @param {object} target - TBD.
|
|
107
|
-
* @returns {
|
|
108
|
+
* @returns {Rectangle} TBD.
|
|
108
109
|
*/
|
|
109
110
|
export function getLocalBounds(target) {
|
|
110
111
|
const matrixCache = target.worldTransform;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Point } from '../geom/point';
|
|
2
2
|
import { Rectangle } from '../geom/rectangle';
|
|
3
|
+
import { Matrix } from '../geom/matrix';
|
|
3
4
|
import { Image } from './image';
|
|
4
5
|
import { create, remove } from './canvas/pool';
|
|
5
6
|
import { textureFromCanvas } from './webgl/texture_util';
|
|
@@ -71,9 +72,9 @@ export class Text extends Image {
|
|
|
71
72
|
* @param {number} x - TBD.
|
|
72
73
|
* @param {number} y - TBD.
|
|
73
74
|
* @param color - TBD.
|
|
74
|
-
* @param blur
|
|
75
|
-
* @param shadowStroke
|
|
76
|
-
* @param shadowFill
|
|
75
|
+
* @param blur - TBD.
|
|
76
|
+
* @param shadowStroke - TBD.
|
|
77
|
+
* @param shadowFill - TBD.
|
|
77
78
|
*/
|
|
78
79
|
setShadow(x = 0, y = 0, color = 'rgba(0, 0, 0, 1)', blur = 0, shadowStroke = true, shadowFill = true) {
|
|
79
80
|
this.style.shadowOffsetX = x;
|
|
@@ -297,10 +298,10 @@ export class Text extends Image {
|
|
|
297
298
|
|
|
298
299
|
/**
|
|
299
300
|
* TBD.
|
|
300
|
-
* @param line
|
|
301
|
+
* @param line - TBD.
|
|
301
302
|
* @param {number} x - TBD.
|
|
302
303
|
* @param {number} y - TBD.
|
|
303
|
-
* @param fill
|
|
304
|
+
* @param fill - TBD.
|
|
304
305
|
*/
|
|
305
306
|
renderTabLine(line, x, y, fill) {
|
|
306
307
|
const text = line.split(/(?:\t)/);
|
|
@@ -354,7 +355,7 @@ export class Text extends Image {
|
|
|
354
355
|
|
|
355
356
|
/**
|
|
356
357
|
* TBD.
|
|
357
|
-
* @param line
|
|
358
|
+
* @param line - TBD.
|
|
358
359
|
*/
|
|
359
360
|
measureLine(line) {
|
|
360
361
|
let lineLength = 0;
|
|
@@ -390,7 +391,7 @@ export class Text extends Image {
|
|
|
390
391
|
|
|
391
392
|
/**
|
|
392
393
|
* TBD.
|
|
393
|
-
* @param line
|
|
394
|
+
* @param line - TBD.
|
|
394
395
|
* @param {number} x - TBD.
|
|
395
396
|
* @param {number} y - TBD.
|
|
396
397
|
*/
|
|
@@ -428,6 +429,7 @@ export class Text extends Image {
|
|
|
428
429
|
|
|
429
430
|
/**
|
|
430
431
|
* TBD.
|
|
432
|
+
* @returns {Text} TBD.
|
|
431
433
|
*/
|
|
432
434
|
clearColors() {
|
|
433
435
|
this.colors = [];
|
|
@@ -438,6 +440,7 @@ export class Text extends Image {
|
|
|
438
440
|
|
|
439
441
|
/**
|
|
440
442
|
* TBD.
|
|
443
|
+
* @returns {Text} TBD.
|
|
441
444
|
*/
|
|
442
445
|
clearFontValues() {
|
|
443
446
|
this.fontStyles = [];
|
|
@@ -450,6 +453,7 @@ export class Text extends Image {
|
|
|
450
453
|
* TBD.
|
|
451
454
|
* @param color - TBD.
|
|
452
455
|
* @param position - TBD.
|
|
456
|
+
* @returns {Text} TBD.
|
|
453
457
|
*/
|
|
454
458
|
addColor(color, position) {
|
|
455
459
|
this.colors[position] = color;
|
|
@@ -461,6 +465,7 @@ export class Text extends Image {
|
|
|
461
465
|
* TBD.
|
|
462
466
|
* @param color - TBD.
|
|
463
467
|
* @param position - TBD.
|
|
468
|
+
* @returns {Text} TBD.
|
|
464
469
|
*/
|
|
465
470
|
addStrokeColor(color, position) {
|
|
466
471
|
this.strokeColors[position] = color;
|
|
@@ -470,8 +475,9 @@ export class Text extends Image {
|
|
|
470
475
|
|
|
471
476
|
/**
|
|
472
477
|
* TBD.
|
|
473
|
-
* @param style
|
|
478
|
+
* @param style - TBD.
|
|
474
479
|
* @param position - TBD.
|
|
480
|
+
* @returns {Text} TBD.
|
|
475
481
|
*/
|
|
476
482
|
addFontStyle(style, position) {
|
|
477
483
|
this.fontStyles[position] = style;
|
|
@@ -481,8 +487,9 @@ export class Text extends Image {
|
|
|
481
487
|
|
|
482
488
|
/**
|
|
483
489
|
* TBD.
|
|
484
|
-
* @param weight
|
|
490
|
+
* @param weight - TBD.
|
|
485
491
|
* @param position - TBD.
|
|
492
|
+
* @returns {Text} TBD.
|
|
486
493
|
*/
|
|
487
494
|
addFontWeight(weight, position) {
|
|
488
495
|
this.fontWeights[position] = weight;
|
|
@@ -643,6 +650,7 @@ export class Text extends Image {
|
|
|
643
650
|
/**
|
|
644
651
|
* TBD.
|
|
645
652
|
* @param font - TBD.
|
|
653
|
+
* @returns {object} TBD.
|
|
646
654
|
*/
|
|
647
655
|
fontToComponents(font) {
|
|
648
656
|
// The format is specified in http://www.w3.org/TR/CSS2/fonts.html#font-shorthand:
|
|
@@ -677,7 +685,7 @@ export class Text extends Image {
|
|
|
677
685
|
|
|
678
686
|
/**
|
|
679
687
|
* TBD.
|
|
680
|
-
* @param components
|
|
688
|
+
* @param components - TBD.
|
|
681
689
|
*/
|
|
682
690
|
componentsToFont(components) {
|
|
683
691
|
const parts = [];
|
|
@@ -712,7 +720,8 @@ export class Text extends Image {
|
|
|
712
720
|
/**
|
|
713
721
|
* TBD.
|
|
714
722
|
* @param text - TBD.
|
|
715
|
-
* @param immediate
|
|
723
|
+
* @param immediate - TBD.
|
|
724
|
+
* @returns {Text} TBD.
|
|
716
725
|
*/
|
|
717
726
|
setText(text, immediate = false) {
|
|
718
727
|
this.text = text.toString() || '';
|
|
@@ -727,6 +736,7 @@ export class Text extends Image {
|
|
|
727
736
|
/**
|
|
728
737
|
* TBD.
|
|
729
738
|
* @param list
|
|
739
|
+
* @returns {Text} TBD.
|
|
730
740
|
*/
|
|
731
741
|
parseList(list) {
|
|
732
742
|
if (!Array.isArray(list)) {
|
|
@@ -757,6 +767,7 @@ export class Text extends Image {
|
|
|
757
767
|
* @param {number} y - TBD.
|
|
758
768
|
* @param {number} width - TBD.
|
|
759
769
|
* @param {number} height - TBD.
|
|
770
|
+
* @returns {Text} TBD.
|
|
760
771
|
*/
|
|
761
772
|
setTextBounds(x, y, width, height) {
|
|
762
773
|
if (x === undefined) {
|
|
@@ -819,7 +830,7 @@ export class Text extends Image {
|
|
|
819
830
|
|
|
820
831
|
/**
|
|
821
832
|
* TBD.
|
|
822
|
-
* @param renderSession - TBD.
|
|
833
|
+
* @param {object} renderSession - TBD.
|
|
823
834
|
*/
|
|
824
835
|
renderWebGL(renderSession) {
|
|
825
836
|
if (this.dirty) {
|
|
@@ -831,7 +842,7 @@ export class Text extends Image {
|
|
|
831
842
|
|
|
832
843
|
/**
|
|
833
844
|
* TBD.
|
|
834
|
-
* @param renderSession - TBD.
|
|
845
|
+
* @param {object} renderSession - TBD.
|
|
835
846
|
*/
|
|
836
847
|
renderCanvas(renderSession) {
|
|
837
848
|
if (this.dirty) {
|
|
@@ -843,6 +854,7 @@ export class Text extends Image {
|
|
|
843
854
|
|
|
844
855
|
/**
|
|
845
856
|
* TBD.
|
|
857
|
+
* @returns {object} TBD.
|
|
846
858
|
*/
|
|
847
859
|
getFontPropertiesCache() {
|
|
848
860
|
if (!window.PhaserRegistry.fontPropertiesCache) {
|
|
@@ -853,6 +865,7 @@ export class Text extends Image {
|
|
|
853
865
|
|
|
854
866
|
/**
|
|
855
867
|
* TBD.
|
|
868
|
+
* @returns {HTMLCanvasElement} TBD.
|
|
856
869
|
*/
|
|
857
870
|
getFontPropertiesCanvas() {
|
|
858
871
|
if (!window.PhaserRegistry.fontPropertiesCanvas) {
|
|
@@ -953,7 +966,7 @@ export class Text extends Image {
|
|
|
953
966
|
|
|
954
967
|
/**
|
|
955
968
|
* TBD.
|
|
956
|
-
* @param matrix - TBD.
|
|
969
|
+
* @param {Matrix} matrix - TBD.
|
|
957
970
|
* @returns {Rectangle} TBD.
|
|
958
971
|
*/
|
|
959
972
|
getBounds(matrix = null) {
|
|
@@ -3,8 +3,8 @@ import { removeByCanvas } from '../canvas/pool';
|
|
|
3
3
|
export class BaseTexture {
|
|
4
4
|
/**
|
|
5
5
|
* TBD.
|
|
6
|
-
* @param source
|
|
7
|
-
* @param scaleMode
|
|
6
|
+
* @param {HTMLCanvasElement} source - TBD.
|
|
7
|
+
* @param {number} scaleMode - TBD.
|
|
8
8
|
*/
|
|
9
9
|
constructor(source, scaleMode) {
|
|
10
10
|
this.resolution = 1;
|
|
@@ -9,7 +9,7 @@ export class WebGLBlendModeManager {
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* TBD.
|
|
12
|
-
* @param gl - TBD.
|
|
12
|
+
* @param {WebGLRenderingContext} gl - TBD.
|
|
13
13
|
*/
|
|
14
14
|
setContext(gl) {
|
|
15
15
|
this.gl = gl;
|
|
@@ -17,7 +17,8 @@ export class WebGLBlendModeManager {
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* TBD.
|
|
20
|
-
* @param blendMode
|
|
20
|
+
* @param {number} blendMode - TBD.
|
|
21
|
+
* @returns {boolean} TBD.
|
|
21
22
|
*/
|
|
22
23
|
setBlendMode(blendMode) {
|
|
23
24
|
if (this.currentBlendMode === blendMode) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export class FastSpriteBatch {
|
|
2
2
|
/**
|
|
3
3
|
* TBD.
|
|
4
|
-
* @param gl - TBD.
|
|
4
|
+
* @param {WebGLRenderingContext} gl - TBD.
|
|
5
5
|
*/
|
|
6
6
|
constructor(gl) {
|
|
7
7
|
this.vertSize = 10;
|
|
@@ -36,7 +36,7 @@ export class FastSpriteBatch {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* TBD.
|
|
39
|
-
* @param gl - TBD.
|
|
39
|
+
* @param {WebGLRenderingContext} gl - TBD.
|
|
40
40
|
*/
|
|
41
41
|
setContext(gl) {
|
|
42
42
|
this.gl = gl;
|
|
@@ -53,8 +53,8 @@ export class FastSpriteBatch {
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* TBD.
|
|
56
|
-
* @param spriteBatch
|
|
57
|
-
* @param renderSession - TBD.
|
|
56
|
+
* @param spriteBatch - TBD.
|
|
57
|
+
* @param {object} renderSession - TBD.
|
|
58
58
|
*/
|
|
59
59
|
begin(spriteBatch, renderSession) {
|
|
60
60
|
this.renderSession = renderSession;
|
|
@@ -72,7 +72,7 @@ export class FastSpriteBatch {
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* TBD.
|
|
75
|
-
* @param spriteBatch
|
|
75
|
+
* @param spriteBatch - TBD.
|
|
76
76
|
*/
|
|
77
77
|
render(spriteBatch) {
|
|
78
78
|
const children = spriteBatch.children;
|
|
@@ -96,7 +96,7 @@ export class FastSpriteBatch {
|
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* TBD.
|
|
99
|
-
* @param sprite
|
|
99
|
+
* @param sprite - TBD.
|
|
100
100
|
*/
|
|
101
101
|
renderSprite(sprite) {
|
|
102
102
|
if (!sprite.visible) {
|