BitmapData + Color updates mostly.

This commit is contained in:
clark-stevenson 2014-04-26 01:34:19 +01:00
parent b0afc562b5
commit 8b01abfbec

96
build/phaser.d.ts vendored
View file

@ -1070,7 +1070,7 @@ declare module Phaser {
onResume(): void; onResume(): void;
play(frameRate?: number, loop?: boolean, killOnComplete?: boolean): Phaser.Animation; play(frameRate?: number, loop?: boolean, killOnComplete?: boolean): Phaser.Animation;
restart(): void; restart(): void;
stop(resetFrame?: boolean, dispatchComplete?:boolean): void; stop(resetFrame?: boolean, dispatchComplete?: boolean): void;
update(): boolean; update(): boolean;
} }
@ -1093,7 +1093,7 @@ declare module Phaser {
add(name: string, frames?: any[], frameRate?: number, loop?: boolean, useNumericIndex?: boolean): Phaser.Animation; add(name: string, frames?: any[], frameRate?: number, loop?: boolean, useNumericIndex?: boolean): Phaser.Animation;
destroy(): void; destroy(): void;
getAnimation(name: string): Phaser.Animation; getAnimation(name: string): Phaser.Animation;
play(name: string, frameRate?: number, loop?: boolean, killOnComplete?:boolean): Phaser.Animation; play(name: string, frameRate?: number, loop?: boolean, killOnComplete?: boolean): Phaser.Animation;
refreshFrame(); refreshFrame();
stop(name?: string, resetFrame?: boolean): void; stop(name?: string, resetFrame?: boolean): void;
update(): boolean; update(): boolean;
@ -1110,20 +1110,41 @@ declare module Phaser {
} }
class ArrayList {
first: Object;
list: any[];
next: Object;
position: number;
total: number;
add(child: Object): Object;
callAll(callback: Function, ...parameters: any[]);
exists(child: Object): boolean;
getIndex(child: Object): number;
remove(child: Object): Object;
reset(): void;
}
class BitmapData { class BitmapData {
constructor(game: Phaser.Game, key: string, width?: number, height?: number); constructor(game: Phaser.Game, key: string, width?: number, height?: number);
baseTexture: PIXI.BaseTexture; baseTexture: PIXI.BaseTexture;
buffer: ArrayBuffer;
canvas: HTMLCanvasElement; canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D; context: CanvasRenderingContext2D;
ctx: CanvasRenderingContext2D; ctx: CanvasRenderingContext2D;
data: Uint8Array;
dirty: boolean; dirty: boolean;
disableTextureUpload: boolean;
game: Phaser.Game; game: Phaser.Game;
height: number; height: number;
imageData: any[]; imageData: ImageData;
key: string; key: string;
pixels: number; pixels: Uint32Array;
texture: PIXI.Texture; texture: PIXI.Texture;
textureFrame: Phaser.Frame; textureFrame: Phaser.Frame;
type: number; type: number;
@ -1134,15 +1155,23 @@ declare module Phaser {
clear(): void; clear(): void;
cls(): void; cls(): void;
copyPixels(source: any, area: Phaser.Rectangle, destX: number, destY: number): void; copyPixels(source: any, area: Phaser.Rectangle, destX: number, destY: number): void;
draw(source: any, destX: number, destY: number): void; draw(source: any, x: number, y: number): void;
getPixel(x: number, y: number): number; drawSprite(sprite: any, x?: number, y?: number): void;
fill(r: number, g: number, b: number, a?: number): void;
getPixel(x: number, y: number, out?: Object): number;
getPixelRGB(x: number, y: number, out?: Object, hsl?: boolean, hsv?: boolean): Object;
getPixel32(x: number, y: number): number; getPixel32(x: number, y: number): number;
getPixels(rect: Phaser.Rectangle): number[]; getPixels(rect: Phaser.Rectangle): ImageData;
refreshBuffer(): void; processPixel(callback: Function, callbackContext: Object, x?: number, y?: Number, width?: number, height?: number): void;
processPixelRGB(callback: Function, callbackContext: Object, x?: number, y?: Number, width?: number, height?: number): void;
refreshBuffer(x?: number, y?: number, width?: number, height?: number): void;
render(): void; render(): void;
replaceRGB(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number, region: Phaser.Rectangle): void;
resize(width: number, height: number): void; resize(width: number, height: number): void;
setPixel(x: number, y: number, red: number, green: number, blue: number): void; shiftHSL(h?: number, s?: number, l?: number, region?: Phaser.Rectangle): void;
setPixel32(x: number, y: number, red: number, green: number, blue: number, alpha: number): void; setHSL(h?: number, s?: number, l?: number, region?: Phaser.Rectangle): void;
setPixel(x: number, y: number, red: number, green: number, blue: number, immediate?: boolean): void;
setPixel32(x: number, y: number, red: number, green: number, blue: number, alpha: number, immediate?: boolean): void;
} }
@ -1257,7 +1286,7 @@ declare module Phaser {
getFrameByName(key: string, frame: string): Phaser.Frame; getFrameByName(key: string, frame: string): Phaser.Frame;
getFrameData(key: string): Phaser.FrameData; getFrameData(key: string): Phaser.FrameData;
getImage(key: string): Object; getImage(key: string): Object;
getJSON(key:string): Object; getJSON(key: string): Object;
getKeys(array: string[]): string[]; getKeys(array: string[]): string[];
getPhysicsData(key: string, object?: string, fixtureKey?: string): Object; getPhysicsData(key: string, object?: string, fixtureKey?: string): Object;
getSound(key: string): Phaser.Sound; getSound(key: string): Phaser.Sound;
@ -1380,6 +1409,9 @@ declare module Phaser {
class Color { class Color {
static colorToHexstring(color: number): string; static colorToHexstring(color: number): string;
static componentToHex(color: number): string;
static createColor(r?: number, g?: number, b?: number, a?: number, h?: number, s?: number, l?: number, v?: number): Object;
static fromRGBA(rgba: number, out?: Object): Object;
static getAlpha(color: number): number; static getAlpha(color: number): number;
static getAlphaFloat(color: number): number; static getAlphaFloat(color: number): number;
static getBlue(color: number): number; static getBlue(color: number): number;
@ -1392,11 +1424,21 @@ declare module Phaser {
static getRGB(color: number): Object; static getRGB(color: number): Object;
static getWebRGB(color: number): string; static getWebRGB(color: number): string;
static hexToRGB(h: string): number; static hexToRGB(h: string): number;
static hexToColor(hex: string, out?: Object): Object;
static HSLtoRGB(h: number, s: number, l: number, out?: Object): Object;
static HSVtoRGB(h: number, s: number, v: number, out?: Object): Object;
static hueToColor(p: number, q: number, t: number): number;
static interpolateColor(color1: number, color2: number, steps: number, currentStep: number, alpha: number): number; static interpolateColor(color1: number, color2: number, steps: number, currentStep: number, alpha: number): number;
static interpolateColorWithRGB(color: number, r: number, g: number, b: number, steps: number, currentStep: number): number; static interpolateColorWithRGB(color: number, r: number, g: number, b: number, steps: number, currentStep: number): number;
static interpolateRGB(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number, steps: number, currentStep: number): number; static interpolateRGB(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number, steps: number, currentStep: number): number;
static packPixel(r: number, g: number, b: number, a: number): number;
static RGBtoHSL(r: number, g: number, b: number, out?: Object): Object;
static RGBtoHSV(r: number, g: number, b: number, out?: Object): Object;
static RGBtoString(r: number, g: number, b: number, a?: number, prefix?: string): string;
static RGBtoHexstring(color: number): string; static RGBtoHexstring(color: number): string;
static RGBtoWebstring(color: number): string; static RGBtoWebstring(color: number): string;
static toRGBA(r: number, g: number, b: number, a: number): number;
static unpackPixel(rgba: number, out?: Object, hsl?: boolean, hsv?: boolean): Object;
} }
@ -1411,6 +1453,8 @@ declare module Phaser {
class Device { class Device {
static LITTLE_ENDIAN: boolean;
constructor(game: Phaser.Game); constructor(game: Phaser.Game);
android: boolean; android: boolean;
@ -1457,6 +1501,7 @@ declare module Phaser {
requestFullScreen: string; requestFullScreen: string;
safari: boolean; safari: boolean;
silk: boolean; silk: boolean;
support32bit: boolean;
touch: boolean; touch: boolean;
trident: boolean; trident: boolean;
tridentVersion: number; tridentVersion: number;
@ -1725,7 +1770,7 @@ declare module Phaser {
focusLoss(event: Object): void; focusLoss(event: Object): void;
gamePaused(event: Object): void; gamePaused(event: Object): void;
gameResumed(event: Object): void; gameResumed(event: Object): void;
parseConfig(config:Object): void; parseConfig(config: Object): void;
setUpRenderer(): void; setUpRenderer(): void;
showDebugHeader(): void; showDebugHeader(): void;
step(): void; step(): void;
@ -1755,7 +1800,7 @@ declare module Phaser {
sprite(x: number, y: number, key?: any, frame?: any): Phaser.Sprite; sprite(x: number, y: number, key?: any, frame?: any): Phaser.Sprite;
spriteBatch(parent: any, name?: String, addToStage?: boolean): Phaser.Group; spriteBatch(parent: any, name?: String, addToStage?: boolean): Phaser.Group;
text(x: number, y: number, text?: string, style?: Object): Phaser.Text; text(x: number, y: number, text?: string, style?: Object): Phaser.Text;
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): Phaser.TileSprite; tileSprite(x: number, y: number, width: number, height: number, key: any, frame: any): Phaser.TileSprite;
tween(obj: Object): Phaser.Tween; tween(obj: Object): Phaser.Tween;
@ -1957,7 +2002,7 @@ declare module Phaser {
addAll(property: string, amount: number, checkAlive: boolean, checkVisible: boolean): void; addAll(property: string, amount: number, checkAlive: boolean, checkVisible: boolean): void;
bringToTop(child: any): any; bringToTop(child: any): any;
addAt(child: any, index: number): any; addAt(child: any, index: number): any;
callAll(method: string, context:any, ...parameters: any[]): void; callAll(method: string, context: any, ...parameters: any[]): void;
callAllExists(callback: Function, existsValue: boolean, ...parameters: any[]): void; callAllExists(callback: Function, existsValue: boolean, ...parameters: any[]): void;
callbackFromArray(child: Object, callback: Function, length: number): void; callbackFromArray(child: Object, callback: Function, length: number): void;
countDead(): number; countDead(): number;
@ -2067,7 +2112,7 @@ declare module Phaser {
hitCanvas: HTMLCanvasElement; hitCanvas: HTMLCanvasElement;
hitContext: CanvasRenderingContext2D; hitContext: CanvasRenderingContext2D;
holdRate: number; holdRate: number;
interactiveItems: Phaser.LinkedList; interactiveItems: Phaser.ArrayList;
justPressedRate: number; justPressedRate: number;
justReleasedRate: number; justReleasedRate: number;
keyboard: Phaser.Keyboard; keyboard: Phaser.Keyboard;
@ -2507,6 +2552,7 @@ declare module Phaser {
static isOdd(n: number): boolean; static isOdd(n: number): boolean;
static linear(p0: number, p1: number, t: number): number; static linear(p0: number, p1: number, t: number): number;
static linearInterpolation(v: number[], k: number): number; static linearInterpolation(v: number[], k: number): number;
static limitValue(value: number, min: number, max: number): number;
static mapLinear(x: number, a1: number, a2: number, b1: number, b2: number): number; static mapLinear(x: number, a1: number, a2: number, b1: number, b2: number): number;
static max(...numbers: number[]): number; static max(...numbers: number[]): number;
static maxAdd(value: number, amount: number, max: number): number; static maxAdd(value: number, amount: number, max: number): number;
@ -2540,7 +2586,7 @@ declare module Phaser {
static truncate(n: number): number; static truncate(n: number): number;
static within(a: number, b: number, tolerance: number): boolean; static within(a: number, b: number, tolerance: number): boolean;
static wrap(value: number, min: number, max: number): number; static wrap(value: number, min: number, max: number): number;
static wrapAngle(angle: number, radians?:boolean): number; static wrapAngle(angle: number, radians?: boolean): number;
static wrapValue(value: number, amount: number, max: number): number; static wrapValue(value: number, amount: number, max: number): number;
} }
@ -3072,6 +3118,7 @@ declare module Phaser {
onEndContact: Phaser.Signal; onEndContact: Phaser.Signal;
onSpringAdded: Phaser.Signal; onSpringAdded: Phaser.Signal;
onSpringRemoved: Phaser.Signal; onSpringRemoved: Phaser.Signal;
paused: boolean;
restitution: number; restitution: number;
solveConstraints: boolean; solveConstraints: boolean;
time: any; time: any;
@ -3110,14 +3157,16 @@ declare module Phaser {
hitTest(worldPoint: Phaser.Point, bodies?: any[], precision?: number, filterStatic?: boolean): Phaser.Physics.P2.Body[]; hitTest(worldPoint: Phaser.Point, bodies?: any[], precision?: number, filterStatic?: boolean): Phaser.Physics.P2.Body[];
mpx(v: number): number; mpx(v: number): number;
mpxi(v: number): number; mpxi(v: number): number;
pause(): void;
preUpdate(): void;
pxm(v: number): number; pxm(v: number): number;
pxmi(v: number): number; pxmi(v: number): number;
preUpdate(): void;
removeBody(body: Phaser.Physics.P2.Body): Phaser.Physics.P2.Body; removeBody(body: Phaser.Physics.P2.Body): Phaser.Physics.P2.Body;
removeBodyNextStep(body: Phaser.Physics.P2.Body): void; removeBodyNextStep(body: Phaser.Physics.P2.Body): void;
removeConstraint(constraint: any): any; removeConstraint(constraint: any): any;
removeContactMaterial(material: Phaser.Physics.P2.ContactMaterial); removeContactMaterial(material: Phaser.Physics.P2.ContactMaterial);
removeSpring(spring: Phaser.Physics.P2.Spring): Phaser.Physics.P2.Spring; removeSpring(spring: Phaser.Physics.P2.Spring): Phaser.Physics.P2.Spring;
resume(): void;
setBounds(x: number, y: number, width: number, height: number, left?: Boolean, right?: boolean, top?: boolean, bottom?: boolean, setCollisionGroup?: boolean): void; setBounds(x: number, y: number, width: number, height: number, left?: Boolean, right?: boolean, top?: boolean, bottom?: boolean, setCollisionGroup?: boolean): void;
setBoundsToWorld(left?: boolean, right?: boolean, top?: boolean, bottom?: boolean, setCollisionGroup?: boolean): void; setBoundsToWorld(left?: boolean, right?: boolean, top?: boolean, bottom?: boolean, setCollisionGroup?: boolean): void;
setCollisionGroup(object: Object, group: Phaser.Physics.P2.CollisionGroup): void; setCollisionGroup(object: Object, group: Phaser.Physics.P2.CollisionGroup): void;
@ -3758,7 +3807,7 @@ declare module Phaser {
class Sound { class Sound {
constructor(game: Phaser.Game, key: string, volume?: number, loop?: boolean, connect?:boolean); constructor(game: Phaser.Game, key: string, volume?: number, loop?: boolean, connect?: boolean);
autoplay: boolean; autoplay: boolean;
context: any; context: any;
@ -3984,7 +4033,7 @@ declare module Phaser {
setScreenSize(force: boolean): void; setScreenSize(force: boolean): void;
setShowAll(): void; setShowAll(): void;
setSize(): void; setSize(): void;
startFullScreen(antialias:boolean): void; startFullScreen(antialias: boolean): void;
stopFullScreen(): void; stopFullScreen(): void;
} }
@ -4062,7 +4111,7 @@ declare module Phaser {
remove(key: string): void; remove(key: string): void;
resume(): void; resume(): void;
restart(clearWorld?: boolean, clearCache?: boolean): void; restart(clearWorld?: boolean, clearCache?: boolean): void;
start(key: string, clearWorld?: boolean, clearCache?: boolean, ...args:any[]): void; start(key: string, clearWorld?: boolean, clearCache?: boolean, ...args: any[]): void;
update(): void; update(): void;
} }
@ -4191,9 +4240,9 @@ declare module Phaser {
addTilesetImage(tileset: string, key?: string, tileWidth?: number, tileHeight?: number, tileMargin?: number, tileSpacing?: number, gid?: number): Phaser.Tileset; addTilesetImage(tileset: string, key?: string, tileWidth?: number, tileHeight?: number, tileMargin?: number, tileSpacing?: number, gid?: number): Phaser.Tileset;
calculateFaces(layer: number): void; calculateFaces(layer: number): void;
copy(x: number, y: number, width: number, height: number, layer?: any): Phaser.Tile[]; copy(x: number, y: number, width: number, height: number, layer?: any): Phaser.Tile[];
create(name: string, width: number, height: number, tileWidth:number, tileHeight:number): Phaser.TilemapLayer; create(name: string, width: number, height: number, tileWidth: number, tileHeight: number): Phaser.TilemapLayer;
createBlankLayer(name: string, width: number, height: number, tileWidth: number, tileHeight: number, group?: Phaser.Group): Phaser.TilemapLayer; createBlankLayer(name: string, width: number, height: number, tileWidth: number, tileHeight: number, group?: Phaser.Group): Phaser.TilemapLayer;
createFromObjects(name: string, gid: any, key: string, frame?: any, exists?: boolean, autoCull?: boolean, group?: Phaser.Group, CustomClass?: Object, adjustY?:boolean): void; createFromObjects(name: string, gid: any, key: string, frame?: any, exists?: boolean, autoCull?: boolean, group?: Phaser.Group, CustomClass?: Object, adjustY?: boolean): void;
createLayer(layer: any, width?: number, height?: number, group?: Phaser.Group): Phaser.TilemapLayer; createLayer(layer: any, width?: number, height?: number, group?: Phaser.Group): Phaser.TilemapLayer;
destroy(): void; destroy(): void;
dump(): void; dump(): void;
@ -4265,7 +4314,7 @@ declare module Phaser {
type: number; type: number;
getRayCastTiles(line: Phaser.Line, stepRate?: number, collides?: boolean, interestingFace?: boolean): Phaser.Tile[]; getRayCastTiles(line: Phaser.Line, stepRate?: number, collides?: boolean, interestingFace?: boolean): Phaser.Tile[];
getTiles(x: number, y: number, width: number, height: number, collides?: boolean, interestingFace?:boolean): Phaser.Tile[]; getTiles(x: number, y: number, width: number, height: number, collides?: boolean, interestingFace?: boolean): Phaser.Tile[];
getTileX(x: number): Phaser.Tile; getTileX(x: number): Phaser.Tile;
getTileXY(x: number, y: number, point: Phaser.Point): Phaser.Point; getTileXY(x: number, y: number, point: Phaser.Point): Phaser.Point;
getTileY(y: number): Phaser.Tile; getTileY(y: number): Phaser.Tile;
@ -4564,6 +4613,7 @@ declare module Phaser {
start(x?: number, y?: number, color?: string, columnWidth?: number): void; start(x?: number, y?: number, color?: string, columnWidth?: number): void;
stop(): void; stop(): void;
text(text: string, x: number, y: number, color?: string, font?: string): void; text(text: string, x: number, y: number, color?: string, font?: string): void;
timer(timer: Phaser.Timer, x: number, y: number, color?: string): void;
} }