2015-06-13 16:41:28 +00:00
|
|
|
// Type definitions for PIXI with Phaser Deviations.
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
declare module PIXI {
|
|
|
|
|
2016-02-02 23:30:03 +00:00
|
|
|
export var game: Phaser.Game;
|
2014-11-05 18:19:45 +00:00
|
|
|
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 defaultRenderOptions: PixiRendererOptions;
|
|
|
|
|
|
|
|
export var INTERACTION_REQUENCY: number;
|
|
|
|
export var AUTO_PREVENT_DEFAULT: boolean;
|
|
|
|
|
|
|
|
export var PI_2: number;
|
|
|
|
export var RAD_TO_DEG: number;
|
|
|
|
export var DEG_TO_RAD: number;
|
|
|
|
|
|
|
|
export var RETINA_PREFIX: string;
|
|
|
|
export var identityMatrix: Matrix;
|
|
|
|
export var glContexts: WebGLRenderingContext[];
|
2014-11-14 20:16:46 +00:00
|
|
|
export var instances: any[];
|
2014-11-05 18:19:45 +00:00
|
|
|
|
2015-05-25 16:08:07 +00:00
|
|
|
export var TextureSilentFail: boolean;
|
2015-06-13 16:41:28 +00:00
|
|
|
export var BitmapText: { fonts: {} };
|
2014-11-05 18:19:45 +00:00
|
|
|
|
2014-12-02 13:31:07 +00:00
|
|
|
export function isPowerOfTwo(width: number, height: number): boolean;
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
export function rgb2hex(rgb: number[]): string;
|
|
|
|
export function hex2rgb(hex: string): number[];
|
|
|
|
|
|
|
|
export function autoDetectRenderer(width?: number, height?: number, options?: PixiRendererOptions): PixiRenderer;
|
|
|
|
export function autoDetectRecommendedRenderer(width?: number, height?: number, options?: PixiRendererOptions): PixiRenderer;
|
|
|
|
|
|
|
|
export function canUseNewCanvasBlendModes(): boolean;
|
2016-06-17 01:28:57 +00:00
|
|
|
export function getNextPowerOfTwo(value: number): number;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
export function AjaxRequest(): XMLHttpRequest;
|
|
|
|
|
|
|
|
export function CompileFragmentShader(gl: WebGLRenderingContext, shaderSrc: string[]): any;
|
|
|
|
export function CompileProgram(gl: WebGLRenderingContext, vertexSrc: string[], fragmentSrc: string[]): any;
|
|
|
|
|
|
|
|
|
|
|
|
export interface IEventCallback {
|
2016-06-17 01:28:57 +00:00
|
|
|
(e?: IEvent): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IEvent {
|
|
|
|
type: string;
|
|
|
|
content: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface HitArea {
|
|
|
|
contains(x: number, y: number): boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IInteractionDataCallback {
|
2016-06-17 01:28:57 +00:00
|
|
|
(interactionData: InteractionData): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface PixiRenderer {
|
|
|
|
|
2014-11-14 20:16:46 +00:00
|
|
|
autoResize: boolean;
|
2015-01-10 02:51:16 +00:00
|
|
|
clearBeforeRender: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
height: number;
|
2015-01-10 02:51:16 +00:00
|
|
|
resolution: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
transparent: boolean;
|
|
|
|
type: number;
|
|
|
|
view: HTMLCanvasElement;
|
2015-01-10 02:51:16 +00:00
|
|
|
width: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
2015-01-10 02:51:16 +00:00
|
|
|
destroy(): void;
|
2016-02-02 23:30:03 +00:00
|
|
|
render(stage: DisplayObjectContainer): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
resize(width: number, height: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PixiRendererOptions {
|
|
|
|
|
2014-11-14 20:16:46 +00:00
|
|
|
autoResize?: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
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;
|
2015-03-24 21:27:20 +00:00
|
|
|
lineJoin?: string;
|
2014-11-05 18:19:45 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AbstractFilter {
|
|
|
|
|
2015-07-17 00:08:45 +00:00
|
|
|
constructor(fragmentSrc: string | string[], uniforms: any);
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
dirty: boolean;
|
|
|
|
padding: number;
|
|
|
|
uniforms: any;
|
2015-07-17 00:08:45 +00:00
|
|
|
fragmentSrc: string | string[];
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
apply(frameBuffer: WebGLFramebuffer): void;
|
|
|
|
syncUniforms(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AlphaMaskFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
constructor(texture: Texture);
|
|
|
|
|
|
|
|
map: Texture;
|
|
|
|
|
|
|
|
onTextureLoaded(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AsciiFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
size: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AssetLoader implements Mixin {
|
|
|
|
|
|
|
|
assetURLs: string[];
|
|
|
|
crossorigin: boolean;
|
|
|
|
loadersByType: { [key: string]: Loader };
|
|
|
|
|
|
|
|
constructor(assetURLs: string[], crossorigin: boolean);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
load(): void;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AtlasLoader implements Mixin {
|
|
|
|
|
|
|
|
url: string;
|
|
|
|
baseUrl: string;
|
|
|
|
crossorigin: boolean;
|
|
|
|
loaded: boolean;
|
|
|
|
|
|
|
|
constructor(url: string, crossorigin: boolean);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
load(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BaseTexture implements Mixin {
|
|
|
|
|
|
|
|
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: scaleModes): BaseTexture;
|
|
|
|
|
|
|
|
constructor(source: HTMLImageElement, scaleMode: scaleModes);
|
|
|
|
constructor(source: HTMLCanvasElement, scaleMode: scaleModes);
|
|
|
|
|
|
|
|
height: number;
|
|
|
|
hasLoaded: boolean;
|
2014-12-02 13:31:07 +00:00
|
|
|
mipmap: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
premultipliedAlpha: boolean;
|
|
|
|
resolution: number;
|
|
|
|
scaleMode: scaleModes;
|
2015-10-15 11:06:38 +00:00
|
|
|
skipRender: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
source: HTMLImageElement;
|
2016-09-21 22:10:46 +00:00
|
|
|
textureIndex: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
width: number;
|
|
|
|
|
|
|
|
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;
|
2015-05-09 01:55:12 +00:00
|
|
|
forceLoaded(width: number, height: number): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
destroy(): void;
|
|
|
|
dirty(): void;
|
|
|
|
unloadFromGPU(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BitmapFontLoader implements Mixin {
|
|
|
|
|
|
|
|
constructor(url: string, crossorigin: boolean);
|
|
|
|
|
|
|
|
baseUrl: string;
|
|
|
|
crossorigin: boolean;
|
|
|
|
texture: Texture;
|
|
|
|
url: string;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
load(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlurFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
blur: number;
|
|
|
|
blurX: number;
|
|
|
|
blurY: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlurXFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
blur: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BlurYFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
blur: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CanvasBuffer {
|
|
|
|
|
|
|
|
constructor(width: number, height: number);
|
|
|
|
|
|
|
|
canvas: HTMLCanvasElement;
|
|
|
|
context: CanvasRenderingContext2D;
|
|
|
|
height: number;
|
|
|
|
width: number;
|
|
|
|
|
2015-08-26 18:07:56 +00:00
|
|
|
destroy(): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
clear(): void;
|
|
|
|
resize(width: number, height: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-08-26 18:07:56 +00:00
|
|
|
export class CanvasPool {
|
|
|
|
|
|
|
|
static create(parent: HTMLElement, width?: number, height?: number): HTMLCanvasElement;
|
|
|
|
static getFirst(): HTMLCanvasElement;
|
|
|
|
static remove(parent: HTMLElement): void;
|
|
|
|
static removeByCanvas(canvas: HTMLCanvasElement): HTMLCanvasElement;
|
|
|
|
static getTotal(): number;
|
|
|
|
static getFree(): number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
export class CanvasMaskManager {
|
|
|
|
|
|
|
|
pushMask(maskData: MaskData, renderSession: RenderSession): void;
|
|
|
|
popMask(renderSession: RenderSession): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CanvasRenderer implements PixiRenderer {
|
|
|
|
|
2016-02-02 23:30:03 +00:00
|
|
|
constructor(game: Phaser.Game);
|
2014-11-05 18:19:45 +00:00
|
|
|
|
2016-02-02 23:30:03 +00:00
|
|
|
game: Phaser.Game;
|
|
|
|
type: number;
|
|
|
|
resolution: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
clearBeforeRender: boolean;
|
2016-02-02 23:30:03 +00:00
|
|
|
transparent: boolean;
|
|
|
|
autoResize: boolean;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
view: HTMLCanvasElement;
|
2014-11-05 18:19:45 +00:00
|
|
|
context: CanvasRenderingContext2D;
|
2016-02-02 23:30:03 +00:00
|
|
|
refresh: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
count: number;
|
|
|
|
maskManager: CanvasMaskManager;
|
|
|
|
renderSession: RenderSession;
|
|
|
|
|
2016-02-02 23:30:03 +00:00
|
|
|
render(stage: DisplayObjectContainer): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
resize(width: number, height: number): void;
|
2016-02-02 23:30:03 +00:00
|
|
|
destroy(removeView?: boolean): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CanvasTinter {
|
|
|
|
|
|
|
|
static getTintedTexture(sprite: Sprite, color: number): HTMLCanvasElement;
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Circle implements HitArea {
|
|
|
|
|
|
|
|
constructor(x: number, y: number, radius: number);
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
radius: number;
|
|
|
|
|
|
|
|
clone(): Circle;
|
|
|
|
contains(x: number, y: number): boolean;
|
|
|
|
getBounds(): Rectangle;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ColorMatrixFilter extends AbstractFilter {
|
2016-06-17 01:28:57 +00:00
|
|
|
|
2016-05-22 07:58:10 +00:00
|
|
|
constructor();
|
2016-06-17 01:28:57 +00:00
|
|
|
|
2016-05-22 07:58:10 +00:00
|
|
|
matrix: number[];
|
2016-06-17 01:28:57 +00:00
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export class ColorStepFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
step: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ConvolutionFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
constructor(matrix: number[], width: number, height: number);
|
|
|
|
|
|
|
|
matrix: Matrix;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CrossHatchFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
blur: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class DisplacementFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
constructor(texture: Texture);
|
|
|
|
|
|
|
|
map: Texture;
|
|
|
|
offset: Point;
|
|
|
|
scale: Point;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class DotScreenFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
angle: number;
|
|
|
|
scale: Point;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class DisplayObject {
|
|
|
|
|
|
|
|
alpha: number;
|
|
|
|
buttonMode: boolean;
|
|
|
|
cacheAsBitmap: boolean;
|
|
|
|
defaultCursor: string;
|
|
|
|
filterArea: Rectangle;
|
|
|
|
filters: AbstractFilter[];
|
|
|
|
hitArea: HitArea;
|
|
|
|
interactive: boolean;
|
|
|
|
mask: Graphics;
|
|
|
|
parent: DisplayObjectContainer;
|
|
|
|
pivot: Point;
|
|
|
|
position: Point;
|
|
|
|
renderable: boolean;
|
|
|
|
rotation: number;
|
|
|
|
scale: Point;
|
2016-02-02 23:30:03 +00:00
|
|
|
stage: DisplayObjectContainer;
|
2014-11-05 18:19:45 +00:00
|
|
|
visible: boolean;
|
|
|
|
worldAlpha: number;
|
2016-06-17 11:46:47 +00:00
|
|
|
worldPosition: Point;
|
|
|
|
worldScale: Point;
|
|
|
|
worldTransform: Matrix;
|
2015-05-09 01:55:12 +00:00
|
|
|
worldRotation: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
worldVisible: boolean;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
|
|
|
|
click(e: InteractionData): void;
|
Fix for PIXI's DisplayObject/DisplayObjectContainer - getting correct dimensions and bounds
With the previous fix what the getBounds did was:
1) if targetCoordinateSpace is the same instance as the caller of
getBounds(), then it will return the bounds of the caller without any
transformations;
2) if targetCoordinateSpace is null/undefined it will return the global
bounds of the caller.
3) if targetCoordinateSpace is any valid DisplayObject it will return
the local bounds of the caller.
What this fix does is fixing 3) along with other obsolete code that
wasn't necessary so I reverted it.
So now if the targetCoordinateSpace is a valid DisplayObject:
- if it's a parent of the caller at some level it will return the bounds
relative to it
- if it's not parenting the caller at all it will get global bounds of
it and the caller and will calculate the x and y bounds of the caller
relative to the targetCoordinateSpace DisplayObject
Also I have fixed how empty groups are treated when they have no other
children except groups, so now calculations are correct. They obviously
have 0 width and height but are still being positioned and other things
could possibly relate to that bounds and it didn't make sense to me to
ignore them.
Also added a DisplayObjectContainer.contains(child) method which
determines whether the specified display object is a child of the
DisplayObjectContainer instance or the instance itself. This method is
used in the new getBounds function.
Corrected DisplayObject's default _bounds rect from (0, 0, 1, 1), to (0,
0, 0, 0) - it doesn't seem to break anything and also in the getBounds
before the fix, when there were no children it assigned a (0, 0, 0, 0)
rectangle to it so I am pretty sure it's safe to correct it.
2016-07-20 23:14:10 +00:00
|
|
|
displayObjectUpdateTransform(parent?: DisplayObjectContainer): void;
|
2016-06-17 10:52:46 +00:00
|
|
|
generateTexture(resolution?: number, scaleMode?: number, renderer?: PixiRenderer | number): RenderTexture;
|
2014-11-05 18:19:45 +00:00
|
|
|
mousedown(e: InteractionData): void;
|
|
|
|
mouseout(e: InteractionData): void;
|
|
|
|
mouseover(e: InteractionData): void;
|
|
|
|
mouseup(e: InteractionData): void;
|
2014-11-10 21:15:52 +00:00
|
|
|
mousemove(e: InteractionData): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
mouseupoutside(e: InteractionData): void;
|
|
|
|
rightclick(e: InteractionData): void;
|
|
|
|
rightdown(e: InteractionData): void;
|
|
|
|
rightup(e: InteractionData): void;
|
|
|
|
rightupoutside(e: InteractionData): void;
|
2016-02-02 23:30:03 +00:00
|
|
|
setStageReference(stage: DisplayObjectContainer): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
tap(e: InteractionData): void;
|
|
|
|
toGlobal(position: Point): Point;
|
|
|
|
toLocal(position: Point, from: DisplayObject): Point;
|
|
|
|
touchend(e: InteractionData): void;
|
|
|
|
touchendoutside(e: InteractionData): void;
|
|
|
|
touchstart(e: InteractionData): void;
|
|
|
|
touchmove(e: InteractionData): void;
|
Fix for PIXI's DisplayObject/DisplayObjectContainer - getting correct dimensions and bounds
With the previous fix what the getBounds did was:
1) if targetCoordinateSpace is the same instance as the caller of
getBounds(), then it will return the bounds of the caller without any
transformations;
2) if targetCoordinateSpace is null/undefined it will return the global
bounds of the caller.
3) if targetCoordinateSpace is any valid DisplayObject it will return
the local bounds of the caller.
What this fix does is fixing 3) along with other obsolete code that
wasn't necessary so I reverted it.
So now if the targetCoordinateSpace is a valid DisplayObject:
- if it's a parent of the caller at some level it will return the bounds
relative to it
- if it's not parenting the caller at all it will get global bounds of
it and the caller and will calculate the x and y bounds of the caller
relative to the targetCoordinateSpace DisplayObject
Also I have fixed how empty groups are treated when they have no other
children except groups, so now calculations are correct. They obviously
have 0 width and height but are still being positioned and other things
could possibly relate to that bounds and it didn't make sense to me to
ignore them.
Also added a DisplayObjectContainer.contains(child) method which
determines whether the specified display object is a child of the
DisplayObjectContainer instance or the instance itself. This method is
used in the new getBounds function.
Corrected DisplayObject's default _bounds rect from (0, 0, 1, 1), to (0,
0, 0, 0) - it doesn't seem to break anything and also in the getBounds
before the fix, when there were no children it assigned a (0, 0, 0, 0)
rectangle to it so I am pretty sure it's safe to correct it.
2016-07-20 23:14:10 +00:00
|
|
|
updateTransform(parent?: DisplayObjectContainer): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class DisplayObjectContainer extends DisplayObject {
|
|
|
|
|
|
|
|
constructor();
|
|
|
|
|
|
|
|
children: DisplayObject[];
|
|
|
|
height: number;
|
|
|
|
width: number;
|
2016-06-09 15:29:09 +00:00
|
|
|
ignoreChildInput: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
addChild(child: DisplayObject): DisplayObject;
|
|
|
|
addChildAt(child: DisplayObject, index: number): DisplayObject;
|
Fix for PIXI's DisplayObject/DisplayObjectContainer - getting correct dimensions and bounds
With the previous fix what the getBounds did was:
1) if targetCoordinateSpace is the same instance as the caller of
getBounds(), then it will return the bounds of the caller without any
transformations;
2) if targetCoordinateSpace is null/undefined it will return the global
bounds of the caller.
3) if targetCoordinateSpace is any valid DisplayObject it will return
the local bounds of the caller.
What this fix does is fixing 3) along with other obsolete code that
wasn't necessary so I reverted it.
So now if the targetCoordinateSpace is a valid DisplayObject:
- if it's a parent of the caller at some level it will return the bounds
relative to it
- if it's not parenting the caller at all it will get global bounds of
it and the caller and will calculate the x and y bounds of the caller
relative to the targetCoordinateSpace DisplayObject
Also I have fixed how empty groups are treated when they have no other
children except groups, so now calculations are correct. They obviously
have 0 width and height but are still being positioned and other things
could possibly relate to that bounds and it didn't make sense to me to
ignore them.
Also added a DisplayObjectContainer.contains(child) method which
determines whether the specified display object is a child of the
DisplayObjectContainer instance or the instance itself. This method is
used in the new getBounds function.
Corrected DisplayObject's default _bounds rect from (0, 0, 1, 1), to (0,
0, 0, 0) - it doesn't seem to break anything and also in the getBounds
before the fix, when there were no children it assigned a (0, 0, 0, 0)
rectangle to it so I am pretty sure it's safe to correct it.
2016-07-20 23:14:10 +00:00
|
|
|
getBounds(targetCoordinateSpace?: DisplayObject | Matrix): Rectangle;
|
2014-11-05 18:19:45 +00:00
|
|
|
getChildAt(index: number): DisplayObject;
|
|
|
|
getChildIndex(child: DisplayObject): number;
|
|
|
|
getLocalBounds(): Rectangle;
|
|
|
|
removeChild(child: DisplayObject): DisplayObject;
|
|
|
|
removeChildAt(index: number): DisplayObject;
|
|
|
|
removeChildren(beginIndex?: number, endIndex?: number): DisplayObject[];
|
|
|
|
removeStageReference(): void;
|
|
|
|
setChildIndex(child: DisplayObject, index: number): void;
|
|
|
|
swapChildren(child: DisplayObject, child2: DisplayObject): void;
|
Fix for PIXI's DisplayObject/DisplayObjectContainer - getting correct dimensions and bounds
With the previous fix what the getBounds did was:
1) if targetCoordinateSpace is the same instance as the caller of
getBounds(), then it will return the bounds of the caller without any
transformations;
2) if targetCoordinateSpace is null/undefined it will return the global
bounds of the caller.
3) if targetCoordinateSpace is any valid DisplayObject it will return
the local bounds of the caller.
What this fix does is fixing 3) along with other obsolete code that
wasn't necessary so I reverted it.
So now if the targetCoordinateSpace is a valid DisplayObject:
- if it's a parent of the caller at some level it will return the bounds
relative to it
- if it's not parenting the caller at all it will get global bounds of
it and the caller and will calculate the x and y bounds of the caller
relative to the targetCoordinateSpace DisplayObject
Also I have fixed how empty groups are treated when they have no other
children except groups, so now calculations are correct. They obviously
have 0 width and height but are still being positioned and other things
could possibly relate to that bounds and it didn't make sense to me to
ignore them.
Also added a DisplayObjectContainer.contains(child) method which
determines whether the specified display object is a child of the
DisplayObjectContainer instance or the instance itself. This method is
used in the new getBounds function.
Corrected DisplayObject's default _bounds rect from (0, 0, 1, 1), to (0,
0, 0, 0) - it doesn't seem to break anything and also in the getBounds
before the fix, when there were no children it assigned a (0, 0, 0, 0)
rectangle to it so I am pretty sure it's safe to correct it.
2016-07-20 23:14:10 +00:00
|
|
|
contains(child: DisplayObject): boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Ellipse implements HitArea {
|
|
|
|
|
|
|
|
constructor(x: number, y: number, width: number, height: number);
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
|
|
|
|
clone(): Ellipse;
|
|
|
|
contains(x: number, y: number): boolean;
|
|
|
|
getBounds(): Rectangle;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Event {
|
|
|
|
|
|
|
|
constructor(target: any, name: string, data: any);
|
|
|
|
|
|
|
|
target: any;
|
|
|
|
type: string;
|
|
|
|
data: any;
|
|
|
|
timeStamp: number;
|
|
|
|
|
|
|
|
stopPropagation(): void;
|
|
|
|
preventDefault(): void;
|
|
|
|
stopImmediatePropagation(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class EventTarget {
|
|
|
|
|
|
|
|
static mixin(obj: any): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class FilterTexture {
|
|
|
|
|
|
|
|
constructor(gl: WebGLRenderingContext, width: number, height: number, scaleMode: scaleModes);
|
|
|
|
|
|
|
|
fragmentSrc: string[];
|
|
|
|
frameBuffer: WebGLFramebuffer;
|
|
|
|
gl: WebGLRenderingContext;
|
|
|
|
program: WebGLProgram;
|
|
|
|
scaleMode: number;
|
|
|
|
texture: WebGLTexture;
|
|
|
|
|
|
|
|
clear(): void;
|
|
|
|
resize(width: number, height: number): void;
|
|
|
|
destroy(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class GraphicsData {
|
|
|
|
|
|
|
|
constructor(lineWidth?: number, lineColor?: number, lineAlpha?: number, fillColor?: number, fillAlpha?: number, fill?: boolean, shape?: any);
|
|
|
|
|
|
|
|
lineWidth: number;
|
|
|
|
lineColor: number;
|
|
|
|
lineAlpha: number;
|
|
|
|
fillColor: number;
|
|
|
|
fillAlpha: number;
|
|
|
|
fill: boolean;
|
|
|
|
shape: any;
|
2014-11-14 20:16:46 +00:00
|
|
|
type: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Graphics extends DisplayObjectContainer {
|
|
|
|
|
2014-11-14 20:16:46 +00:00
|
|
|
static POLY: number;
|
|
|
|
static RECT: number;
|
|
|
|
static CIRC: number;
|
|
|
|
static ELIP: number;
|
|
|
|
static RREC: number;
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
blendMode: number;
|
|
|
|
boundsPadding: number;
|
|
|
|
fillAlpha: number;
|
|
|
|
isMask: boolean;
|
|
|
|
lineWidth: number;
|
2015-02-12 00:49:16 +00:00
|
|
|
lineColor: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
tint: number;
|
|
|
|
worldAlpha: number;
|
|
|
|
|
|
|
|
arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise: boolean): Graphics;
|
|
|
|
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics;
|
2014-11-18 12:54:07 +00:00
|
|
|
beginFill(color?: number, alpha?: number): Graphics;
|
2014-11-05 18:19:45 +00:00
|
|
|
bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): Graphics;
|
|
|
|
clear(): Graphics;
|
|
|
|
destroyCachedSprite(): void;
|
2015-06-13 16:41:28 +00:00
|
|
|
drawCircle(x: number, y: number, diameter: number): Graphics;
|
2014-11-05 18:19:45 +00:00
|
|
|
drawEllipse(x: number, y: number, width: number, height: number): Graphics;
|
2015-02-23 15:07:22 +00:00
|
|
|
drawPolygon(...path: any[]): Graphics;
|
2014-11-05 18:19:45 +00:00
|
|
|
drawRect(x: number, y: number, width: number, height: number): Graphics;
|
|
|
|
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): Graphics;
|
|
|
|
drawShape(shape: Circle): GraphicsData;
|
|
|
|
drawShape(shape: Rectangle): GraphicsData;
|
|
|
|
drawShape(shape: Ellipse): GraphicsData;
|
|
|
|
drawShape(shape: Polygon): GraphicsData;
|
|
|
|
endFill(): Graphics;
|
2016-05-29 21:36:18 +00:00
|
|
|
generateTexture(resolution?: number, scaleMode?: number, padding?: number): RenderTexture;
|
2014-11-18 12:54:07 +00:00
|
|
|
lineStyle(lineWidth?: number, color?: number, alpha?: number): Graphics;
|
2014-11-05 18:19:45 +00:00
|
|
|
lineTo(x: number, y: number): Graphics;
|
|
|
|
moveTo(x: number, y: number): Graphics;
|
|
|
|
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): Graphics;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class GrayFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
gray: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
|
|
|
|
load(): void;
|
|
|
|
loadFramedSpriteSheet(frameWidth: number, frameHeight: number, textureName: string): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class InteractionData {
|
|
|
|
|
|
|
|
global: Point;
|
|
|
|
target: Sprite;
|
|
|
|
originalEvent: Event;
|
|
|
|
|
2015-03-24 21:27:20 +00:00
|
|
|
getLocalPosition(displayObject: DisplayObject, point?: Point, globalPos?: Point): Point;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class InteractionManager {
|
|
|
|
|
|
|
|
currentCursorStyle: string;
|
|
|
|
last: number;
|
|
|
|
mouse: InteractionData;
|
|
|
|
mouseOut: boolean;
|
|
|
|
mouseoverEnabled: boolean;
|
|
|
|
onMouseMove: Function;
|
|
|
|
onMouseDown: Function;
|
|
|
|
onMouseOut: Function;
|
|
|
|
onMouseUp: Function;
|
|
|
|
onTouchStart: Function;
|
|
|
|
onTouchEnd: Function;
|
|
|
|
onTouchMove: Function;
|
|
|
|
pool: InteractionData[];
|
|
|
|
resolution: number;
|
2016-02-02 23:30:03 +00:00
|
|
|
stage: DisplayObjectContainer;
|
2014-11-05 18:19:45 +00:00
|
|
|
touches: { [id: string]: InteractionData };
|
|
|
|
|
2016-02-02 23:30:03 +00:00
|
|
|
constructor(stage: DisplayObjectContainer);
|
2014-11-05 18:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export class InvertFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
invert: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class JsonLoader implements Mixin {
|
|
|
|
|
|
|
|
constructor(url: string, crossorigin?: boolean);
|
|
|
|
|
|
|
|
baseUrl: string;
|
|
|
|
crossorigin: boolean;
|
|
|
|
loaded: boolean;
|
|
|
|
url: string;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
load(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Matrix {
|
|
|
|
|
|
|
|
a: number;
|
|
|
|
b: number;
|
|
|
|
c: number;
|
|
|
|
d: number;
|
|
|
|
tx: number;
|
|
|
|
ty: number;
|
|
|
|
|
|
|
|
append(matrix: Matrix): Matrix;
|
|
|
|
apply(pos: Point, newPos: Point): Point;
|
|
|
|
applyInverse(pos: Point, newPos: Point): Point;
|
|
|
|
determineMatrixArrayType(): number[];
|
|
|
|
identity(): Matrix;
|
|
|
|
rotate(angle: number): Matrix;
|
|
|
|
fromArray(array: number[]): void;
|
|
|
|
translate(x: number, y: number): Matrix;
|
|
|
|
toArray(transpose: boolean): number[];
|
|
|
|
scale(x: number, y: number): Matrix;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Mixin {
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class NoiseFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
noise: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class NormalMapFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
map: Texture;
|
|
|
|
offset: Point;
|
|
|
|
scale: Point;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class PixelateFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
size: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-16 13:13:07 +00:00
|
|
|
export interface IPixiShader {
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
fragmentSrc: string[];
|
|
|
|
gl: WebGLRenderingContext;
|
|
|
|
program: WebGLProgram;
|
|
|
|
vertexSrc: string[];
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
init(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class PixiShader implements IPixiShader {
|
|
|
|
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
|
|
|
|
attributes: ShaderAttribute[];
|
|
|
|
defaultVertexSrc: string[];
|
|
|
|
dirty: boolean;
|
|
|
|
firstRun: boolean;
|
|
|
|
textureCount: number;
|
|
|
|
fragmentSrc: string[];
|
|
|
|
gl: WebGLRenderingContext;
|
|
|
|
program: WebGLProgram;
|
|
|
|
vertexSrc: string[];
|
|
|
|
|
|
|
|
initSampler2D(): void;
|
|
|
|
initUniforms(): void;
|
|
|
|
syncUniforms(): void;
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
init(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class PixiFastShader implements IPixiShader {
|
|
|
|
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
|
|
|
|
textureCount: number;
|
|
|
|
fragmentSrc: string[];
|
|
|
|
gl: WebGLRenderingContext;
|
|
|
|
program: WebGLProgram;
|
|
|
|
vertexSrc: string[];
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
init(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class PrimitiveShader implements IPixiShader {
|
|
|
|
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
fragmentSrc: string[];
|
|
|
|
gl: WebGLRenderingContext;
|
|
|
|
program: WebGLProgram;
|
|
|
|
vertexSrc: string[];
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
init(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ComplexPrimitiveShader implements IPixiShader {
|
|
|
|
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
fragmentSrc: string[];
|
|
|
|
gl: WebGLRenderingContext;
|
|
|
|
program: WebGLProgram;
|
|
|
|
vertexSrc: string[];
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
init(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class StripShader implements IPixiShader {
|
|
|
|
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
fragmentSrc: string[];
|
|
|
|
gl: WebGLRenderingContext;
|
|
|
|
program: WebGLProgram;
|
|
|
|
vertexSrc: string[];
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
init(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Point {
|
|
|
|
|
|
|
|
constructor(x?: number, y?: number);
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
|
|
|
|
clone(): Point;
|
|
|
|
set(x: number, y: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Polygon implements HitArea {
|
|
|
|
|
|
|
|
constructor(points: Point[]);
|
|
|
|
constructor(points: number[]);
|
|
|
|
constructor(...points: Point[]);
|
|
|
|
constructor(...points: number[]);
|
|
|
|
|
2016-06-17 01:28:57 +00:00
|
|
|
points: any[];
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
clone(): Polygon;
|
|
|
|
contains(x: number, y: number): boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Rectangle implements HitArea {
|
|
|
|
|
|
|
|
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
|
|
|
|
clone(): Rectangle;
|
|
|
|
contains(x: number, y: number): boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class RGBSplitFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
red: Point;
|
|
|
|
green: Point;
|
|
|
|
blue: Point;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Rope extends Strip {
|
|
|
|
|
|
|
|
points: Point[];
|
2014-11-24 15:53:47 +00:00
|
|
|
vertices: number[];
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
constructor(texture: Texture, points: Point[]);
|
|
|
|
|
|
|
|
refresh(): void;
|
|
|
|
setTexture(texture: Texture): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-14 20:16:46 +00:00
|
|
|
export class RoundedRectangle implements HitArea {
|
|
|
|
|
|
|
|
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
radius: number;
|
|
|
|
|
|
|
|
clone(): RoundedRectangle;
|
|
|
|
contains(x: number, y: number): boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
export class SepiaFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
sepia: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class SmartBlurFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
blur: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class SpineLoader implements Mixin {
|
|
|
|
|
|
|
|
url: string;
|
|
|
|
crossorigin: boolean;
|
|
|
|
loaded: boolean;
|
|
|
|
|
|
|
|
constructor(url: string, crossOrigin: boolean);
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
load(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-24 15:53:47 +00:00
|
|
|
export class SpineTextureLoader {
|
|
|
|
|
|
|
|
constructor(basePath: string, crossorigin: boolean);
|
|
|
|
|
|
|
|
load(page: AtlasPage, file: string): void;
|
|
|
|
unload(texture: BaseTexture): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
export class Sprite extends DisplayObjectContainer {
|
|
|
|
|
|
|
|
constructor(texture: Texture);
|
|
|
|
|
|
|
|
anchor: Point;
|
|
|
|
blendMode: blendModes;
|
2016-06-17 11:46:47 +00:00
|
|
|
exists: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
shader: IPixiShader;
|
|
|
|
texture: Texture;
|
|
|
|
tint: number;
|
|
|
|
|
2015-08-26 18:07:56 +00:00
|
|
|
setTexture(texture: Texture, destroyBase?: boolean): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class SpriteBatch extends DisplayObjectContainer {
|
|
|
|
|
|
|
|
constructor(texture?: Texture);
|
|
|
|
|
|
|
|
ready: boolean;
|
|
|
|
textureThing: Texture;
|
|
|
|
|
|
|
|
initWebGL(gl: WebGLRenderingContext): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class SpriteSheetLoader implements Mixin {
|
|
|
|
|
|
|
|
constructor(url: string, crossorigin?: boolean);
|
|
|
|
|
|
|
|
baseUrl: string;
|
|
|
|
crossorigin: boolean;
|
|
|
|
frames: any;
|
|
|
|
texture: Texture;
|
|
|
|
url: string;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
load(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Strip extends DisplayObjectContainer {
|
|
|
|
|
2014-11-24 15:53:47 +00:00
|
|
|
static DrawModes: {
|
|
|
|
|
|
|
|
TRIANGLE_STRIP: number;
|
|
|
|
TRIANGLES: number;
|
|
|
|
|
2016-06-17 01:28:57 +00:00
|
|
|
};
|
2014-11-24 15:53:47 +00:00
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
constructor(texture: Texture);
|
|
|
|
|
2014-11-14 20:16:46 +00:00
|
|
|
blendMode: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
colors: number[];
|
|
|
|
dirty: boolean;
|
|
|
|
indices: number[];
|
2014-12-02 13:31:07 +00:00
|
|
|
canvasPadding: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
texture: Texture;
|
|
|
|
uvs: number[];
|
|
|
|
vertices: number[];
|
|
|
|
|
2014-11-24 15:53:47 +00:00
|
|
|
getBounds(matrix?: Matrix): Rectangle;
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Texture implements Mixin {
|
|
|
|
|
2014-11-14 20:16:46 +00:00
|
|
|
static emptyTexture: Texture;
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
static fromCanvas(canvas: HTMLCanvasElement, scaleMode?: scaleModes): Texture;
|
|
|
|
|
|
|
|
constructor(baseTexture: BaseTexture, frame?: Rectangle, crop?: Rectangle, trim?: Rectangle);
|
|
|
|
|
|
|
|
baseTexture: BaseTexture;
|
|
|
|
crop: Rectangle;
|
|
|
|
frame: Rectangle;
|
|
|
|
height: number;
|
|
|
|
noFrame: boolean;
|
|
|
|
requiresUpdate: boolean;
|
|
|
|
trim: Point;
|
|
|
|
width: number;
|
|
|
|
scope: any;
|
|
|
|
valid: boolean;
|
2016-09-21 21:53:30 +00:00
|
|
|
rotated: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
destroy(destroyBase: boolean): void;
|
|
|
|
setFrame(frame: Rectangle): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class TilingSprite extends Sprite {
|
|
|
|
|
|
|
|
constructor(texture: Texture, width: number, height: number);
|
|
|
|
|
2015-04-24 16:16:31 +00:00
|
|
|
canvasBuffer: PIXI.CanvasBuffer;
|
2014-11-05 18:19:45 +00:00
|
|
|
blendMode: number;
|
2015-04-24 16:16:31 +00:00
|
|
|
refreshTexture: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
texture: Texture;
|
2015-06-23 20:50:27 +00:00
|
|
|
textureDebug: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
tint: number;
|
|
|
|
tilePosition: Point;
|
2015-04-24 16:16:31 +00:00
|
|
|
tilePattern: PIXI.Texture;
|
2014-11-05 18:19:45 +00:00
|
|
|
tileScale: Point;
|
|
|
|
tileScaleOffset: Point;
|
|
|
|
|
2015-02-11 22:24:47 +00:00
|
|
|
destroy(): void;
|
2015-03-24 14:06:14 +00:00
|
|
|
generateTilingTexture(forcePowerOfTwo?: boolean): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
setTexture(texture: Texture): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class TiltShiftFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
blur: number;
|
|
|
|
gradientBlur: number;
|
|
|
|
start: number;
|
|
|
|
end: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class TiltShiftXFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
blur: number;
|
|
|
|
gradientBlur: number;
|
|
|
|
start: number;
|
|
|
|
end: number;
|
|
|
|
|
|
|
|
updateDelta(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class TiltShiftYFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
blur: number;
|
|
|
|
gradientBlur: number;
|
|
|
|
start: number;
|
|
|
|
end: number;
|
|
|
|
|
|
|
|
updateDelta(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class TwistFilter extends AbstractFilter {
|
|
|
|
|
|
|
|
angle: number;
|
|
|
|
offset: Point;
|
|
|
|
radius: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class VideoTexture extends BaseTexture {
|
|
|
|
|
|
|
|
static baseTextureFromVideo(video: HTMLVideoElement, scaleMode: number): BaseTexture;
|
|
|
|
static textureFromVideo(video: HTMLVideoElement, scaleMode: number): Texture;
|
2015-05-09 01:55:12 +00:00
|
|
|
static fromUrl(videoSrc: string, scaleMode?: number, autoPlay?: boolean, type?: string, loop?: boolean): Texture;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
2015-05-09 01:55:12 +00:00
|
|
|
controls: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
autoUpdate: boolean;
|
2015-05-09 01:55:12 +00:00
|
|
|
type: string;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
2015-05-09 01:55:12 +00:00
|
|
|
changeSource(src: string, type: string, loop: boolean): void;
|
2015-04-24 16:16:31 +00:00
|
|
|
play(): void;
|
|
|
|
stop(): void;
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
destroy(): void;
|
|
|
|
updateBound(): void;
|
2015-04-24 16:16:31 +00:00
|
|
|
onPlayStart: () => void;
|
|
|
|
onPlayStop: () => void;
|
2015-05-09 01:55:12 +00:00
|
|
|
onCanPlay: (event: any) => void;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLBlendModeManager {
|
|
|
|
|
|
|
|
currentBlendMode: number;
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
setBlendMode(blendMode: number): boolean;
|
|
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLFastSpriteBatch {
|
|
|
|
|
|
|
|
constructor(gl: CanvasRenderingContext2D);
|
|
|
|
|
|
|
|
currentBatchSize: number;
|
|
|
|
currentBaseTexture: BaseTexture;
|
|
|
|
currentBlendMode: number;
|
|
|
|
renderSession: RenderSession;
|
|
|
|
drawing: boolean;
|
|
|
|
indexBuffer: any;
|
|
|
|
indices: number[];
|
|
|
|
lastIndexCount: number;
|
|
|
|
matrix: Matrix;
|
|
|
|
maxSize: number;
|
|
|
|
shader: IPixiShader;
|
|
|
|
size: number;
|
|
|
|
vertexBuffer: any;
|
|
|
|
vertices: number[];
|
|
|
|
vertSize: number;
|
|
|
|
|
|
|
|
end(): void;
|
|
|
|
begin(spriteBatch: SpriteBatch, renderSession: RenderSession): void;
|
|
|
|
destroy(removeView?: boolean): void;
|
|
|
|
flush(): void;
|
|
|
|
render(spriteBatch: SpriteBatch): void;
|
|
|
|
renderSprite(sprite: Sprite): void;
|
|
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
start(): void;
|
|
|
|
stop(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLFilterManager {
|
|
|
|
|
|
|
|
filterStack: AbstractFilter[];
|
|
|
|
transparent: boolean;
|
|
|
|
offsetX: number;
|
|
|
|
offsetY: number;
|
|
|
|
|
|
|
|
applyFilterPass(filter: AbstractFilter, filterArea: Texture, width: number, height: number): void;
|
|
|
|
begin(renderSession: RenderSession, buffer: ArrayBuffer): void;
|
|
|
|
destroy(): void;
|
|
|
|
initShaderBuffers(): void;
|
|
|
|
popFilter(): void;
|
|
|
|
pushFilter(filterBlock: FilterBlock): void;
|
|
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLGraphics {
|
|
|
|
|
2014-11-14 20:16:46 +00:00
|
|
|
static graphicsDataPool: any[];
|
|
|
|
|
|
|
|
static renderGraphics(graphics: Graphics, renderRession: RenderSession): void;
|
|
|
|
static updateGraphics(graphics: Graphics, gl: WebGLRenderingContext): void;
|
2016-06-17 01:28:57 +00:00
|
|
|
static switchMode(webGL: WebGLRenderingContext, type: number): any;
|
2014-11-14 20:16:46 +00:00
|
|
|
static buildRectangle(graphicsData: GraphicsData, webGLData: any): void;
|
|
|
|
static buildRoundedRectangle(graphicsData: GraphicsData, webGLData: any): void;
|
|
|
|
static quadraticBezierCurve(fromX: number, fromY: number, cpX: number, cpY: number, toX: number, toY: number): number[];
|
|
|
|
static buildCircle(graphicsData: GraphicsData, webGLData: any): void;
|
|
|
|
static buildLine(graphicsData: GraphicsData, webGLData: any): void;
|
|
|
|
static buildComplexPoly(graphicsData: GraphicsData, webGLData: any): void;
|
|
|
|
static buildPoly(graphicsData: GraphicsData, webGLData: any): boolean;
|
|
|
|
|
|
|
|
reset(): void;
|
|
|
|
upload(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLGraphicsData {
|
|
|
|
|
|
|
|
constructor(gl: WebGLRenderingContext);
|
|
|
|
|
|
|
|
gl: WebGLRenderingContext;
|
|
|
|
glPoints: any[];
|
|
|
|
color: number[];
|
|
|
|
points: any[];
|
|
|
|
indices: any[];
|
|
|
|
buffer: WebGLBuffer;
|
|
|
|
indexBuffer: WebGLBuffer;
|
|
|
|
mode: number;
|
|
|
|
alpha: number;
|
|
|
|
dirty: boolean;
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
reset(): void;
|
|
|
|
upload(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLMaskManager {
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
popMask(renderSession: RenderSession): void;
|
|
|
|
pushMask(maskData: any[], renderSession: RenderSession): void;
|
|
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLRenderer implements PixiRenderer {
|
|
|
|
|
|
|
|
static createWebGLTexture(texture: Texture, gl: WebGLRenderingContext): void;
|
|
|
|
|
2016-02-02 23:30:03 +00:00
|
|
|
constructor(game: Phaser.Game);
|
2014-11-05 18:19:45 +00:00
|
|
|
|
2016-02-02 23:30:03 +00:00
|
|
|
game: Phaser.Game;
|
|
|
|
type: number;
|
|
|
|
resolution: number;
|
|
|
|
transparent: boolean;
|
2014-11-14 20:16:46 +00:00
|
|
|
autoResize: boolean;
|
2016-02-02 23:30:03 +00:00
|
|
|
preserveDrawingBuffer: boolean;
|
2014-11-05 18:19:45 +00:00
|
|
|
clearBeforeRender: boolean;
|
2016-02-02 23:30:03 +00:00
|
|
|
width: number;
|
2014-11-05 18:19:45 +00:00
|
|
|
height: number;
|
2016-09-19 23:21:24 +00:00
|
|
|
currentBatchedTextures: string[];
|
2016-02-02 23:30:03 +00:00
|
|
|
view: HTMLCanvasElement;
|
2014-11-05 18:19:45 +00:00
|
|
|
projection: Point;
|
2016-02-02 23:30:03 +00:00
|
|
|
offset: Point;
|
2014-11-05 18:19:45 +00:00
|
|
|
shaderManager: WebGLShaderManager;
|
|
|
|
spriteBatch: WebGLSpriteBatch;
|
|
|
|
maskManager: WebGLMaskManager;
|
|
|
|
filterManager: WebGLFilterManager;
|
|
|
|
stencilManager: WebGLStencilManager;
|
|
|
|
blendModeManager: WebGLBlendModeManager;
|
2016-02-02 23:30:03 +00:00
|
|
|
renderSession: RenderSession;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
initContext(): void;
|
2016-02-02 23:30:03 +00:00
|
|
|
render(stage: DisplayObjectContainer): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
renderDisplayObject(displayObject: DisplayObject, projection: Point, buffer: WebGLBuffer): void;
|
|
|
|
resize(width: number, height: number): void;
|
|
|
|
updateTexture(texture: Texture): void;
|
2016-02-02 23:30:03 +00:00
|
|
|
destroy(): void;
|
|
|
|
mapBlendModes(): void;
|
2016-09-19 23:21:24 +00:00
|
|
|
setTexturePriority(textureNameCollection: string[]): string[];
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLShaderManager {
|
|
|
|
|
|
|
|
maxAttibs: number;
|
|
|
|
attribState: any[];
|
|
|
|
stack: any[];
|
|
|
|
tempAttribState: any[];
|
|
|
|
|
|
|
|
destroy(): void;
|
|
|
|
setAttribs(attribs: ShaderAttribute[]): void;
|
|
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
setShader(shader: IPixiShader): boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLStencilManager {
|
|
|
|
|
|
|
|
stencilStack: any[];
|
|
|
|
reverse: boolean;
|
|
|
|
count: number;
|
|
|
|
|
|
|
|
bindGraphics(graphics: Graphics, webGLData: any[], renderSession: RenderSession): void;
|
|
|
|
destroy(): void;
|
|
|
|
popStencil(graphics: Graphics, webGLData: any[], renderSession: RenderSession): void;
|
|
|
|
pushStencil(graphics: Graphics, webGLData: any[], renderSession: RenderSession): void;
|
|
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class WebGLSpriteBatch {
|
|
|
|
|
|
|
|
blendModes: number[];
|
2014-12-02 13:31:07 +00:00
|
|
|
colors: number[];
|
2014-11-05 18:19:45 +00:00
|
|
|
currentBatchSize: number;
|
|
|
|
currentBaseTexture: Texture;
|
|
|
|
defaultShader: AbstractFilter;
|
|
|
|
dirty: boolean;
|
|
|
|
drawing: boolean;
|
|
|
|
indices: number[];
|
|
|
|
lastIndexCount: number;
|
2014-12-02 13:31:07 +00:00
|
|
|
positions: number[];
|
2014-11-05 18:19:45 +00:00
|
|
|
textures: Texture[];
|
|
|
|
shaders: IPixiShader[];
|
|
|
|
size: number;
|
2016-06-17 01:28:57 +00:00
|
|
|
sprites: any[];
|
2014-11-05 18:19:45 +00:00
|
|
|
vertices: number[];
|
|
|
|
vertSize: number;
|
|
|
|
|
|
|
|
begin(renderSession: RenderSession): void;
|
|
|
|
destroy(): void;
|
|
|
|
end(): void;
|
|
|
|
flush(shader?: IPixiShader): void;
|
|
|
|
render(sprite: Sprite): void;
|
|
|
|
renderBatch(texture: Texture, size: number, startIndex: number): void;
|
|
|
|
renderTilingSprite(sprite: TilingSprite): void;
|
|
|
|
setBlendMode(blendMode: blendModes): void;
|
|
|
|
setContext(gl: WebGLRenderingContext): void;
|
|
|
|
start(): void;
|
|
|
|
stop(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class RenderTexture extends Texture {
|
|
|
|
|
|
|
|
constructor(width?: number, height?: number, renderer?: PixiRenderer, scaleMode?: scaleModes, resolution?: number);
|
|
|
|
|
|
|
|
frame: Rectangle;
|
|
|
|
baseTexture: BaseTexture;
|
|
|
|
renderer: PixiRenderer;
|
|
|
|
resolution: number;
|
|
|
|
valid: boolean;
|
|
|
|
|
|
|
|
clear(): void;
|
|
|
|
getBase64(): string;
|
|
|
|
getCanvas(): HTMLCanvasElement;
|
|
|
|
getImage(): HTMLImageElement;
|
|
|
|
resize(width: number, height: number, updateBase: boolean): void;
|
2015-04-24 16:16:31 +00:00
|
|
|
render(displayObject: DisplayObject, matrix?: Matrix, clear?: boolean): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-06-17 01:28:57 +00:00
|
|
|
// SPINE
|
2014-11-10 21:15:52 +00:00
|
|
|
|
|
|
|
export class BoneData {
|
|
|
|
|
|
|
|
constructor(name: string, parent?: any);
|
|
|
|
|
|
|
|
name: string;
|
|
|
|
parent: any;
|
|
|
|
length: number;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
rotation: number;
|
|
|
|
scaleX: number;
|
|
|
|
scaleY: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class SlotData {
|
|
|
|
|
|
|
|
constructor(name: string, boneData: BoneData);
|
|
|
|
|
|
|
|
name: string;
|
|
|
|
boneData: BoneData;
|
|
|
|
r: number;
|
|
|
|
g: number;
|
|
|
|
b: number;
|
|
|
|
a: number;
|
|
|
|
attachmentName: string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Bone {
|
|
|
|
|
|
|
|
constructor(boneData: BoneData, parent?: any);
|
|
|
|
|
|
|
|
data: BoneData;
|
|
|
|
parent: any;
|
|
|
|
yDown: boolean;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
rotation: number;
|
|
|
|
scaleX: number;
|
|
|
|
scaleY: number;
|
|
|
|
worldRotation: number;
|
|
|
|
worldScaleX: number;
|
|
|
|
worldScaleY: number;
|
|
|
|
|
|
|
|
updateWorldTransform(flipX: boolean, flip: boolean): void;
|
|
|
|
setToSetupPose(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Slot {
|
|
|
|
|
|
|
|
constructor(slotData: SlotData, skeleton: Skeleton, bone: Bone);
|
|
|
|
|
|
|
|
data: SlotData;
|
|
|
|
skeleton: Skeleton;
|
|
|
|
bone: Bone;
|
|
|
|
r: number;
|
|
|
|
g: number;
|
|
|
|
b: number;
|
|
|
|
a: number;
|
|
|
|
attachment: RegionAttachment;
|
|
|
|
setAttachment(attachment: RegionAttachment): void;
|
|
|
|
setAttachmentTime(time: number): void;
|
|
|
|
getAttachmentTime(): number;
|
|
|
|
setToSetupPose(): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Skin {
|
|
|
|
|
|
|
|
constructor(name: string);
|
|
|
|
|
|
|
|
name: string;
|
|
|
|
attachments: any;
|
|
|
|
|
|
|
|
addAttachment(slotIndex: number, name: string, attachment: RegionAttachment): void;
|
|
|
|
getAttachment(slotIndex: number, name: string): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Animation {
|
|
|
|
|
|
|
|
constructor(name: string, timelines: ISpineTimeline[], duration: number);
|
|
|
|
|
|
|
|
name: string;
|
|
|
|
timelines: ISpineTimeline[];
|
|
|
|
duration: number;
|
|
|
|
apply(skeleton: Skeleton, time: number, loop: boolean): void;
|
|
|
|
min(skeleton: Skeleton, time: number, loop: boolean, alpha: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Curves {
|
|
|
|
|
|
|
|
constructor(frameCount: number);
|
|
|
|
|
|
|
|
curves: number[];
|
|
|
|
|
|
|
|
setLinear(frameIndex: number): void;
|
|
|
|
setStepped(frameIndex: number): void;
|
|
|
|
setCurve(frameIndex: number, cx1: number, cy1: number, cx2: number, cy2: number): void;
|
|
|
|
getCurvePercent(frameIndex: number, percent: number): number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ISpineTimeline {
|
|
|
|
|
|
|
|
curves: Curves;
|
|
|
|
frames: number[];
|
|
|
|
|
|
|
|
getFrameCount(): number;
|
|
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class RotateTimeline implements ISpineTimeline {
|
|
|
|
|
|
|
|
constructor(frameCount: number);
|
|
|
|
|
|
|
|
curves: Curves;
|
|
|
|
frames: number[];
|
|
|
|
boneIndex: number;
|
|
|
|
|
|
|
|
getFrameCount(): number;
|
|
|
|
setFrame(frameIndex: number, time: number, angle: number): void;
|
|
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class TranslateTimeline implements ISpineTimeline {
|
|
|
|
|
|
|
|
constructor(frameCount: number);
|
|
|
|
|
|
|
|
curves: Curves;
|
|
|
|
frames: number[];
|
|
|
|
boneIndex: number;
|
|
|
|
|
|
|
|
getFrameCount(): number;
|
|
|
|
setFrame(frameIndex: number, time: number, x: number, y: number): void;
|
|
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ScaleTimeline implements ISpineTimeline {
|
|
|
|
|
|
|
|
constructor(frameCount: number);
|
|
|
|
|
|
|
|
curves: Curves;
|
|
|
|
frames: number[];
|
|
|
|
boneIndex: number;
|
|
|
|
|
|
|
|
getFrameCount(): number;
|
|
|
|
setFrame(frameIndex: number, time: number, x: number, y: number): void;
|
|
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ColorTimeline implements ISpineTimeline {
|
|
|
|
|
|
|
|
constructor(frameCount: number);
|
|
|
|
|
|
|
|
curves: Curves;
|
|
|
|
frames: number[];
|
|
|
|
boneIndex: number;
|
|
|
|
|
|
|
|
getFrameCount(): number;
|
|
|
|
setFrame(frameIndex: number, time: number, r: number, g: number, b: number, a: number): void;
|
|
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AttachmentTimeline implements ISpineTimeline {
|
|
|
|
|
|
|
|
constructor(frameCount: number);
|
|
|
|
|
|
|
|
curves: Curves;
|
|
|
|
frames: number[];
|
|
|
|
attachmentNames: string[];
|
|
|
|
slotIndex: number;
|
|
|
|
|
|
|
|
getFrameCount(): number;
|
|
|
|
setFrame(frameIndex: number, time: number, attachmentName: string): void;
|
|
|
|
apply(skeleton: Skeleton, time: number, alpha: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class SkeletonData {
|
|
|
|
|
|
|
|
bones: Bone[];
|
|
|
|
slots: Slot[];
|
|
|
|
skins: Skin[];
|
|
|
|
animations: Animation[];
|
|
|
|
defaultSkin: Skin;
|
|
|
|
|
|
|
|
findBone(boneName: string): Bone;
|
|
|
|
findBoneIndex(boneName: string): number;
|
|
|
|
findSlot(slotName: string): Slot;
|
|
|
|
findSlotIndex(slotName: string): number;
|
|
|
|
findSkin(skinName: string): Skin;
|
|
|
|
findAnimation(animationName: string): Animation;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Skeleton {
|
|
|
|
|
|
|
|
constructor(skeletonData: SkeletonData);
|
|
|
|
|
|
|
|
data: SkeletonData;
|
|
|
|
bones: Bone[];
|
|
|
|
slots: Slot[];
|
|
|
|
drawOrder: any[];
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
skin: Skin;
|
|
|
|
r: number;
|
|
|
|
g: number;
|
|
|
|
b: number;
|
|
|
|
a: number;
|
|
|
|
time: number;
|
|
|
|
flipX: boolean;
|
|
|
|
flipY: boolean;
|
|
|
|
|
|
|
|
updateWorldTransform(): void;
|
|
|
|
setToSetupPose(): void;
|
|
|
|
setBonesToSetupPose(): void;
|
|
|
|
setSlotsToSetupPose(): void;
|
|
|
|
getRootBone(): Bone;
|
|
|
|
findBone(boneName: string): Bone;
|
|
|
|
fineBoneIndex(boneName: string): number;
|
|
|
|
findSlot(slotName: string): Slot;
|
|
|
|
findSlotIndex(slotName: string): number;
|
|
|
|
setSkinByName(skinName: string): void;
|
|
|
|
setSkin(newSkin: Skin): void;
|
|
|
|
getAttachmentBySlotName(slotName: string, attachmentName: string): RegionAttachment;
|
|
|
|
getAttachmentBySlotIndex(slotIndex: number, attachmentName: string): RegionAttachment;
|
|
|
|
setAttachment(slotName: string, attachmentName: string): void;
|
|
|
|
update(data: number): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class RegionAttachment {
|
|
|
|
|
|
|
|
offset: number[];
|
|
|
|
uvs: number[];
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
rotation: number;
|
|
|
|
scaleX: number;
|
|
|
|
scaleY: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
rendererObject: any;
|
|
|
|
regionOffsetX: number;
|
|
|
|
regionOffsetY: number;
|
|
|
|
regionWidth: number;
|
|
|
|
regionHeight: number;
|
|
|
|
regionOriginalWidth: number;
|
|
|
|
regionOriginalHeight: number;
|
|
|
|
|
|
|
|
setUVs(u: number, v: number, u2: number, v2: number, rotate: number): void;
|
|
|
|
updateOffset(): void;
|
|
|
|
computeVertices(x: number, y: number, bone: Bone, vertices: number[]): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AnimationStateData {
|
|
|
|
|
|
|
|
constructor(skeletonData: SkeletonData);
|
|
|
|
|
|
|
|
skeletonData: SkeletonData;
|
|
|
|
animationToMixTime: any;
|
|
|
|
defaultMix: number;
|
|
|
|
|
|
|
|
setMixByName(fromName: string, toName: string, duration: number): void;
|
|
|
|
setMix(from: string, to: string): number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AnimationState {
|
|
|
|
|
|
|
|
constructor(stateData: any);
|
|
|
|
|
|
|
|
animationSpeed: number;
|
|
|
|
current: any;
|
|
|
|
previous: any;
|
|
|
|
currentTime: number;
|
|
|
|
previousTime: number;
|
|
|
|
currentLoop: boolean;
|
|
|
|
previousLoop: boolean;
|
|
|
|
mixTime: number;
|
|
|
|
mixDuration: number;
|
|
|
|
queue: Animation[];
|
|
|
|
|
|
|
|
update(delta: number): void;
|
|
|
|
apply(skeleton: any): void;
|
|
|
|
clearAnimation(): void;
|
|
|
|
setAnimation(animation: any, loop: boolean): void;
|
|
|
|
setAnimationByName(animationName: string, loop: boolean): void;
|
|
|
|
addAnimationByName(animationName: string, loop: boolean, delay: number): void;
|
|
|
|
addAnimation(animation: any, loop: boolean, delay: number): void;
|
|
|
|
isComplete(): number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class SkeletonJson {
|
|
|
|
|
|
|
|
constructor(attachmentLoader: AtlasAttachmentLoader);
|
|
|
|
|
|
|
|
attachmentLoader: AtlasAttachmentLoader;
|
|
|
|
scale: number;
|
|
|
|
|
|
|
|
readSkeletonData(root: any): SkeletonData;
|
|
|
|
readAttachment(skin: Skin, name: string, map: any): RegionAttachment;
|
|
|
|
readAnimation(name: string, map: any, skeletonData: SkeletonData): void;
|
|
|
|
readCurve(timeline: ISpineTimeline, frameIndex: number, valueMap: any): void;
|
|
|
|
toColor(hexString: string, colorIndex: number): number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Atlas {
|
|
|
|
|
|
|
|
static FORMAT: {
|
|
|
|
|
|
|
|
alpha: number;
|
|
|
|
intensity: number;
|
|
|
|
luminanceAlpha: number;
|
|
|
|
rgb565: number;
|
|
|
|
rgba4444: number;
|
|
|
|
rgb888: number;
|
|
|
|
rgba8888: number;
|
|
|
|
|
2016-06-17 01:28:57 +00:00
|
|
|
};
|
2014-11-10 21:15:52 +00:00
|
|
|
|
|
|
|
static TextureFilter: {
|
|
|
|
|
|
|
|
nearest: number;
|
|
|
|
linear: number;
|
|
|
|
mipMap: number;
|
|
|
|
mipMapNearestNearest: number;
|
|
|
|
mipMapLinearNearest: number;
|
|
|
|
mipMapNearestLinear: number;
|
|
|
|
mipMapLinearLinear: number;
|
|
|
|
|
2016-06-17 01:28:57 +00:00
|
|
|
};
|
2014-11-10 21:15:52 +00:00
|
|
|
|
|
|
|
static textureWrap: {
|
|
|
|
|
|
|
|
mirroredRepeat: number;
|
|
|
|
clampToEdge: number;
|
|
|
|
repeat: number;
|
|
|
|
|
2016-06-17 01:28:57 +00:00
|
|
|
};
|
2014-11-10 21:15:52 +00:00
|
|
|
|
|
|
|
constructor(atlasText: string, textureLoader: AtlasLoader);
|
|
|
|
|
|
|
|
textureLoader: AtlasLoader;
|
|
|
|
pages: AtlasPage[];
|
|
|
|
regions: AtlasRegion[];
|
|
|
|
|
|
|
|
findRegion(name: string): AtlasRegion;
|
|
|
|
dispose(): void;
|
|
|
|
updateUVs(page: AtlasPage): void;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AtlasPage {
|
|
|
|
|
|
|
|
name: string;
|
|
|
|
format: number;
|
|
|
|
minFilter: number;
|
|
|
|
magFilter: number;
|
|
|
|
uWrap: number;
|
|
|
|
vWrap: number;
|
|
|
|
rendererObject: any;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AtlasRegion {
|
|
|
|
|
|
|
|
page: AtlasPage;
|
|
|
|
name: string;
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
u: number;
|
|
|
|
v: number;
|
|
|
|
u2: number;
|
|
|
|
v2: number;
|
|
|
|
offsetX: number;
|
|
|
|
offsetY: number;
|
|
|
|
originalWidth: number;
|
|
|
|
originalHeight: number;
|
|
|
|
index: number;
|
|
|
|
rotate: boolean;
|
|
|
|
splits: any[];
|
|
|
|
pads: any[];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AtlasReader {
|
|
|
|
|
|
|
|
constructor(text: string);
|
|
|
|
|
|
|
|
lines: string[];
|
|
|
|
index: number;
|
|
|
|
|
|
|
|
trim(value: string): string;
|
|
|
|
readLine(): string;
|
|
|
|
readValue(): string;
|
|
|
|
readTuple(tuple: number): number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class AtlasAttachmentLoader {
|
|
|
|
|
|
|
|
constructor(atlas: Atlas);
|
|
|
|
|
|
|
|
atlas: Atlas;
|
|
|
|
|
|
|
|
newAttachment(skin: Skin, type: number, name: string): RegionAttachment;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Spine extends DisplayObjectContainer {
|
|
|
|
|
|
|
|
constructor(url: string);
|
|
|
|
|
2014-11-24 15:53:47 +00:00
|
|
|
autoUpdate: boolean;
|
2014-11-10 21:15:52 +00:00
|
|
|
spineData: any;
|
|
|
|
skeleton: Skeleton;
|
|
|
|
stateData: AnimationStateData;
|
|
|
|
state: AnimationState;
|
|
|
|
slotContainers: DisplayObjectContainer[];
|
|
|
|
|
|
|
|
createSprite(slot: Slot, descriptor: { name: string }): Sprite[];
|
2014-11-24 15:53:47 +00:00
|
|
|
update(dt: number): void;
|
2014-11-10 21:15:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-05 18:19:45 +00:00
|
|
|
}
|
|
|
|
|
2014-11-10 21:15:52 +00:00
|
|
|
declare function requestAnimFrame(callback: Function): void;
|
2014-11-05 18:19:45 +00:00
|
|
|
|
|
|
|
declare module PIXI.PolyK {
|
|
|
|
export function Triangulate(p: number[]): number[];
|
2016-05-29 21:36:18 +00:00
|
|
|
}
|