Fixed the TypeScript definitions to include the missing SAT classes and other small tweaks. Updated README.

This commit is contained in:
photonstorm 2014-02-10 02:37:00 +00:00
parent 16fa37081f
commit 10252543f2
2 changed files with 103 additions and 18 deletions

View file

@ -23,6 +23,8 @@ By Richard Davey, [Photon Storm](http://www.photonstorm.com)
Welcome to Phaser
-----------------
Update: 10th February 2014 - Due to an issue with our TypeScript defintions file we have updated the `master` branch of Phaser. If you are having problems compiling with Visual Studio then please re-pull 1.1.4.
As you may know we had planned to release 1.1.4 at the end of 2013. For various reasons this didn't quite happen, but we're happy to announce it's finally out! There have been some dramatic changes internally, and if you make use of either the physics systems or tilemaps then you are going to need to update your code. Hopefully only a little bit, but there have been a number of core API changes which we detail below. There are also a host of new features, the headliners being:
* New Physics system. Uses SAT.js internally so physics bodies can now be rectangles, circles or polygons and support rotation.
@ -268,11 +270,11 @@ CDNJS
Thanks to a community member Phaser is now available on [CDNJS](http://cdnjs.com). You can include the following in your html:
`http://cdnjs.cloudflare.com/ajax/libs/phaser/1.1.3/phaser.min.js`
`http://cdnjs.cloudflare.com/ajax/libs/phaser/1.1.4/phaser.min.js`
Or if you prefer you can leave the protocol off, so it works via http and https:
`//cdnjs.cloudflare.com/ajax/libs/phaser/1.1.3/phaser.min.js`
`//cdnjs.cloudflare.com/ajax/libs/phaser/1.1.4/phaser.min.js`
Requirements

115
build/phaser.d.ts vendored
View file

@ -1,3 +1,76 @@
declare class SAT {
flattenPointsOn(points: Array<SAT.Vector>, normal: SAT.Vector, result: Array<number>): Array<number>;
isSeparatingAxis(aPos: SAT.Vector, bPos: SAT.Vector, aPoints: Array<SAT.Vector>, bPoints: Array<SAT.Vector>, axis: SAT.Vector, response: SAT.Response): boolean;
vornoiRegion(line: SAT.Vector, point: SAT.Vector): number;
testCircleCircle(a: SAT.Circle, b: SAT.Circle, response: SAT.Response): boolean;
testPolygonCircle(a: SAT.Polygon, b: SAT.Circle, response: SAT.Response): boolean;
testCirclePolygon(a: SAT.Circle, b: SAT.Polygon, response: SAT.Response): boolean;
testPolygonPolygon(a: SAT.Polygon, b: SAT.Polygon, response: SAT.Response): boolean;
}
declare module SAT {
class Vector {
constructor(x: number, y: number);
x: number;
y: number;
copy(other: SAT.Vector): SAT.Vector;
perp(): SAT.Vector;
rotate(angle: number): SAT.Vector;
rotatePrecalc(sin: number, cos: number): SAT.Vector;
reverse(): SAT.Vector;
normalize(): SAT.Vector;
add(other: SAT.Vector): SAT.Vector;
sub(other: SAT.Vector): SAT.Vector;
scale(x: number, y: number): SAT.Vector;
project(other: SAT.Vector): SAT.Vector;
projectN(other: SAT.Vector): SAT.Vector;
reflect(axis: SAT.Vector): SAT.Vector;
reflectN(axis: SAT.Vector): SAT.Vector;
dot(other: SAT.Vector): SAT.Vector;
len2(): SAT.Vector;
len(): SAT.Vector;
}
class Circle {
constructor(pos: SAT.Vector, radius: number);
pos: SAT.Vector;
r: number;
}
class Polygon {
constructor(pos: SAT.Vector, points: Array<SAT.Vector>);
pos: SAT.Vector;
points: Array<SAT.Vector>;
recalc(): SAT.Polygon;
rotate(angle: number): SAT.Polygon;
scale(x: number, y: number): SAT.Polygon;
translate(x: number, y: number): SAT.Polygon;
}
class Box {
constructor(pos: SAT.Vector, w: number, h: number);
pos: SAT.Vector;
w: number;
h: number;
toPolygon(): SAT.Polygon;
}
class Response {
constructor();
a: any;
b: any;
overlapN: SAT.Vector;
overlapV: SAT.Vector;
clear(): SAT.Response;
aInB: boolean;
bInA: boolean;
overlap: number;
}
}
declare class Phaser {
static VERSION: string;
static DEV_VERSION: string;
@ -772,6 +845,7 @@ declare module Phaser {
visible: boolean;
renderable: boolean;
width: number;
height: number;
health: number;
damage(amount: number): Phaser.Sprite;
}
@ -1572,9 +1646,9 @@ declare module Phaser {
tilemap(key: string, tilesetURL: string, mapDataURL?: string, mapData?: Object, format?: string): void;
tileset(key: string, url: string, tileWidth: number, tileHeight: number, tileMargin?: number, tileSpacing?: number, rows?: number, columns?: number, limit?: number): void;
bitmapFont(key: string, textureURL: string, xmlURL?: string, xmlData?: Object): void;
atlasJSONArray(key: string, textureURL: string, atlasURL: string, atlasData: Object): void;
atlasJSONHash(key: string, textureURL: string, atlasURL: string, atlasData: Object): void;
atlasXML(key: string, textureURL: string, atlasURL: string, atlasData: Object): void;
atlasJSONArray(key: string, textureURL: string, atlasURL?: string, atlasData?: Object): void;
atlasJSONHash(key: string, textureURL: string, atlasURL?: string, atlasData?: Object): void;
atlasXML(key: string, textureURL: string, atlasURL?: string, atlasData?: Object): void;
atlas(key: string, textureURL: string, atlasURL?: string, atlasData?: Object, format?: number): void;
removeFile(key: string): void;
removeAll(): void;
@ -1738,17 +1812,17 @@ declare module Phaser {
updateMotion(body: Phaser.Physics.Arcade.Body): Phaser.Point;
overlap(object1: any, object2: any, overlapCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
collide(object1: any, object2: any, collideCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
collideHandler(object1: any, object2: any, collideCallback?: Function, processCallback?: Function, callbackContext?: any, overlapOnly: boolean): boolean;
collideSpriteVsSprite(sprite1: Phaser.Sprite, sprite2: Phaser.Sprite, collideCallback?: Function, processCallback?: Function, callbackContext?: any, overlapOnly: boolean): boolean;
collideSpriteVsGroup(sprite1: Phaser.Sprite, group: Phaser.Group, collideCallback?: Function, processCallback?: Function, callbackContext?: any, overlapOnly: boolean): boolean;
collideGroupVsSelf(group: Phaser.Group, collideCallback?: Function, processCallback?: Function, callbackContext?: any, overlapOnly: boolean): boolean;
collideGroupVsGroup(group: Phaser.Group, group2: Phaser.Group, collideCallback?: Function, processCallback?: Function, callbackContext?: any, overlapOnly: boolean): boolean;
collideSpriteVsTilemapLayer(sprite: Phaser.Sprite, tilemapLayer: Phaser.TilemapLayer, collideCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
collideGroupVsTilemapLayer(group: Phaser.Group, tilemapLayer: Phaser.TilemapLayer, collideCallback?: Function, processCallback?: Function, callbackContext?: any): boolean;
separate(body: Phaser.Physics.Arcade.Body, body2: Phaser.Physics.Arcade.Body, processCallback?: Function, callbackContext?: any, overlapOnly: boolean): boolean;
collideHandler(object1: any, object2: any, collideCallback: Function, processCallback: Function, callbackContext: any, overlapOnly: boolean): boolean;
collideSpriteVsSprite(sprite1: Phaser.Sprite, sprite2: Phaser.Sprite, collideCallback: Function, processCallback: Function, callbackContext: any, overlapOnly: boolean): boolean;
collideSpriteVsGroup(sprite1: Phaser.Sprite, group: Phaser.Group, collideCallback: Function, processCallback: Function, callbackContext: any, overlapOnly: boolean): boolean;
collideGroupVsSelf(group: Phaser.Group, collideCallback: Function, processCallback: Function, callbackContext: any, overlapOnly: boolean): boolean;
collideGroupVsGroup(group: Phaser.Group, group2: Phaser.Group, collideCallback: Function, processCallback: Function, callbackContext: any, overlapOnly: boolean): boolean;
collideSpriteVsTilemapLayer(sprite: Phaser.Sprite, tilemapLayer: Phaser.TilemapLayer, collideCallback: Function, processCallback: Function, callbackContext: any): boolean;
collideGroupVsTilemapLayer(group: Phaser.Group, tilemapLayer: Phaser.TilemapLayer, collideCallback: Function, processCallback: Function, callbackContext: any): boolean;
separate(body: Phaser.Physics.Arcade.Body, body2: Phaser.Physics.Arcade.Body, processCallback: Function, callbackContext: any, overlapOnly: boolean): boolean;
intersects(a: Phaser.Physics.Arcade.Body, b: Phaser.Physics.Arcade.Body): boolean;
tileIntersects(body: Phaser.Physics.Arcade.Body, tile: Phaser.Tile): boolean;
separateTiles(body: Phaser.Physics.Arcade.Body, tile: <Phaser.Tile>Array): boolean;
separateTiles(body: Phaser.Physics.Arcade.Body, tile: Array<Phaser.Tile>): boolean;
separateTile(body: Phaser.Physics.Arcade.Body, tile: Phaser.Tile): boolean;
processTileSeparation(body: Phaser.Physics.Arcade.Body): boolean;
moveToObject(displayObject: Phaser.Sprite, destination: Phaser.Sprite, speed?: number, maxTime?: number): number;
@ -2038,9 +2112,18 @@ declare module Phaser {
toString(): string;
}
class TilemapRenderer {
constructor(game: Phaser.Game);
game: Phaser.Game;
render(tilemap: Tilemap): void;
class Tileset {
constructor(name: string, firstgid: number, width: number, height: number, margin: number, spacing: number, properties: any);
name: string;
firstgid: number;
tileWidth: number;
tileHeight: number;
tileMargin: number;
tileSpacing: number;
properties: any;
image: any;
rows: number;
setSpacing(margin: number, spacing: number);
}
}