-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathpixi.comments.d.ts
2299 lines (1830 loc) · 69.1 KB
/
pixi.comments.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for PIXI with Phaser Deviations.
declare module PIXI {
export var game: Phaser.Game;
export var WEBGL_RENDERER: number;
export var CANVAS_RENDERER: number;
export var VERSION: string;
export enum blendModes {
NORMAL,
ADD,
MULTIPLY,
SCREEN,
OVERLAY,
DARKEN,
LIGHTEN,
COLOR_DODGE,
COLOR_BURN,
HARD_LIGHT,
SOFT_LIGHT,
DIFFERENCE,
EXCLUSION,
HUE,
SATURATION,
COLOR,
LUMINOSITY
}
export enum scaleModes {
DEFAULT,
LINEAR,
NEAREST
}
export var glContexts: WebGLRenderingContext[];
export var instances: any[];
export var TextureSilentFail: boolean;
export function canUseNewCanvasBlendModes(): boolean;
export function CompileFragmentShader(gl: WebGLRenderingContext, shaderSrc: string[]): any;
export interface IEventCallback {
(e?: IEvent): void;
}
export interface IEvent {
type: string;
content: any;
}
export interface HitArea {
contains(x: number, y: number): boolean;
}
export interface IInteractionDataCallback {
(interactionData: InteractionData): void;
}
export interface PixiRenderer {
autoResize: boolean;
clearBeforeRender: boolean;
height: number;
resolution: number;
transparent: boolean;
type: number;
view: HTMLCanvasElement;
width: number;
destroy(): void;
render(stage: DisplayObjectContainer): void;
resize(width: number, height: number): void;
}
export interface PixiRendererOptions {
autoResize?: boolean;
antialias?: boolean;
clearBeforeRender?: boolean;
preserveDrawingBuffer?: boolean;
resolution?: number;
transparent?: boolean;
view?: HTMLCanvasElement;
}
export interface BitmapTextStyle {
font?: string;
align?: string;
tint?: string;
}
export interface TextStyle {
align?: string;
dropShadow?: boolean;
dropShadowColor?: string;
dropShadowAngle?: number;
dropShadowDistance?: number;
fill?: string;
font?: string;
lineJoin?: string;
stroke?: string;
strokeThickness?: number;
wordWrap?: boolean;
wordWrapWidth?: number;
}
export interface Loader {
load(): void;
}
export interface MaskData {
alpha: number;
worldTransform: number[];
}
export interface RenderSession {
context: CanvasRenderingContext2D;
maskManager: CanvasMaskManager;
scaleMode: scaleModes;
smoothProperty: string;
roundPixels: boolean;
}
export interface ShaderAttribute {
// TODO: Find signature of shader attributes
}
export interface FilterBlock {
visible: boolean;
renderable: boolean;
}
// Phaser.Filter is used instead
export class AbstractFilter {
constructor(fragmentSrc: string | string[], uniforms: any);
dirty: boolean;
padding: number;
uniforms: any;
fragmentSrc: string | string[];
apply(frameBuffer: WebGLFramebuffer): void;
syncUniforms(): void;
}
/**
* A texture stores the information that represents an image. All textures have a base texture.
*/
export class BaseTexture implements Mixin {
/**
* Helper function that creates a base texture from the given canvas element.
*
* @param canvas The canvas element source of the texture
* @param scaleMode See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
* @param resolution the resolution of the texture (for HiDPI displays)
*/
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: scaleModes): BaseTexture;
/**
* A texture stores the information that represents an image. All textures have a base texture.
*
* @param source the source object (image or canvas)
* @param scaleMode See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
* @param resolution the resolution of the texture (for HiDPI displays)
*/
constructor(source: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, scaleMode: scaleModes, resolution?: number);
/**
* [read-only] The height of the base texture set when the image has loaded
*/
height: number;
/**
* [read-only] Set to true once the base texture has loaded
*/
hasLoaded: boolean;
/**
* Set this to true if a mipmap of this texture needs to be generated. This value needs to be set before the texture is used
* Also the texture must be a power of two size to work
*/
mipmap: boolean;
/**
* Controls if RGB channels should be pre-multiplied by Alpha (WebGL only)
* Default: true
*/
premultipliedAlpha: boolean;
/**
* The Resolution of the texture.
*/
resolution: number;
/**
* The scale mode to apply when scaling this texture
* Default: PIXI.scaleModes.LINEAR
*/
scaleMode: scaleModes;
/**
* A BaseTexture can be set to skip the rendering phase in the WebGL Sprite Batch.
*
* You may want to do this if you have a parent Sprite with no visible texture (i.e. uses the internal `__default` texture)
* that has children that you do want to render, without causing a batch flush in the process.
*/
skipRender: boolean;
/**
* The image source that is used to create the texture.
*/
source: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement;
/**
* The multi texture batching index number.
*/
textureIndex: number;
/**
* [read-only] The width of the base texture set when the image has loaded
*/
width: number;
_dirty: boolean[];
_glTextures: WebGLTexture[];
listeners(eventName: string): Function[];
emit(eventName: string, data?: any): boolean;
dispatchEvent(eventName: string, data?: any): boolean;
on(eventName: string, fn: Function): Function;
addEventListener(eventName: string, fn: Function): Function;
once(eventName: string, fn: Function): Function;
off(eventName: string, fn: Function): Function;
removeAllEventListeners(eventName: string): void;
/**
* Forces this BaseTexture to be set as loaded, with the given width and height.
* Then calls BaseTexture.dirty.
* Important for when you don't want to modify the source object by forcing in `complete` or dimension properties it may not have.
*
* @param width The new width to force the BaseTexture to be.
* @param height The new height to force the BaseTexture to be.
*/
forceLoaded(width: number, height: number): void;
/**
* Destroys this base texture
*/
destroy(): void;
/**
* Sets all glTextures to be dirty.
*/
dirty(): void;
/**
* Removes the base texture from the GPU, useful for managing resources on the GPU.
* Atexture is still 100% usable and will simply be reuploaded if there is a sprite on screen that is using it.
*/
unloadFromGPU(): void;
}
/**
* Creates a Canvas element of the given size.
*/
export class CanvasBuffer {
/**
* Creates a Canvas element of the given size.
*
* @param width the width for the newly created canvas
* @param height the height for the newly created canvas
*/
constructor(width: number, height: number);
/**
* The Canvas object that belongs to this CanvasBuffer.
*/
canvas: HTMLCanvasElement;
/**
* A CanvasRenderingContext2D object representing a two-dimensional rendering context.
*/
context: CanvasRenderingContext2D;
/**
* The height of the Canvas in pixels.
*/
height: number;
/**
* The width of the Canvas in pixels.
*/
width: number;
/**
* Frees the canvas up for use again.
*/
destroy(): void;
/**
* Clears the canvas that was created by the CanvasBuffer class.
*/
clear(): void;
/**
* Resizes the canvas to the specified width and height.
*
* @param width the new width of the canvas
* @param height the new height of the canvas
*/
resize(width: number, height: number): void;
}
/**
* A set of functions used to handle masking.
*/
export class CanvasMaskManager {
/**
* This method adds it to the current stack of masks.
*
* @param maskData the maskData that will be pushed
* @param renderSession The renderSession whose context will be used for this mask manager.
*/
pushMask(maskData: MaskData, renderSession: RenderSession): void;
/**
* Restores the current drawing context to the state it was before the mask was applied.
*
* @param renderSession The renderSession whose context will be used for this mask manager.
*/
popMask(renderSession: RenderSession): void;
}
/**
* The CanvasRenderer draws the Stage and all its content onto a 2d canvas. This renderer should be used for browsers that do not support webGL.
* Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything :)
*/
export class CanvasRenderer implements PixiRenderer {
/**
* The CanvasRenderer draws the Stage and all its content onto a 2d canvas. This renderer should be used for browsers that do not support webGL.
* Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything :)
*
* @param game A reference to the Phaser Game instance
*/
constructor(game: Phaser.Game);
/**
* A reference to the Phaser Game instance.
*/
game: Phaser.Game;
/**
* The renderer type.
*/
type: number;
/**
* The resolution of the canvas.
*/
resolution: number;
/**
* This sets if the CanvasRenderer will clear the canvas or not before the new render pass.
* If the Stage is NOT transparent Pixi will use a canvas sized fillRect operation every frame to set the canvas background color.
* If the Stage is transparent Pixi will use clearRect to clear the canvas every frame.
* Disable this by setting this to false. For example if your game has a canvas filling background image you often don't need this set.
*/
clearBeforeRender: boolean;
/**
* Whether the render view is transparent
*/
transparent: boolean;
/**
* Whether the render view should be resized automatically
*/
autoResize: boolean;
/**
* The width of the canvas view
* Default: 800
*/
width: number;
/**
* The height of the canvas view
* Default: 600
*/
height: number;
/**
* The canvas element that everything is drawn to.
*/
view: HTMLCanvasElement;
/**
* The canvas 2d context that everything is drawn with
*/
context: CanvasRenderingContext2D;
/**
* Boolean flag controlling canvas refresh.
*/
refresh: boolean;
/**
* Internal var.
*/
count: number;
/**
* Instance of a PIXI.CanvasMaskManager, handles masking when using the canvas renderer
*/
maskManager: CanvasMaskManager;
/**
* The render session is just a bunch of parameter used for rendering
*/
renderSession: RenderSession;
/**
* Renders the DisplayObjectContainer, usually the Phaser.Stage, to this canvas view.
*
* @param root The root element to be rendered.
*/
render(stage: DisplayObjectContainer): void;
postRender(): void;
/**
* Resizes the canvas view to the specified width and height
*
* @param width the new width of the canvas view
* @param height the new height of the canvas view
*/
resize(width: number, height: number): void;
setTexturePriority(textureNameCollection: string[]): string[];
/**
* Removes everything from the renderer and optionally removes the Canvas DOM element.
*
* @param removeView Removes the Canvas element from the DOM. - Default: true
*/
destroy(removeView?: boolean): void;
}
/**
* Utility methods for Sprite/Texture tinting.
*/
export class CanvasTinter {
/**
* Basically this method just needs a sprite and a color and tints the sprite with the given color.
*
* @param sprite the sprite to tint
* @param color the color to use to tint the sprite with
* @return The tinted canvas
*/
static getTintedTexture(sprite: Sprite, color: number): HTMLCanvasElement;
/**
* Tint a texture using the "multiply" operation.
*
* @param texture the texture to tint
* @param color the color to use to tint the sprite with
* @param canvas the current canvas
*/
static tintWithMultiply(texture: Texture, color: number, canvas: HTMLCanvasElement): void;
static tintWithOverlay(texture: Texture, color: number, canvas: HTMLCanvasElement): void;
static tintWithPerPixel(texture: Texture, color: number, canvas: HTMLCanvasElement): void;
static canUseMultiply: boolean;
static tintMethod: any;
}
/**
* The base class for all objects that are rendered. Contains properties for position, scaling,
* rotation, masks and cache handling.
*
* This is an abstract class and should not be used on its own, rather it should be extended.
*
* It is used internally by the likes of PIXI.Sprite.
*/
export class DisplayObject {
/**
* The alpha value of this DisplayObject. A value of 1 is fully opaque. A value of 0 is transparent.
* Please note that an object with an alpha value of 0 is skipped during the render pass.
*
* The value of this property does not reflect any alpha values set further up the display list.
* To obtain that value please see the `worldAlpha` property.
* Default: 1
*/
alpha: number;
buttonMode: boolean;
/**
* Sets if this DisplayObject should be cached as a bitmap.
*
* When invoked it will take a snapshot of the DisplayObject, as it is at that moment, and store it
* in a RenderTexture. This is then used whenever this DisplayObject is rendered. It can provide a
* performance benefit for complex, but static, DisplayObjects. I.e. those with lots of children.
*
* Transparent areas adjoining the edges may be removed ({@link https://github.com/photonstorm/phaser-ce/issues/283 #283}).
*
* Cached Bitmaps do not track their parents. If you update a property of this DisplayObject, it will not
* re-generate the cached bitmap automatically. To do that you need to call `DisplayObject.updateCache`.
*
* To remove a cached bitmap, set this property to `null`. Cache this DisplayObject as a Bitmap. Set to `null` to remove an existing cached bitmap.
*/
cacheAsBitmap: boolean;
defaultCursor: string;
/**
* The rectangular area used by filters when rendering a shader for this DisplayObject.
*/
filterArea: Rectangle;
/**
* Sets the filters for this DisplayObject. This is a WebGL only feature, and is ignored by the Canvas
* Renderer. A filter is a shader applied to this DisplayObject. You can modify the placement of the filter
* using `DisplayObject.filterArea`.
*
* To remove filters, set this property to `null`.
*
* Note: You cannot have a filter set, and a MULTIPLY Blend Mode active, at the same time. Setting a
* filter will reset this DisplayObjects blend mode to NORMAL. An Array of Phaser.Filter objects, or objects that extend them.
*/
filters: AbstractFilter[];
/**
* This is the defined area that will pick up mouse / touch events. It is null by default.
* Setting it is a neat way of optimising the hitTest function that the interactionManager will use (as it will not need to hit test all the children)
*/
hitArea: HitArea;
interactive: boolean;
/**
* Sets a mask for this DisplayObject. A mask is an instance of a Graphics object.
* When applied it limits the visible area of this DisplayObject to the shape of the mask.
* Under a Canvas renderer it uses shape clipping. Under a WebGL renderer it uses a Stencil Buffer.
* To remove a mask, set this property to `null`. The mask applied to this DisplayObject. Set to `null` to remove an existing mask.
*/
mask: Phaser.Graphics;
/**
* The parent DisplayObjectContainer that this DisplayObject is a child of.
* All DisplayObjects must belong to a parent in order to be rendered.
* The root parent is the Stage object. This property is set automatically when the
* DisplayObject is added to, or removed from, a DisplayObjectContainer.
*/
parent: DisplayObjectContainer;
/**
* The pivot point of this DisplayObject that it rotates around. The values are expressed
* in pixel values.
*/
pivot: Point;
/**
* The coordinates, in pixels, of this DisplayObject, relative to its parent container.
*
* The value of this property does not reflect any positioning happening further up the display list.
* To obtain that value please see the `worldPosition` property.
*/
position: Point;
/**
* Should this DisplayObject be rendered by the renderer? An object with a renderable value of
* `false` is skipped during the render pass.
*/
renderable: boolean;
/**
* The rotation of this DisplayObject. The value is given, and expressed, in radians, and is based on
* a right-handed orientation.
*
* The value of this property does not reflect any rotation happening further up the display list.
* To obtain that value please see the `worldRotation` property.
*/
rotation: number;
/**
* The scale of this DisplayObject. A scale of 1:1 represents the DisplayObject
* at its default size. A value of 0.5 would scale this DisplayObject by half, and so on.
*
* The value of this property does not reflect any scaling happening further up the display list.
* To obtain that value please see the `worldScale` property.
*/
scale: Point;
stage: DisplayObjectContainer;
/**
* The visibility of this DisplayObject. A value of `false` makes the object invisible.
* A value of `true` makes it visible.
*
* An object with a visible value of `false` is skipped during the render pass.
* Equally a DisplayObject with visible `false` will not render any of its children.
*
* The value of this property does not reflect any visible values set further up the display list.
* To obtain that value please see the {@link PIXI.DisplayObject#worldVisible worldVisible} property.
*
* Objects that are not {@link PIXI.DisplayObject#worldVisible worldVisible} do not update their {@link PIXI.DisplayObject#worldPosition worldPosition}.
* Default: true
*/
visible: boolean;
/**
* The multiplied alpha value of this DisplayObject. A value of 1 is fully opaque. A value of 0 is transparent.
* This value is the calculated total, based on the alpha values of all parents of this DisplayObjects
* in the display list.
*
* To obtain, and set, the local alpha value, see the `alpha` property.
*
* Note: This property is only updated at the end of the `updateTransform` call, once per render. Until
* that happens this property will contain values based on the previous frame. Be mindful of this if
* accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.
*/
worldAlpha: number;
/**
* The coordinates, in pixels, of this DisplayObject within the world.
*
* This property contains the calculated total, based on the positions of all parents of this
* DisplayObject in the display list.
*
* Note: This property is only updated at the end of the `updateTransform` call, once per render. Until
* that happens this property will contain values based on the previous frame. Be mindful of this if
* accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.
*/
worldPosition: Point;
/**
* The global scale of this DisplayObject.
*
* This property contains the calculated total, based on the scales of all parents of this
* DisplayObject in the display list.
*
* Note: This property is only updated at the end of the `updateTransform` call, once per render. Until
* that happens this property will contain values based on the previous frame. Be mindful of this if
* accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.
*/
worldScale: Point;
/**
* The current transform of this DisplayObject.
*
* This property contains the calculated total, based on the transforms of all parents of this
* DisplayObject in the display list.
*
* Note: This property is only updated at the end of the `updateTransform` call, once per render. Until
* that happens this property will contain values based on the previous frame. Be mindful of this if
* accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.
*/
worldTransform: Matrix;
/**
* The rotation, in radians, of this DisplayObject.
*
* This property contains the calculated total, based on the rotations of all parents of this
* DisplayObject in the display list.
*
* Note: This property is only updated at the end of the `updateTransform` call, once per render. Until
* that happens this property will contain values based on the previous frame. Be mindful of this if
* accessing this property outside of the normal game flow, i.e. from an asynchronous event callback.
*/
worldRotation: number;
/**
* Indicates if this DisplayObject is visible, based on it, and all of its parents, `visible` property values.
*/
worldVisible: boolean;
/**
* The horizontal position of the DisplayObject, in pixels, relative to its parent.
* If you need the world position of the DisplayObject, use `DisplayObject.worldPosition` instead.
*/
x: number;
/**
* The vertical position of the DisplayObject, in pixels, relative to its parent.
* If you need the world position of the DisplayObject, use `DisplayObject.worldPosition` instead.
*/
y: number;
click(e: InteractionData): void;
displayObjectUpdateTransform(parent?: DisplayObjectContainer): void;
/**
* Generates a RenderTexture based on this DisplayObject, which can they be used to texture other Sprites.
* This can be useful if your DisplayObject is static, or complicated, and needs to be reused multiple times.
*
* Please note that no garbage collection takes place on old textures. It is up to you to destroy old textures,
* and references to them, so they don't linger in memory.
*
* @param resolution The resolution of the texture being generated. - Default: 1
* @param scaleMode See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values. - Default: PIXI.scaleModes.DEFAULT
* @param renderer The renderer used to generate the texture.
* @return - A RenderTexture containing an image of this DisplayObject at the time it was invoked.
*/
generateTexture(resolution?: number, scaleMode?: number, renderer?: PixiRenderer | number): Phaser.RenderTexture;
mousedown(e: InteractionData): void;
mouseout(e: InteractionData): void;
mouseover(e: InteractionData): void;
mouseup(e: InteractionData): void;
mousemove(e: InteractionData): void;
mouseupoutside(e: InteractionData): void;
rightclick(e: InteractionData): void;
rightdown(e: InteractionData): void;
rightup(e: InteractionData): void;
rightupoutside(e: InteractionData): void;
setStageReference(stage: DisplayObjectContainer): void;
tap(e: InteractionData): void;
/**
* Calculates the global position of this DisplayObject, based on the position given.
*
* @param position The global position to calculate from.
* @return - A point object representing the position of this DisplayObject based on the global position given.
*/
toGlobal(position: Point): Point;
/**
* Calculates the local position of this DisplayObject, relative to another point.
*
* @param position The world origin to calculate from.
* @param from An optional DisplayObject to calculate the global position from.
* @return - A point object representing the position of this DisplayObject based on the global position given.
*/
toLocal(position: Point, from: DisplayObject): Point;
touchend(e: InteractionData): void;
touchendoutside(e: InteractionData): void;
touchstart(e: InteractionData): void;
touchmove(e: InteractionData): void;
/**
* Updates the transform matrix this DisplayObject uses for rendering.
*
* If the object has no parent, and no parent parameter is provided, it will default to
* Phaser.Game.World as the parent transform to use. If that is unavailable the transform fails to take place.
*
* The `parent` parameter has priority over the actual parent. Use it as a parent override.
* Setting it does **not** change the actual parent of this DisplayObject.
*
* Calling this method updates the `worldTransform`, `worldAlpha`, `worldPosition`, `worldScale`
* and `worldRotation` properties.
*
* If a `transformCallback` has been specified, it is called at the end of this method, and is passed
* the new, updated, worldTransform property, along with the parent transform used.
*
* @param parent Optional parent to calculate this DisplayObjects transform from.
* @return - A reference to this DisplayObject.
*/
updateTransform(parent?: DisplayObjectContainer): void;
/**
* If this DisplayObject has a cached Sprite, this method generates and updates it.
* @return - A reference to this DisplayObject.
*/
updateCache(): void;
}
/**
* A DisplayObjectContainer represents a collection of display objects.
* It is the base class of all display objects that act as a container for other objects.
*/
export class DisplayObjectContainer extends DisplayObject {
/**
* A DisplayObjectContainer represents a collection of display objects.
* It is the base class of all display objects that act as a container for other objects.
*/
constructor();
/**
* [read-only] The array of children of this container.
*/
children: DisplayObject[];
/**
* The height of the displayObjectContainer, setting this will actually modify the scale to achieve the value set
*/
height: number;
/**
* The width of the displayObjectContainer, setting this will actually modify the scale to achieve the value set
*/
width: number;
/**
* If `ignoreChildInput` is `false` it will allow this objects _children_ to be considered as valid for Input events.
*
* If this property is `true` then the children will _not_ be considered as valid for Input events.
*
* Note that this property isn't recursive: only immediate children are influenced, it doesn't scan further down.
*/
ignoreChildInput: boolean;
/**
* Adds a child to the container.
*
* @param child The DisplayObject to add to the container
* @return The child that was added.
*/
addChild(child: DisplayObject): DisplayObject;
/**
* Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown
*
* @param child The child to add
* @param index The index to place the child in
* @return The child that was added.
*/
addChildAt(child: DisplayObject, index: number): DisplayObject;
/**
* Retrieves the global bounds of the displayObjectContainer as a rectangle. The bounds calculation takes all visible children into consideration.
*
* @param targetCoordinateSpace Returns a rectangle that defines the area of the display object relative to the coordinate system of the targetCoordinateSpace object.
* @return The rectangular bounding area
*/
getBounds(targetCoordinateSpace?: DisplayObject | Matrix): Rectangle;
/**
* Returns the child at the specified index
*
* @param index The index to get the child from
* @return The child at the given index, if any.
*/
getChildAt(index: number): DisplayObject;
/**
* Returns the index position of a child DisplayObject instance
*
* @param child The DisplayObject instance to identify
* @return The index position of the child display object to identify
*/
getChildIndex(child: DisplayObject): number;
/**
* Retrieves the non-global local bounds of the displayObjectContainer as a rectangle without any transformations. The calculation takes all visible children into consideration.
* @return The rectangular bounding area
*/
getLocalBounds(): Rectangle;
/**
* Removes a child from the container.
*
* @param child The DisplayObject to remove
* @return The child that was removed.
*/
removeChild(child: DisplayObject): DisplayObject;
/**
* Removes a child from the specified index position.
*
* @param index The index to get the child from
* @return The child that was removed.
*/
removeChildAt(index: number): DisplayObject;
/**
* Removes all children from this container that are within the begin and end indexes.
*
* @param beginIndex The beginning position. Default value is 0.
* @param endIndex The ending position. Default value is size of the container.
*/
removeChildren(beginIndex?: number, endIndex?: number): DisplayObject[];
removeStageReference(): void;
/**
* Changes the position of an existing child in the display object container
*
* @param child The child DisplayObject instance for which you want to change the index number
* @param index The resulting index number for the child display object
*/
setChildIndex(child: DisplayObject, index: number): void;
/**
* Swaps the position of 2 Display Objects within this container.
*
* @param child
* @param child2
*/
swapChildren(child: DisplayObject, child2: DisplayObject): void;
/**
* Determines whether the specified display object is a child of the DisplayObjectContainer instance or the instance itself.
*
* @param child
*/
contains(child: DisplayObject): boolean;
}
export class FilterTexture {
/**
*
*
* @param gl the current WebGL drawing context
* @param width the horizontal range of the filter
* @param height the vertical range of the filter
* @param scaleMode See {{#crossLink "PIXI/scaleModes:property"}}PIXI.scaleModes{{/crossLink}} for possible values
*/
constructor(gl: WebGLRenderingContext, width: number, height: number, scaleMode: scaleModes);
fragmentSrc: string[];
frameBuffer: WebGLFramebuffer;
gl: WebGLRenderingContext;
program: WebGLProgram;
scaleMode: number;
texture: WebGLTexture;
/**
* Clears the filter texture.
*/
clear(): void;
/**
* Resizes the texture to the specified width and height
*
* @param width the new width of the texture
* @param height the new height of the texture
*/
resize(width: number, height: number): void;
/**
* Destroys the filter texture.
*/
destroy(): void;
}
export class ImageLoader implements Mixin {
constructor(url: string, crossorigin?: boolean);
texture: Texture;
listeners(eventName: string): Function[];
emit(eventName: string, data?: any): boolean;
dispatchEvent(eventName: string, data?: any): boolean;