@vpmedia/phaser 1.16.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 +31 -18
- package/src/phaser/core/animation_manager.js +36 -21
- package/src/phaser/core/animation_parser.js +1 -1
- package/src/phaser/core/array_set.js +17 -9
- package/src/phaser/core/cache.js +61 -45
- 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 +21 -21
- package/src/phaser/core/frame_data.js +1 -1
- package/src/phaser/core/game.js +1 -0
- package/src/phaser/core/input.js +37 -20
- package/src/phaser/core/input_handler.js +1 -1
- package/src/phaser/core/input_mouse.js +16 -12
- package/src/phaser/core/input_mspointer.js +7 -7
- package/src/phaser/core/input_pointer.js +26 -17
- package/src/phaser/core/input_touch.js +7 -7
- package/src/phaser/core/loader.js +104 -75
- package/src/phaser/core/raf.js +1 -1
- package/src/phaser/core/scale_manager.js +46 -29
- package/src/phaser/core/scene_manager.js +13 -9
- package/src/phaser/core/sound.js +3 -3
- package/src/phaser/core/sound_manager.js +17 -10
- package/src/phaser/core/sound_sprite.js +7 -4
- package/src/phaser/core/timer.js +38 -26
- package/src/phaser/core/timer_event.js +10 -8
- package/src/phaser/core/tween.js +66 -46
- 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/group.js +28 -20
- package/src/phaser/display/image.js +19 -12
- 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 +43 -30
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +59 -43
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +2 -2
- package/types/phaser/core/array_set.d.ts +24 -16
- package/types/phaser/core/array_set.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +79 -73
- 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 +28 -28
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +2 -2
- package/types/phaser/core/frame_data.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 +51 -34
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +2 -2
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +20 -19
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +15 -15
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +39 -30
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +15 -15
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +118 -92
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +3 -3
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +68 -51
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +18 -13
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +4 -4
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +22 -15
- 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 +47 -35
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +15 -14
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +81 -61
- 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/group.d.ts +38 -30
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +24 -23
- 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
|
@@ -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) {
|
|
@@ -3,10 +3,10 @@ import { SCALE_LINEAR } from '../../core/const';
|
|
|
3
3
|
export class FilterTexture {
|
|
4
4
|
/**
|
|
5
5
|
* TBD.
|
|
6
|
-
* @param gl - TBD.
|
|
6
|
+
* @param {WebGLRenderingContext} gl - TBD.
|
|
7
7
|
* @param {number} width - TBD.
|
|
8
8
|
* @param {number} height - TBD.
|
|
9
|
-
* @param scaleMode
|
|
9
|
+
* @param {number} scaleMode - TBD.
|
|
10
10
|
*/
|
|
11
11
|
constructor(gl, width, height, scaleMode) {
|
|
12
12
|
this.gl = gl;
|
|
@@ -11,9 +11,9 @@ export class RenderTexture extends Texture {
|
|
|
11
11
|
* TBD.
|
|
12
12
|
* @param {number} width - TBD.
|
|
13
13
|
* @param {number} height - TBD.
|
|
14
|
-
* @param renderer
|
|
15
|
-
* @param scaleMode
|
|
16
|
-
* @param resolution
|
|
14
|
+
* @param renderer - TBD.
|
|
15
|
+
* @param {number} scaleMode - TBD.
|
|
16
|
+
* @param {number} resolution - TBD.
|
|
17
17
|
*/
|
|
18
18
|
constructor(width, height, renderer, scaleMode, resolution = 1) {
|
|
19
19
|
const w = width || 100;
|
|
@@ -79,6 +79,7 @@ export class RenderTexture extends Texture {
|
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* TBD.
|
|
82
|
+
* @returns {HTMLImageElement} TBD.
|
|
82
83
|
*/
|
|
83
84
|
getImage() {
|
|
84
85
|
const image = new Image();
|
|
@@ -88,6 +89,7 @@ export class RenderTexture extends Texture {
|
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* TBD.
|
|
92
|
+
* @returns {string} TBD.
|
|
91
93
|
*/
|
|
92
94
|
getBase64() {
|
|
93
95
|
return this.getCanvas().toDataURL();
|
|
@@ -95,8 +97,10 @@ export class RenderTexture extends Texture {
|
|
|
95
97
|
|
|
96
98
|
/**
|
|
97
99
|
* TBD.
|
|
100
|
+
* @returns {HTMLCanvasElement} TBD.
|
|
98
101
|
*/
|
|
99
102
|
getCanvas() {
|
|
100
103
|
// TODO
|
|
104
|
+
return null;
|
|
101
105
|
}
|
|
102
106
|
}
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { remove } from '../canvas/pool';
|
|
23
23
|
import { isPowerOfTwo } from '../../util/math';
|
|
24
24
|
import { Point } from '../../geom/point';
|
|
25
|
+
import { Matrix } from '../../geom/matrix';
|
|
25
26
|
import { WebGLShaderManager } from './shader_manager';
|
|
26
27
|
import { WebGLSpriteBatch } from './sprite_batch';
|
|
27
28
|
import * as WebGLMaskManager from './mask_manager';
|
|
@@ -39,6 +40,7 @@ export class WebGLRenderer {
|
|
|
39
40
|
this.type = RENDER_WEBGL;
|
|
40
41
|
this.resolution = game.config.resolution;
|
|
41
42
|
this.autoResize = false;
|
|
43
|
+
this.contextLost = false;
|
|
42
44
|
this.clearBeforeRender = game.config.clearBeforeRender;
|
|
43
45
|
this.width = game.width;
|
|
44
46
|
this.height = game.height;
|
|
@@ -152,7 +154,7 @@ export class WebGLRenderer {
|
|
|
152
154
|
|
|
153
155
|
/**
|
|
154
156
|
* TBD.
|
|
155
|
-
* @param stage
|
|
157
|
+
* @param stage - TBD.
|
|
156
158
|
*/
|
|
157
159
|
render(stage) {
|
|
158
160
|
if (this.contextLost) {
|
|
@@ -174,10 +176,10 @@ export class WebGLRenderer {
|
|
|
174
176
|
|
|
175
177
|
/**
|
|
176
178
|
* TBD.
|
|
177
|
-
* @param displayObject
|
|
178
|
-
* @param projection
|
|
179
|
-
* @param buffer
|
|
180
|
-
* @param matrix - TBD.
|
|
179
|
+
* @param displayObject - TBD.
|
|
180
|
+
* @param projection - TBD.
|
|
181
|
+
* @param buffer - TBD.
|
|
182
|
+
* @param {Matrix} matrix - TBD.
|
|
181
183
|
*/
|
|
182
184
|
renderDisplayObject(displayObject, projection, buffer, matrix) {
|
|
183
185
|
this.renderSession.blendModeManager.setBlendMode(BLEND_NORMAL);
|
|
@@ -220,7 +222,8 @@ export class WebGLRenderer {
|
|
|
220
222
|
|
|
221
223
|
/**
|
|
222
224
|
* TBD.
|
|
223
|
-
* @param texture
|
|
225
|
+
* @param texture - TBD.
|
|
226
|
+
* @returns {boolean} TBD.
|
|
224
227
|
*/
|
|
225
228
|
updateTexture(texture) {
|
|
226
229
|
if (!texture.hasLoaded) {
|
|
@@ -26,7 +26,7 @@ const defaultVertexSrc = [
|
|
|
26
26
|
export class NormalShader {
|
|
27
27
|
/**
|
|
28
28
|
* TBD.
|
|
29
|
-
* @param gl - TBD.
|
|
29
|
+
* @param {WebGLRenderingContext} gl - TBD.
|
|
30
30
|
*/
|
|
31
31
|
constructor(gl) {
|
|
32
32
|
this.gl = gl;
|
|
@@ -131,7 +131,7 @@ export class NormalShader {
|
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* TBD.
|
|
134
|
-
* @param uniform
|
|
134
|
+
* @param uniform - TBD.
|
|
135
135
|
*/
|
|
136
136
|
initSampler2D(uniform) {
|
|
137
137
|
if (!uniform.value || !uniform.value.baseTexture || !uniform.value.baseTexture.hasLoaded) {
|
|
@@ -26,7 +26,7 @@ export class WebGLShaderManager {
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* TBD.
|
|
29
|
-
* @param gl - TBD.
|
|
29
|
+
* @param {WebGLRenderingContext} gl - TBD.
|
|
30
30
|
*/
|
|
31
31
|
setContext(gl) {
|
|
32
32
|
this.gl = gl;
|
|
@@ -40,7 +40,7 @@ export class WebGLShaderManager {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* TBD.
|
|
43
|
-
* @param attribs
|
|
43
|
+
* @param attribs - TBD.
|
|
44
44
|
*/
|
|
45
45
|
setAttribs(attribs) {
|
|
46
46
|
// reset temp state
|
|
@@ -68,7 +68,7 @@ export class WebGLShaderManager {
|
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* TBD.
|
|
71
|
-
* @param shader
|
|
71
|
+
* @param shader - TBD.
|
|
72
72
|
*/
|
|
73
73
|
setShader(shader) {
|
|
74
74
|
if (this._currentId === shader._UID) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AbstractFilter } from './abstract_filter';
|
|
2
2
|
import { NormalShader } from './shader/normal';
|
|
3
|
+
import { BaseTexture } from './base_texture';
|
|
4
|
+
import { Matrix } from '../../geom/matrix';
|
|
3
5
|
|
|
4
6
|
export class WebGLSpriteBatch {
|
|
5
7
|
/**
|
|
@@ -46,7 +48,7 @@ export class WebGLSpriteBatch {
|
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
50
|
* TBD.
|
|
49
|
-
* @param gl - TBD.
|
|
51
|
+
* @param {WebGLRenderingContext} gl - TBD.
|
|
50
52
|
*/
|
|
51
53
|
setContext(gl) {
|
|
52
54
|
this.gl = gl;
|
|
@@ -69,7 +71,7 @@ export class WebGLSpriteBatch {
|
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
73
|
* TBD.
|
|
72
|
-
* @param renderSession - TBD.
|
|
74
|
+
* @param {object} renderSession - TBD.
|
|
73
75
|
*/
|
|
74
76
|
begin(renderSession) {
|
|
75
77
|
this.renderSession = renderSession;
|
|
@@ -86,8 +88,8 @@ export class WebGLSpriteBatch {
|
|
|
86
88
|
|
|
87
89
|
/**
|
|
88
90
|
* TBD.
|
|
89
|
-
* @param sprite
|
|
90
|
-
* @param matrix - TBD.
|
|
91
|
+
* @param sprite - TBD.
|
|
92
|
+
* @param {Matrix} matrix - TBD.
|
|
91
93
|
*/
|
|
92
94
|
render(sprite, matrix) {
|
|
93
95
|
const texture = sprite.texture;
|
|
@@ -294,9 +296,9 @@ export class WebGLSpriteBatch {
|
|
|
294
296
|
|
|
295
297
|
/**
|
|
296
298
|
* TBD.
|
|
297
|
-
* @param texture
|
|
298
|
-
* @param size
|
|
299
|
-
* @param startIndex
|
|
299
|
+
* @param {BaseTexture} texture - TBD.
|
|
300
|
+
* @param {number} size - TBD.
|
|
301
|
+
* @param {number} startIndex - TBD.
|
|
300
302
|
*/
|
|
301
303
|
renderBatch(texture, size, startIndex) {
|
|
302
304
|
if (size === 0) {
|
|
@@ -12,7 +12,7 @@ export class WebGLStencilManager {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* TBD.
|
|
15
|
-
* @param gl - TBD.
|
|
15
|
+
* @param {WebGLRenderingContext} gl - TBD.
|
|
16
16
|
*/
|
|
17
17
|
setContext(gl) {
|
|
18
18
|
this.gl = gl;
|
|
@@ -29,8 +29,8 @@ export class WebGLStencilManager {
|
|
|
29
29
|
/**
|
|
30
30
|
* TBD.
|
|
31
31
|
* @param graphics - TBD.
|
|
32
|
-
* @param webGLData
|
|
33
|
-
* @param renderSession - TBD.
|
|
32
|
+
* @param webGLData - TBD.
|
|
33
|
+
* @param {object} renderSession - TBD.
|
|
34
34
|
*/
|
|
35
35
|
pushStencil(graphics, webGLData, renderSession) {
|
|
36
36
|
const gl = renderSession.gl;
|
|
@@ -87,8 +87,8 @@ export class WebGLStencilManager {
|
|
|
87
87
|
/**
|
|
88
88
|
* TBD.
|
|
89
89
|
* @param graphics - TBD.
|
|
90
|
-
* @param webGLData
|
|
91
|
-
* @param renderSession - TBD.
|
|
90
|
+
* @param webGLData - TBD.
|
|
91
|
+
* @param {object} renderSession - TBD.
|
|
92
92
|
*/
|
|
93
93
|
bindGraphics(graphics, webGLData, renderSession) {
|
|
94
94
|
// if(this._currentGraphics === graphics)return;
|
|
@@ -134,8 +134,8 @@ export class WebGLStencilManager {
|
|
|
134
134
|
/**
|
|
135
135
|
* TBD.
|
|
136
136
|
* @param graphics - TBD.
|
|
137
|
-
* @param webGLData
|
|
138
|
-
* @param renderSession - TBD.
|
|
137
|
+
* @param webGLData - TBD.
|
|
138
|
+
* @param {object} renderSession - TBD.
|
|
139
139
|
*/
|
|
140
140
|
popStencil(graphics, webGLData, renderSession) {
|
|
141
141
|
const gl = renderSession.gl;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Rectangle } from '../../geom/rectangle';
|
|
2
|
+
import { BaseTexture } from './base_texture';
|
|
2
3
|
|
|
3
4
|
export class TextureUvs {
|
|
4
5
|
/**
|
|
@@ -19,10 +20,10 @@ export class TextureUvs {
|
|
|
19
20
|
export class Texture {
|
|
20
21
|
/**
|
|
21
22
|
* TBD.
|
|
22
|
-
* @param baseTexture - TBD.
|
|
23
|
-
* @param frame - TBD.
|
|
24
|
-
* @param crop - TBD.
|
|
25
|
-
* @param trim - TBD.
|
|
23
|
+
* @param {BaseTexture} baseTexture - TBD.
|
|
24
|
+
* @param {Rectangle} frame - TBD.
|
|
25
|
+
* @param {Rectangle} crop - TBD.
|
|
26
|
+
* @param {Rectangle} trim - TBD.
|
|
26
27
|
*/
|
|
27
28
|
constructor(baseTexture, frame, crop, trim) {
|
|
28
29
|
this.noFrame = false;
|
|
@@ -64,7 +65,7 @@ export class Texture {
|
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
67
|
* TBD.
|
|
67
|
-
* @param destroyBase - TBD.
|
|
68
|
+
* @param {boolean} destroyBase - TBD.
|
|
68
69
|
*/
|
|
69
70
|
destroy(destroyBase = false) {
|
|
70
71
|
if (destroyBase) {
|
|
@@ -75,7 +76,8 @@ export class Texture {
|
|
|
75
76
|
|
|
76
77
|
/**
|
|
77
78
|
* TBD.
|
|
78
|
-
* @param frame - TBD.
|
|
79
|
+
* @param {Rectangle} frame - TBD.
|
|
80
|
+
* @throws Error.
|
|
79
81
|
*/
|
|
80
82
|
setFrame(frame) {
|
|
81
83
|
this.noFrame = false;
|