2.4.0 Definition Updates.

This commit is contained in:
Clark Stevenson 2015-05-09 02:55:12 +01:00
parent 4a4d7d594c
commit c5396eb39e
3 changed files with 132 additions and 22 deletions

125
typescript/phaser.d.ts vendored
View file

@ -1,7 +1,7 @@
/// <reference path="pixi.d.ts" /> /// <reference path="pixi.d.ts" />
/// <reference path="p2.d.ts" /> /// <reference path="p2.d.ts" />
// Type definitions for Phaser 2.4.0 2015-04-23 // Type definitions for Phaser 2.4.0 2015-May-09
// Project: https://github.com/photonstorm/phaser // Project: https://github.com/photonstorm/phaser
declare class Phaser { declare class Phaser {
@ -42,6 +42,8 @@ declare class Phaser {
static TILESPRITE: number; static TILESPRITE: number;
static WEBGL_FILTER: number; static WEBGL_FILTER: number;
static ROPE: number; static ROPE: number;
static CREATURE: number;
static VIDEO: number;
static NONE: number; static NONE: number;
static LEFT: number; static LEFT: number;
@ -264,6 +266,7 @@ declare module Phaser {
render(): Phaser.BitmapData; render(): Phaser.BitmapData;
replaceRGB(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number, region: Phaser.Rectangle): Phaser.BitmapData; replaceRGB(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number, region: Phaser.Rectangle): Phaser.BitmapData;
resize(width: number, height: number): Phaser.BitmapData; resize(width: number, height: number): Phaser.BitmapData;
resizeFrame(parent: any, width: number, height: number): void;
setHSL(h?: number, s?: number, l?: number, region?: Phaser.Rectangle): Phaser.BitmapData; setHSL(h?: number, s?: number, l?: number, region?: Phaser.Rectangle): Phaser.BitmapData;
setPixel(x: number, y: number, red: number, green: number, blue: number, immediate?: boolean): Phaser.BitmapData; setPixel(x: number, y: number, red: number, green: number, blue: number, immediate?: boolean): Phaser.BitmapData;
setPixel32(x: number, y: number, red: number, green: number, blue: number, alpha: number, immediate?: boolean): Phaser.BitmapData; setPixel32(x: number, y: number, red: number, green: number, blue: number, alpha: number, immediate?: boolean): Phaser.BitmapData;
@ -359,6 +362,7 @@ declare module Phaser {
static IMAGE: number; static IMAGE: number;
static JSON: number; static JSON: number;
static PHYSICS: number; static PHYSICS: number;
static VIDEO: number;
static SOUND: number; static SOUND: number;
static TEXT: number; static TEXT: number;
static TEXTURE: number; static TEXTURE: number;
@ -430,6 +434,7 @@ declare module Phaser {
getURL(url: string): any; getURL(url: string): any;
getUrl(url: string): any; getUrl(url: string): any;
getXML(key: string): any; getXML(key: string): any;
getVideo(key: string): Phaser.Video;
isSoundDecoded(key: string): boolean; isSoundDecoded(key: string): boolean;
isSoundReady(key: string): boolean; isSoundReady(key: string): boolean;
isSpriteSheet(key: string): boolean; isSpriteSheet(key: string): boolean;
@ -446,6 +451,7 @@ declare module Phaser {
removeText(key: string): void; removeText(key: string): void;
removeTilemap(key: string): void; removeTilemap(key: string): void;
removeXML(key: string): void; removeXML(key: string): void;
removeVideo(key: string): void;
updateFrameData(key: string, frameData: any): void; updateFrameData(key: string, frameData: any): void;
updateSound(key: string, property: string, value: Phaser.Sound): void; updateSound(key: string, property: string, value: Phaser.Sound): void;
@ -582,6 +588,31 @@ declare module Phaser {
static updateColor(out: any): number; static updateColor(out: any): number;
static valueToColor(value: string, out?: any): { r: number; g: number; b: number; a: number; }; static valueToColor(value: string, out?: any): { r: number; g: number; b: number; a: number; };
static webToColor(web: string, out?: any): { r: number; g: number; b: number; a: number; }; static webToColor(web: string, out?: any): { r: number; g: number; b: number; a: number; };
static blendNormal(a: number): number;
static blendLighten(a: number, b: number): number;
static blendDarken(a: number, b: number): number;
static blendMultiply(a: number, b: number): number;
static blendAverage(a: number, b: number): number;
static blendAdd(a: number, b: number): number;
static blendSubtract(a: number, b: number): number;
static blendDifference(a: number, b: number): number;
static blendNegation(a: number, b: number): number;
static blendScreen(a: number, b: number): number;
static blendExclusion(a: number, b: number): number;
static blendOverlay(a: number, b: number): number;
static blendSoftLight(a: number, b: number): number;
static blendHardLight(a: number, b: number): number;
static blendColorDodge(a: number, b: number): number;
static blendColorBurn(a: number, b: number): number;
static blendLinearDodge(a: number, b: number): number;
static blendLinearBurn(a: number, b: number): number;
static blendLinearLight(a: number, b: number): number;
static blendVividLight(a: number, b: number): number;
static blendPinLight(a: number, b: number): number;
static blendHardMix(a: number, b: number): number;
static blendReflect(a: number, b: number): number;
static blendGlow(a: number, b: number): number;
static blendPhoenix(a: number, b: number): number;
} }
@ -601,6 +632,7 @@ declare module Phaser {
static checkFullScreenSupport(): void; static checkFullScreenSupport(): void;
static canPlayAudio(type: string): boolean; static canPlayAudio(type: string): boolean;
static canPlayVideo(type: string): boolean;
static isConsoleOpen(): boolean; static isConsoleOpen(): boolean;
static isAndroidStockBrowser(): string; static isAndroidStockBrowser(): string;
static whenReady: (callback: Function, context?: any) => void; static whenReady: (callback: Function, context?: any) => void;
@ -628,6 +660,8 @@ declare module Phaser {
fullScreenKeyboard: boolean; fullScreenKeyboard: boolean;
getUserMedia: boolean; getUserMedia: boolean;
game: Phaser.Game; game: Phaser.Game;
h264Video: boolean;
hlsVideo: boolean;
ie: boolean; ie: boolean;
ieVersion: number; ieVersion: number;
iOS: boolean; iOS: boolean;
@ -644,10 +678,12 @@ declare module Phaser {
midori: boolean; midori: boolean;
mobileSafari: boolean; mobileSafari: boolean;
mp3: boolean; mp3: boolean;
mp4Video: boolean;
mspointer: boolean; mspointer: boolean;
node: boolean; node: boolean;
nodeWebkit: boolean; nodeWebkit: boolean;
ogg: boolean; ogg: boolean;
oggVideo: number;
opera: boolean; opera: boolean;
opus: boolean; opus: boolean;
pixelRatio: number; pixelRatio: number;
@ -668,10 +704,12 @@ declare module Phaser {
webAudio: boolean; webAudio: boolean;
webGL: boolean; webGL: boolean;
webm: boolean; webm: boolean;
webmVideo: boolean;
windows: boolean; windows: boolean;
windowsPhone: boolean; windowsPhone: boolean;
wheelEvent: string; wheelEvent: string;
worker: boolean; worker: boolean;
wp9Video: boolean;
} }
@ -1078,6 +1116,7 @@ declare module Phaser {
clone(): Phaser.Frame; clone(): Phaser.Frame;
getRect(out?: Phaser.Rectangle): Phaser.Rectangle; getRect(out?: Phaser.Rectangle): Phaser.Rectangle;
setTrim(trimmed: boolean, actualWidth: number, actualHeight: number, destX: number, destY: number, destWidth: number, destHeight: number): void; setTrim(trimmed: boolean, actualWidth: number, actualHeight: number, destX: number, destY: number, destWidth: number, destHeight: number): void;
resize(width: number, height: number): void;
} }
@ -1250,6 +1289,8 @@ declare module Phaser {
tilemap(key?: string, tileWidth?: number, tileHeight?: number, width?: number, height?: number): Phaser.Tilemap; tilemap(key?: string, tileWidth?: number, tileHeight?: number, width?: number, height?: number): Phaser.Tilemap;
tileSprite(x: number, y: number, width: number, height: number, key?: any, frame?: any, group?: Phaser.Group): Phaser.TileSprite; tileSprite(x: number, y: number, width: number, height: number, key?: any, frame?: any, group?: Phaser.Group): Phaser.TileSprite;
tween(obj: any): Phaser.Tween; tween(obj: any): Phaser.Tween;
video(key: string, captureAudio?: boolean, width?: number, height?: number): Phaser.Video;
videoSprite(): void; //todo not sure?
} }
@ -1562,6 +1603,7 @@ declare module Phaser {
destroy(destroyChildren?: boolean): void; destroy(destroyChildren?: boolean): void;
kill(): Phaser.Image; kill(): Phaser.Image;
loadTexture(key: string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture, frame: string|number): void; loadTexture(key: string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture, frame: string|number): void;
resizeFrame(parent: any, width: number, height: number): void;
postUpdate(): void; postUpdate(): void;
preUpdate(): void; preUpdate(): void;
reset(x: number, y: number): Phaser.Image; reset(x: number, y: number): Phaser.Image;
@ -1602,9 +1644,7 @@ declare module Phaser {
minPriorityID: number; minPriorityID: number;
mouse: Phaser.Mouse; mouse: Phaser.Mouse;
mousePointer: Phaser.Pointer; mousePointer: Phaser.Pointer;
moveCallback: (pointer: Phaser.Pointer, x: number, y: number) => void;
moveCallbacks: (pointer: Phaser.Pointer, x: number, y: number) => void[]; moveCallbacks: (pointer: Phaser.Pointer, x: number, y: number) => void[];
moveCallbackContext: any;
mspointer: Phaser.MSPointer; mspointer: Phaser.MSPointer;
multiInputOverride: number; multiInputOverride: number;
onDown: Phaser.Signal; onDown: Phaser.Signal;
@ -1644,7 +1684,7 @@ declare module Phaser {
addMoveCallback(callback: Function, context: any): number; addMoveCallback(callback: Function, context: any): number;
boot(): void; boot(): void;
countActivePointers(limit?: number): number; countActivePointers(limit?: number): number;
deleteMoveCallback(index: number): void; deleteMoveCallback(callback: Function, context?: any): void;
destroy(): void; destroy(): void;
getLocalPosition(displayObject: any, pointer: Phaser.Pointer): Phaser.Point; getLocalPosition(displayObject: any, pointer: Phaser.Pointer): Phaser.Point;
getPointer(isActive?: boolean): Phaser.Pointer; getPointer(isActive?: boolean): Phaser.Pointer;
@ -2036,6 +2076,7 @@ declare module Phaser {
totalQueuedPacks(): number; totalQueuedPacks(): number;
transformUrl(url: string): string; transformUrl(url: string): string;
updateProgress(): void; updateProgress(): void;
video(key: string, urls: string | string[]| any, asBlob?: boolean): Phaser.Loader;
withSyncPoint(callback: Function, callbackContext?: any): Phaser.Loader; withSyncPoint(callback: Function, callbackContext?: any): Phaser.Loader;
xml(key: string, url?: string, overwrite?: boolean): Phaser.Loader; xml(key: string, url?: string, overwrite?: boolean): Phaser.Loader;
xhrLoad(file: any, url: string, type: string, onload: Function, onerror?: Function): void; xhrLoad(file: any, url: string, type: string, onload: Function, onerror?: Function): void;
@ -2391,6 +2432,60 @@ declare module Phaser {
} }
export class Video {
game: Phaser.Game;
key: string;
video: HTMLVideoElement;
baseTexture: PIXI.BaseTexture;
texture: PIXI.Texture;
textureFrame: Phaser.Frame;
type: number;
disableTextureUpload: boolean;
dirty: boolean;
currentTime: number;
duration: number;
progress: number;
mute: boolean;
paused: boolean;
volume: boolean;
playbackRate: boolean;
playing: boolean;
loop: boolean;
width: number;
height: number;
videoStream: any;
snapshot: Phaser.BitmapData;
onAccess: Phaser.Signal;
onError: Phaser.Signal;
onPlay: Phaser.Signal;
onComplete: Phaser.Signal;
onUpdate: Phaser.Signal;
touchLocked: boolean;
complete: () => void;
constructor(game: Phaser.Game, key?: string, captureAudio?: boolean, width?: number, height?: number);
add(object: Phaser.Sprite | Phaser.Sprite[]| Phaser.Image | Phaser.Image[]): Phaser.Video;
addToWorld(x?: number, y?: number, anchorX?: number, anchorY?: Number, scaleX?: number, scaleY?: number): Phaser.Image;
createVideoFromBlob(blob: Blob): Phaser.Video;
createVideoStream(captureAudio?: boolean, width?: number, height?: number): Phaser.Video;
changeSource(src: string, autoplay?: boolean): Phaser.Video;
destroy(): void;
play(loop?: boolean, playbackRate?: number): Phaser.Video;
render(): void;
resizeFrame(parent: any, width: number, height: number): void;
setTouchLock(): void;
grab(clear?: boolean, alpha?: number, blendMode?: string): Phaser.BitmapData;
stop(): void;
unlock(): boolean;
updateTexture(event?: any, width?: number, height?: number): void;
}
module Physics { module Physics {
class Arcade { class Arcade {
@ -2505,6 +2600,7 @@ declare module Phaser {
sourceHeight: number; sourceHeight: number;
speed: number; speed: number;
sprite: Phaser.Sprite; sprite: Phaser.Sprite;
syncBounds: boolean;
tilePadding: Phaser.Point; tilePadding: Phaser.Point;
touching: FaceChoices; touching: FaceChoices;
type: number; type: number;
@ -3243,6 +3339,8 @@ declare module Phaser {
} }
class Webcam extends Phaser.Plugin { class Webcam extends Phaser.Plugin {
constructor(game: Phaser.Game, parent: PIXI.DisplayObject); constructor(game: Phaser.Game, parent: PIXI.DisplayObject);
@ -3552,6 +3650,8 @@ declare module Phaser {
static size(a: Phaser.Rectangle, output?: Phaser.Point): Phaser.Point; static size(a: Phaser.Rectangle, output?: Phaser.Point): Phaser.Point;
static union(a: Phaser.Rectangle, b: Phaser.Rectangle, out?: Phaser.Rectangle): Phaser.Rectangle; static union(a: Phaser.Rectangle, b: Phaser.Rectangle, out?: Phaser.Rectangle): Phaser.Rectangle;
ceil(): void;
ceilAll(): void;
centerOn(x: number, y: number): Phaser.Rectangle; centerOn(x: number, y: number): Phaser.Rectangle;
clone(output: Phaser.Rectangle): Phaser.Rectangle; clone(output: Phaser.Rectangle): Phaser.Rectangle;
contains(x: number, y: number): boolean; contains(x: number, y: number): boolean;
@ -3867,6 +3967,9 @@ declare module Phaser {
mute: boolean; mute: boolean;
noAudio: boolean; noAudio: boolean;
onSoundDecode: Phaser.Signal; onSoundDecode: Phaser.Signal;
onVolumeChange: Phaser.Signal;
onMute: Phaser.Signal;
onUnMute: Phaser.Signal;
touchLocked: boolean; touchLocked: boolean;
usingAudioTag: boolean; usingAudioTag: boolean;
usingWebAudio: boolean; usingWebAudio: boolean;
@ -3883,8 +3986,9 @@ declare module Phaser {
removeByKey(key: string): number; removeByKey(key: string): number;
resumeAll(): void; resumeAll(): void;
setDecodedCallback(files: string[]|Phaser.Sound[], callback: Function, callbackContext: any): void; setDecodedCallback(files: string[]|Phaser.Sound[], callback: Function, callbackContext: any): void;
setTouchLock(): void;
stopAll(): void; stopAll(): void;
unlock(): void; unlock(): boolean;
update(): void; update(): void;
} }
@ -3940,6 +4044,7 @@ declare module Phaser {
smoothed: boolean; smoothed: boolean;
top: number; top: number;
type: number; type: number;
tintedTexture: HTMLCanvasElement;
world: Phaser.Point; world: Phaser.Point;
x: number; x: number;
y: number; y: number;
@ -4234,8 +4339,10 @@ declare module Phaser {
renderOrderID: number; renderOrderID: number;
shadowBlur: number; shadowBlur: number;
shadowColor: string; shadowColor: string;
shadowFill: boolean;
shadowOffsetX: number; shadowOffsetX: number;
shadowOffsetY: number; shadowOffsetY: number;
shadowStroke: boolean;
stroke: string; stroke: string;
strokeThickness: number; strokeThickness: number;
scale: Phaser.Point; scale: Phaser.Point;
@ -4253,12 +4360,13 @@ declare module Phaser {
fontToComponents(font: string): any; fontToComponents(font: string): any;
postUpdate(): void; postUpdate(): void;
preUpdate(): void; preUpdate(): void;
setShadow(x?: number, y?: number, color?: any, blur?: number): void; setShadow(x?: number, y?: number, color?: any, blur?: number, shadowStroke?: boolean, shadowFill?: boolean): void;
setStyle(style?: { font?: string; fill?: any; align?: string; stroke?: string; strokeThickness?: number; wordWrap?: boolean; wordWrapWidth?: number; shadowOffsetX?: number; shadowOffsetY?: number; shadowColor?: string; shadowBlur?: number; }): void; setStyle(style?: { font?: string; fill?: any; align?: string; stroke?: string; strokeThickness?: number; wordWrap?: boolean; wordWrapWidth?: number; shadowOffsetX?: number; shadowOffsetY?: number; shadowColor?: string; shadowBlur?: number; }): void;
update(): void; update(): void;
updateFont(components: any): void; updateFont(components: any): void;
updateTexture(): void;
updateLine(text: string, x?: number, y?: number): void; updateLine(text: string, x?: number, y?: number): void;
updateShadow(state?: boolean): void;
updateTexture(): void;
} }
@ -4633,7 +4741,10 @@ declare module Phaser {
touchLeaveCallback: Function; touchLeaveCallback: Function;
touchMoveCallback: Function; touchMoveCallback: Function;
touchStartCallback: Function; touchStartCallback: Function;
touchLockCallbacks: Function[];
addTouchLockCallback(callback: Function, context?: any): void;
removeTouchLockCallback(callback: Function, context?: any): boolean;
consumeTouchMove(): void; consumeTouchMove(): void;
onTouchCancel(event: any): void; onTouchCancel(event: any): void;
onTouchEnd(event: any): void; onTouchEnd(event: any): void;

21
typescript/pixi.d.ts vendored
View file

@ -1,5 +1,4 @@
// Type definitions for PIXI 2.2.8 2015-03-24 // Type definitions for PIXI 2.2.8 Deviation. Commit History Reviewed: 2015-May-09
// Project: https://github.com/GoodBoyDigital/pixi.js/
declare module PIXI { declare module PIXI {
@ -275,7 +274,7 @@ declare module PIXI {
once(eventName: string, fn: Function): Function; once(eventName: string, fn: Function): Function;
off(eventName: string, fn: Function): Function; off(eventName: string, fn: Function): Function;
removeAllEventListeners(eventName: string): void; removeAllEventListeners(eventName: string): void;
forceLoaded(width: number, height: number): void;
destroy(): void; destroy(): void;
dirty(): void; dirty(): void;
updateSourceImage(newSrc: string): void; updateSourceImage(newSrc: string): void;
@ -396,10 +395,7 @@ declare module PIXI {
static tintWithMultiply(texture: Texture, color: number, canvas: HTMLCanvasElement): void; static tintWithMultiply(texture: Texture, color: number, canvas: HTMLCanvasElement): void;
static tintWithOverlay(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 tintWithPerPixel(texture: Texture, color: number, canvas: HTMLCanvasElement): void;
static roundColor(color: number): void;
static cacheStepsPerColorChannel: number;
static convertTintToImage: boolean;
static canUseMultiply: boolean; static canUseMultiply: boolean;
static tintMethod: any; static tintMethod: any;
@ -484,6 +480,9 @@ declare module PIXI {
stage: Stage; stage: Stage;
visible: boolean; visible: boolean;
worldAlpha: number; worldAlpha: number;
worldPosition: PIXI.Point;
worldScale: PIXI.Point;
worldRotation: number;
worldVisible: boolean; worldVisible: boolean;
x: number; x: number;
y: number; y: number;
@ -1220,13 +1219,13 @@ declare module PIXI {
static baseTextureFromVideo(video: HTMLVideoElement, scaleMode: number): BaseTexture; static baseTextureFromVideo(video: HTMLVideoElement, scaleMode: number): BaseTexture;
static textureFromVideo(video: HTMLVideoElement, scaleMode: number): Texture; static textureFromVideo(video: HTMLVideoElement, scaleMode: number): Texture;
static fromUrl(videoSrc: string, scaleMode: number): Texture; static fromUrl(videoSrc: string, scaleMode?: number, autoPlay?: boolean, type?: string, loop?: boolean): Texture;
controls: boolean;
autoUpdate: boolean; autoUpdate: boolean;
type: string;
onPlay: Phaser.Signal; changeSource(src: string, type: string, loop: boolean): void;
onComplete: Phaser.Signal;
play(): void; play(): void;
stop(): void; stop(): void;
@ -1234,7 +1233,7 @@ declare module PIXI {
updateBound(): void; updateBound(): void;
onPlayStart: () => void; onPlayStart: () => void;
onPlayStop: () => void; onPlayStop: () => void;
onCanPlay: () => void; onCanPlay: (event: any) => void;
} }

View file

@ -1,11 +1,11 @@
# TypeScript Definitions # # TypeScript Definitions #
If you are a phaser dev then reference the `phaser.d.ts` in your project. Reference the `phaser.d.ts` in your project.
Please use TypeScript 1.4 Please use TypeScript 1.4+
- `phaser.d.ts` contains a reference to `pixi.d.ts` and so both these files must remain siblings in the same directory. - `phaser.d.ts` contains a reference to `pixi.d.ts` and `p2.d.ts` and so both these files must remain siblings in the same directory.
- `pixi.d.ts` has no dependencies and can be used by pixi devs standalone. - `pixi.d.ts` has deviated from the official project. If you are a pixi user, pick up the ball over at [the official pixi typescript repo](https://github.com/pixijs/pixi-typescript).
## Contributing ## ## Contributing ##