Updated TypeScript defs which now compiles against 1.2 (but still missing quite a few areas).

New build files that match them.
This commit is contained in:
photonstorm 2014-03-10 11:08:07 +00:00
parent 8fff38618d
commit 982823d875
6 changed files with 110 additions and 109 deletions

View file

@ -7,7 +7,7 @@
*
* Phaser - http://www.phaser.io
*
* v2.0.0 "Aes Sedai" - Built: Mon Mar 10 2014 02:30:54
* v2.0.0 "Aes Sedai" - Built: Mon Mar 10 2014 11:07:14
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -5758,17 +5758,21 @@ Phaser.Group = function (game, parent, name, addToStage) {
*/
this.cursor = null;
/**
* @property {number} _cursorIndex - Internal pointer.
* @private
*/
this._cursorIndex = 0;
/**
* @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.
*/
this.cameraOffset = new Phaser.Point();
/**
* @property {boolean} enableBody - If true all Sprites created with `Group.create` or `Group.createMulitple` will have a physics body created on them. Change the body type with `Group.physicsBodyType`.
*/
this.enableBody = false;
/**
* @property {number} physicsBodyType - If Group.enableBody is true this is the type of physics body that is created on new Sprites. Phaser.Physics.ARCADE, Phaser.Physics.P2, Phaser.Physics.NINJA, etc.
*/
this.physicsBodyType = Phaser.Physics.ARCADE;
/**
* A small internal cache:
* 0 = previous position.x
@ -5779,10 +5783,11 @@ Phaser.Group = function (game, parent, name, addToStage) {
* 5 = outOfBoundsFired (0 = no, 1 = yes)
* 6 = exists (0 = no, 1 = yes)
* 7 = fixed to camera (0 = no, 1 = yes)
* 8 = cursor index
* @property {Int16Array} _cache
* @private
*/
this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]);
this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0, 0]);
};
@ -5935,6 +5940,22 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists) {
this.cursor = child;
}
if (this.enableBody)
{
if (this.physicsBodyType === Phaser.Physics.ARCADE)
{
child.body = new Phaser.Physics.Arcade.Body(child);
}
else if (this.physicsBodyType === Phaser.Physics.NINJA && this.game.physics.ninja)
{
child.body = new Phaser.Physics.Ninja.Body(this.game.physics.ninja, child, 1);
}
else if (this.physicsBodyType === Phaser.Physics.P2 && this.game.physics.p2)
{
child.body = new Phaser.Physics.P2.Body(this.game, child, x, y, 1);
}
}
return child;
}
@ -5971,16 +5992,16 @@ Phaser.Group.prototype.next = function () {
if (this.cursor)
{
// Wrap the cursor?
if (this._cursorIndex === this.children.length)
if (this._cache[8] === this.children.length)
{
this._cursorIndex = 0;
this._cache[8] = 0;
}
else
{
this._cursorIndex++;
this._cache[8]++;
}
this.cursor = this.children[this._cursorIndex];
this.cursor = this.children[this._cache[8]];
}
}
@ -5995,16 +6016,16 @@ Phaser.Group.prototype.previous = function () {
if (this.cursor)
{
// Wrap the cursor?
if (this._cursorIndex === 0)
if (this._cache[8] === 0)
{
this._cursorIndex = this.children.length - 1;
this._cache[8] = this.children.length - 1;
}
else
{
this._cursorIndex--;
this._cache[8]--;
}
this.cursor = this.children[this._cursorIndex];
this.cursor = this.children[this._cache[8]];
}
}
@ -35120,7 +35141,7 @@ Phaser.Physics.Arcade.prototype = {
* A game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.
*
* @method Phaser.Physics.Arcade#enable
* @param {object|array|Phaser.Group} object - The game object to create the physics body on. Can also be an array of objects, a body will be created on every object in the array that has a body parameter.
* @param {object|array|Phaser.Group} object - The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a `body` property.
* @param {boolean} [children=true] - Should a body be created on all children of this object? If true it will propagate down the display list.
*/
enable: function (object, children) {
@ -35855,7 +35876,7 @@ Phaser.Physics.Arcade.prototype = {
// This is special case code that handles things like horizontal moving platforms you can ride
if (body2.moves)
{
body1.x += body2.x - body2.preX;
body1.x += body2.x - body2.prev.x;
}
}
else if (!body2.immovable)
@ -35866,7 +35887,7 @@ Phaser.Physics.Arcade.prototype = {
// This is special case code that handles things like horizontal moving platforms you can ride
if (body1.moves)
{
body2.x += body1.x - body1.preX;
body2.x += body1.x - body1.prev.x;
}
}

File diff suppressed because one or more lines are too long

72
build/phaser.d.ts vendored
View file

@ -2521,21 +2521,13 @@ declare module Phaser {
class Arcade {
//constructor
constructor(game: Phaser.Game);
//static methods
static CIRCLE: number;
static POLYGON: number;
static RECT: number;
//members
bounds: Phaser.Rectangle;
game: Phaser.Game;
gravity: Phaser.Point;
maxLevels: number;
maxObjects: number;
quadTree: Phaser.QuadTree;
worldBottom: SAT.Box;
worldLeft: SAT.Box;
worldPolys: SAT.Polygon[];
worldRight: SAT.Box;
worldTop: SAT.Box;
//methods
accelerateToObject(displayObject: any, destination: any, speed?: number, xSpeedMax?: number, ySpeedMax?: number): number;
accelerateToPointer(displayObject: any, pointer: any, speed?: number, xSpeedMax?: number, ySpeedMax?: number): number;
@ -2568,13 +2560,18 @@ declare module Phaser {
module Arcade {
class FaceChoices {
none: boolean;
any: boolean;
up: boolean;
down: boolean;
left: boolean;
right: boolean;
}
class Body {
//constructor
constructor(sprite: Phaser.Sprite);
//static members
static CIRCLE: number;
static POLYGON: number;
static RECT: number;
//members
acceleration: Phaser.Point;
allowGravity: boolean;
@ -2583,23 +2580,21 @@ declare module Phaser {
angularAcceleration: number;
angularDrag: number;
angularVelocity: number;
blocked: FaceChoices;
bottom: number;
bounce: Phaser.Point;
checkCollision: FaceChoices;
collideCallback: any;
collideCallbackContext: any;
collideWorldBounds: boolean;
contacts: Phaser.Physics.Arcade.Body[];
customSeparateCallback: Function;
customSeparateContext: any;
drag: Phaser.Point;
facing: number;
game: Phaser.Game;
gravity: Phaser.Point;
height: number;
immovable: boolean;
left: number;
linearDamping: number;
mass: number;
maxAngular: number;
maxVelocity: Phaser.Point;
@ -2608,14 +2603,13 @@ declare module Phaser {
offset: Phaser.Point;
overlapX: number;
overlapY: number;
polygon: SAT.Polygon;
preRotation: number;
preX: number;
preY: number;
prev: Phaser.Point;
rebound: boolean;
right: number;
rotation: number;
shape: any;
speed: number;
sprite: Phaser.Sprite;
top: number;
@ -2626,55 +2620,19 @@ declare module Phaser {
x: number;
y: number;
//methods
add(v:SAT.Vector): void;
addContact(body: Phaser.Physics.Arcade.Body): boolean;
applyDamping(): void;
checkBlocked(): void;
checkWorldBounds(): void;
deltaX(): number;
deltaY(): number;
deltaZ(): number;
destroy(): void;
exchange(body: Phaser.Physics.Arcade.Body): void;
getDownwardForce(): number;
getUpwardForce(): number;
give(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
hitBottom(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
hitLeft(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
hitRight(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
hitTop(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
inContact(body: Phaser.Physics.Arcade.Body): boolean;
integrateVelocity(): void;
onFloor(): boolean;
onWall(): boolean;
overlap(body: Phaser.Physics.Arcade.Body, response: SAT.Response): boolean;
postUpdate(): void;
preUpdate(): void;
processRebound(body: Phaser.Physics.Arcade.Body): void;
reboundCheck(x: number, y: number, rebound: boolean): void;
removeContact(body: Phaser.Physics.Arcade.Body): boolean;
setSize(width: number, height: number, offsetX: number, offsetY: number): void;
reset(full: boolean): void;
separate(body: Phaser.Physics.Arcade.Body, response: SAT.Response): boolean;
setCircle(radius: number, offsetX?: number, offsetY?: number): void;
setPolygon(points: any[]): void;
setRectangle(width?: number, height?: number, translateX?: number, translateY?: number): void;
split(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
sub(v: SAT.Vector): void;
take(body: Phaser.Physics.Arcade.Body, response: SAT.Response): void;
translate(x: number, y: number): void;
update(): void;
updateBounds(): void;
updateScale(): void;
}
class FaceChoices {
none: boolean;
any: boolean;
up: boolean;
down: boolean;
left: boolean;
right: boolean;
x: number;
y: number;
}
}
}

View file

@ -7,7 +7,7 @@
*
* Phaser - http://www.phaser.io
*
* v2.0.0 "Aes Sedai" - Built: Mon Mar 10 2014 02:30:55
* v2.0.0 "Aes Sedai" - Built: Mon Mar 10 2014 11:07:15
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -9603,7 +9603,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
*
* Phaser - http://www.phaser.io
*
* v2.0.0 "Aes Sedai" - Built: Mon Mar 10 2014 02:30:54
* v2.0.0 "Aes Sedai" - Built: Mon Mar 10 2014 11:07:14
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -15354,17 +15354,21 @@ Phaser.Group = function (game, parent, name, addToStage) {
*/
this.cursor = null;
/**
* @property {number} _cursorIndex - Internal pointer.
* @private
*/
this._cursorIndex = 0;
/**
* @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.
*/
this.cameraOffset = new Phaser.Point();
/**
* @property {boolean} enableBody - If true all Sprites created with `Group.create` or `Group.createMulitple` will have a physics body created on them. Change the body type with `Group.physicsBodyType`.
*/
this.enableBody = false;
/**
* @property {number} physicsBodyType - If Group.enableBody is true this is the type of physics body that is created on new Sprites. Phaser.Physics.ARCADE, Phaser.Physics.P2, Phaser.Physics.NINJA, etc.
*/
this.physicsBodyType = Phaser.Physics.ARCADE;
/**
* A small internal cache:
* 0 = previous position.x
@ -15375,10 +15379,11 @@ Phaser.Group = function (game, parent, name, addToStage) {
* 5 = outOfBoundsFired (0 = no, 1 = yes)
* 6 = exists (0 = no, 1 = yes)
* 7 = fixed to camera (0 = no, 1 = yes)
* 8 = cursor index
* @property {Int16Array} _cache
* @private
*/
this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]);
this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0, 0]);
};
@ -15531,6 +15536,22 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists) {
this.cursor = child;
}
if (this.enableBody)
{
if (this.physicsBodyType === Phaser.Physics.ARCADE)
{
child.body = new Phaser.Physics.Arcade.Body(child);
}
else if (this.physicsBodyType === Phaser.Physics.NINJA && this.game.physics.ninja)
{
child.body = new Phaser.Physics.Ninja.Body(this.game.physics.ninja, child, 1);
}
else if (this.physicsBodyType === Phaser.Physics.P2 && this.game.physics.p2)
{
child.body = new Phaser.Physics.P2.Body(this.game, child, x, y, 1);
}
}
return child;
}
@ -15567,16 +15588,16 @@ Phaser.Group.prototype.next = function () {
if (this.cursor)
{
// Wrap the cursor?
if (this._cursorIndex === this.children.length)
if (this._cache[8] === this.children.length)
{
this._cursorIndex = 0;
this._cache[8] = 0;
}
else
{
this._cursorIndex++;
this._cache[8]++;
}
this.cursor = this.children[this._cursorIndex];
this.cursor = this.children[this._cache[8]];
}
}
@ -15591,16 +15612,16 @@ Phaser.Group.prototype.previous = function () {
if (this.cursor)
{
// Wrap the cursor?
if (this._cursorIndex === 0)
if (this._cache[8] === 0)
{
this._cursorIndex = this.children.length - 1;
this._cache[8] = this.children.length - 1;
}
else
{
this._cursorIndex--;
this._cache[8]--;
}
this.cursor = this.children[this._cursorIndex];
this.cursor = this.children[this._cache[8]];
}
}
@ -44716,7 +44737,7 @@ Phaser.Physics.Arcade.prototype = {
* A game object can only have 1 physics body active at any one time, and it can't be changed until the object is destroyed.
*
* @method Phaser.Physics.Arcade#enable
* @param {object|array|Phaser.Group} object - The game object to create the physics body on. Can also be an array of objects, a body will be created on every object in the array that has a body parameter.
* @param {object|array|Phaser.Group} object - The game object to create the physics body on. Can also be an array or Group of objects, a body will be created on every child that has a `body` property.
* @param {boolean} [children=true] - Should a body be created on all children of this object? If true it will propagate down the display list.
*/
enable: function (object, children) {
@ -45451,7 +45472,7 @@ Phaser.Physics.Arcade.prototype = {
// This is special case code that handles things like horizontal moving platforms you can ride
if (body2.moves)
{
body1.x += body2.x - body2.preX;
body1.x += body2.x - body2.prev.x;
}
}
else if (!body2.immovable)
@ -45462,7 +45483,7 @@ Phaser.Physics.Arcade.prototype = {
// This is special case code that handles things like horizontal moving platforms you can ride
if (body1.moves)
{
body2.x += body1.x - body1.preX;
body2.x += body1.x - body1.prev.x;
}
}

File diff suppressed because one or more lines are too long

6
build/phaser.min.js vendored

File diff suppressed because one or more lines are too long