Added the SAT class to the TypeScript defs file. Also this fixes #369.

This commit is contained in:
photonstorm 2014-02-07 04:12:04 +00:00
parent ddc255382d
commit 6958ac73d3

73
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;