@vpmedia/phaser 1.17.0 → 1.19.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 +4 -4
- package/src/phaser/core/animation.js +3 -2
- package/src/phaser/core/animation_manager.js +3 -2
- package/src/phaser/core/cache.js +38 -17
- 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.js +13 -12
- package/src/phaser/core/input_handler.js +2 -1
- package/src/phaser/core/input_mouse.js +3 -2
- package/src/phaser/core/input_mspointer.js +6 -6
- package/src/phaser/core/input_pointer.js +3 -2
- package/src/phaser/core/loader.js +70 -69
- package/src/phaser/core/scale_manager.js +41 -24
- package/src/phaser/core/scene_manager.js +11 -7
- package/src/phaser/core/signal_binding.js +16 -7
- 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 +66 -45
- package/src/phaser/core/tween_data.js +23 -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 +9 -5
- package/src/phaser/display/canvas/util.js +2 -2
- package/src/phaser/display/display_object.js +35 -16
- package/src/phaser/display/graphics.js +61 -40
- package/src/phaser/display/graphics_data.js +7 -7
- package/src/phaser/display/image.js +19 -12
- package/src/phaser/display/sprite_util.js +3 -2
- package/src/phaser/display/text.js +57 -33
- 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 +8 -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.js +6 -6
- package/src/phaser/display/webgl/graphics_data.js +1 -1
- package/src/phaser/display/webgl/render_texture.js +9 -3
- package/src/phaser/display/webgl/renderer.js +13 -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 +4 -3
- package/src/phaser/display/webgl/sprite_batch.js +10 -7
- package/src/phaser/display/webgl/stencil_manager.js +12 -10
- package/src/phaser/display/webgl/texture.js +8 -6
- package/typedefs/global.d.ts +1 -1
- 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 +69 -45
- 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 +22 -21
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +5 -4
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +1 -1
- package/types/phaser/core/input_mouse.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 +5 -4
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +104 -103
- package/types/phaser/core/loader.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 +16 -11
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +23 -15
- package/types/phaser/core/signal_binding.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 +82 -62
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +31 -23
- 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/button.d.ts +3 -2
- package/types/phaser/display/button.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 +11 -7
- 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 +55 -36
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +71 -53
- 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 +27 -25
- 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 +82 -93
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
- 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 +14 -13
- 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.d.ts +13 -12
- package/types/phaser/display/webgl/graphics.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 +12 -10
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +16 -9
- 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 +12 -12
- 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 +9 -8
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +17 -14
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +17 -15
- 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) {
|
|
@@ -820,8 +841,8 @@ export class Graphics extends DisplayObject {
|
|
|
820
841
|
|
|
821
842
|
/**
|
|
822
843
|
* TBD.
|
|
823
|
-
* @param points - TBD.
|
|
824
|
-
* @param cull - TBD.
|
|
844
|
+
* @param {Point[]} points - TBD.
|
|
845
|
+
* @param {boolean} cull - TBD.
|
|
825
846
|
*/
|
|
826
847
|
drawTriangle(points, cull = false) {
|
|
827
848
|
const triangle = new Polygon(points);
|
|
@@ -840,9 +861,9 @@ export class Graphics extends DisplayObject {
|
|
|
840
861
|
|
|
841
862
|
/**
|
|
842
863
|
* TBD.
|
|
843
|
-
* @param vertices - TBD.
|
|
844
|
-
* @param indices - TBD.
|
|
845
|
-
* @param cull - TBD.
|
|
864
|
+
* @param {number[]|Point[]} vertices - TBD.
|
|
865
|
+
* @param {number[]} indices - 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;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Texture } from './webgl/texture';
|
|
2
2
|
import { AnimationManager } from '../core/animation_manager';
|
|
3
3
|
import { EventManager } from '../core/event_manager';
|
|
4
|
+
import { Frame } from '../core/frame';
|
|
4
5
|
import { Rectangle } from '../geom/rectangle';
|
|
6
|
+
import { Matrix } from '../geom/matrix';
|
|
5
7
|
import { DisplayObject } from './display_object';
|
|
6
8
|
import { Game } from '../core/game';
|
|
7
9
|
import { clone } from '../geom/util/rectangle';
|
|
@@ -96,7 +98,7 @@ export class Image extends DisplayObject {
|
|
|
96
98
|
/**
|
|
97
99
|
* TBD.
|
|
98
100
|
* @param {string} key - TBD.
|
|
99
|
-
* @param frame - TBD.
|
|
101
|
+
* @param {number} frame - TBD.
|
|
100
102
|
* @param {boolean} stopAnimation - TBD.
|
|
101
103
|
*/
|
|
102
104
|
loadTexture(key, frame = 0, stopAnimation = true) {
|
|
@@ -139,7 +141,7 @@ export class Image extends DisplayObject {
|
|
|
139
141
|
|
|
140
142
|
/**
|
|
141
143
|
* TBD.
|
|
142
|
-
* @param frame - TBD.
|
|
144
|
+
* @param {Frame} frame - TBD.
|
|
143
145
|
*/
|
|
144
146
|
setFrame(frame) {
|
|
145
147
|
this._frame = frame;
|
|
@@ -184,7 +186,7 @@ export class Image extends DisplayObject {
|
|
|
184
186
|
|
|
185
187
|
/**
|
|
186
188
|
* TBD.
|
|
187
|
-
* @param parent
|
|
189
|
+
* @param {DisplayObject} parent - TBD.
|
|
188
190
|
* @param {number} width - TBD.
|
|
189
191
|
* @param {number} height - TBD.
|
|
190
192
|
*/
|
|
@@ -204,6 +206,7 @@ export class Image extends DisplayObject {
|
|
|
204
206
|
|
|
205
207
|
/**
|
|
206
208
|
* TBD.
|
|
209
|
+
* @returns {number} TBD.
|
|
207
210
|
*/
|
|
208
211
|
get frame() {
|
|
209
212
|
return this.animations.frame;
|
|
@@ -235,8 +238,8 @@ export class Image extends DisplayObject {
|
|
|
235
238
|
|
|
236
239
|
/**
|
|
237
240
|
* TBD.
|
|
238
|
-
* @param rect
|
|
239
|
-
* @param copy
|
|
241
|
+
* @param {Rectangle} rect - TBD.
|
|
242
|
+
* @param {boolean} copy - TBD.
|
|
240
243
|
*/
|
|
241
244
|
crop(rect, copy = false) {
|
|
242
245
|
if (rect) {
|
|
@@ -289,6 +292,7 @@ export class Image extends DisplayObject {
|
|
|
289
292
|
|
|
290
293
|
/**
|
|
291
294
|
* TBD.
|
|
295
|
+
* @returns {number} TBD.
|
|
292
296
|
*/
|
|
293
297
|
get width() {
|
|
294
298
|
return this.scale.x * this.texture.frame.width;
|
|
@@ -304,6 +308,7 @@ export class Image extends DisplayObject {
|
|
|
304
308
|
|
|
305
309
|
/**
|
|
306
310
|
* TBD.
|
|
311
|
+
* @returns {number} TBD.
|
|
307
312
|
*/
|
|
308
313
|
get height() {
|
|
309
314
|
return this.scale.y * this.texture.frame.height;
|
|
@@ -332,8 +337,8 @@ export class Image extends DisplayObject {
|
|
|
332
337
|
|
|
333
338
|
/**
|
|
334
339
|
* TBD.
|
|
335
|
-
* @param texture
|
|
336
|
-
* @param destroyBase
|
|
340
|
+
* @param {Texture} texture - TBD.
|
|
341
|
+
* @param {boolean} destroyBase - TBD.
|
|
337
342
|
*/
|
|
338
343
|
setTexture(texture, destroyBase = false) {
|
|
339
344
|
setTexture(this, texture, destroyBase);
|
|
@@ -341,7 +346,8 @@ export class Image extends DisplayObject {
|
|
|
341
346
|
|
|
342
347
|
/**
|
|
343
348
|
* TBD.
|
|
344
|
-
* @param matrix - TBD.
|
|
349
|
+
* @param {Matrix} matrix - TBD.
|
|
350
|
+
* @returns {Rectangle} TBD.
|
|
345
351
|
*/
|
|
346
352
|
getBounds(matrix = null) {
|
|
347
353
|
return getBounds(this, matrix);
|
|
@@ -349,6 +355,7 @@ export class Image extends DisplayObject {
|
|
|
349
355
|
|
|
350
356
|
/**
|
|
351
357
|
* TBD.
|
|
358
|
+
* @returns {Rectangle} TBD.
|
|
352
359
|
*/
|
|
353
360
|
getLocalBounds() {
|
|
354
361
|
return getLocalBounds(this);
|
|
@@ -356,8 +363,8 @@ export class Image extends DisplayObject {
|
|
|
356
363
|
|
|
357
364
|
/**
|
|
358
365
|
* TBD.
|
|
359
|
-
* @param renderSession - TBD.
|
|
360
|
-
* @param matrix - TBD.
|
|
366
|
+
* @param {object} renderSession - TBD.
|
|
367
|
+
* @param {Matrix} matrix - TBD.
|
|
361
368
|
*/
|
|
362
369
|
renderWebGL(renderSession, matrix = null) {
|
|
363
370
|
renderWebGL(this, renderSession, matrix);
|
|
@@ -365,8 +372,8 @@ export class Image extends DisplayObject {
|
|
|
365
372
|
|
|
366
373
|
/**
|
|
367
374
|
* TBD.
|
|
368
|
-
* @param renderSession - TBD.
|
|
369
|
-
* @param matrix - TBD.
|
|
375
|
+
* @param {object} renderSession - TBD.
|
|
376
|
+
* @param {Matrix} matrix - TBD.
|
|
370
377
|
*/
|
|
371
378
|
renderCanvas(renderSession, matrix = null) {
|
|
372
379
|
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;
|