From df2a0485943983b53275db7ab045e4b497dd4f32 Mon Sep 17 00:00:00 2001 From: Mario Carballo Zama Date: Thu, 6 Feb 2014 00:20:40 -0600 Subject: [PATCH 1/5] Added description for pad len parameter --- src/utils/Utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/Utils.js b/src/utils/Utils.js index ac501e691..ccd6905a0 100644 --- a/src/utils/Utils.js +++ b/src/utils/Utils.js @@ -38,9 +38,9 @@ Phaser.Utils = { * dir = 1 (left), 2 (right), 3 (both) * @method Phaser.Utils.pad * @param {string} str - The target string. - * @param {number} len - Description. - * @param {number} pad - the string to pad it out with (defaults to a space). - * @param {number} [dir=3] the direction dir = 1 (left), 2 (right), 3 (both). + * @param {number} len - The number of characters to be added. + * @param {number} pad - The string to pad it out with (defaults to a space). + * @param {number} [dir=3] The direction dir = 1 (left), 2 (right), 3 (both). * @return {string} The padded string */ pad: function (str, len, pad, dir) { From 9e5e30bb123bdcf39284bbb2d2f435b990eaf351 Mon Sep 17 00:00:00 2001 From: photonstorm Date: Thu, 6 Feb 2014 19:36:33 +0000 Subject: [PATCH 2/5] Fixed TypeScript defs on lines 1741-1748 (thanks wombatbuddy) --- README.md | 1 + build/phaser.d.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6e10445f0..d7a463225 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Bug Fixes: * Explicitly paused Timer continues if you un-focus and focus the browser window (thanks georgiee) * Added TimerEvent.pendingDelete and checks in Timer.update, so that removing an event in a callback no longer throws an exception (thanks georgiee) +* Fixed TypeScript defs on lines 1741-1748 (thanks wombatbuddy) You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md diff --git a/build/phaser.d.ts b/build/phaser.d.ts index 03393e796..cc1d30877 100644 --- a/build/phaser.d.ts +++ b/build/phaser.d.ts @@ -1738,14 +1738,14 @@ 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: Array): boolean; From e11cae5373f302b6e54ee870cb3eba35532059ef Mon Sep 17 00:00:00 2001 From: photonstorm Date: Fri, 7 Feb 2014 02:49:59 +0000 Subject: [PATCH 3/5] Added the SAT class to the TypeScript defs file. Also this fixes #369. --- build/phaser.d.ts | 75 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/build/phaser.d.ts b/build/phaser.d.ts index cc1d30877..ff10a516a 100644 --- a/build/phaser.d.ts +++ b/build/phaser.d.ts @@ -1,3 +1,76 @@ +declare class SAT { + + flattenPointsOn(points: Array, normal: SAT.Vector, result: Array): Array; + isSeparatingAxis(aPos: SAT.Vector, bPos: SAT.Vector, aPoints: Array, bPoints: Array, 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); + pos: SAT.Vector; + points: Array; + 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; @@ -1748,7 +1821,7 @@ declare module Phaser { 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: Array): boolean; + separateTiles(body: Phaser.Physics.Arcade.Body, tile: Array): 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; From 27bca6a8c2d74cff5e7da6573b0876566f95d648 Mon Sep 17 00:00:00 2001 From: clark-stevenson Date: Sun, 9 Feb 2014 16:15:10 +0000 Subject: [PATCH 4/5] Update phaser.d.ts atlasJSONArray, atlasJSONHash should have optional parameters when it comes to URL/Object? Please disregard this if this is incorrect. --- build/phaser.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/phaser.d.ts b/build/phaser.d.ts index ff10a516a..0841c9721 100644 --- a/build/phaser.d.ts +++ b/build/phaser.d.ts @@ -1645,9 +1645,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; From e9ab2d30b6059ba24324bfc12604e935c43ec265 Mon Sep 17 00:00:00 2001 From: clark-stevenson Date: Sun, 9 Feb 2014 17:00:07 +0000 Subject: [PATCH 5/5] Update phaser.d.ts Sprite was missing height property --- build/phaser.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/build/phaser.d.ts b/build/phaser.d.ts index 0841c9721..fb4991ce1 100644 --- a/build/phaser.d.ts +++ b/build/phaser.d.ts @@ -845,6 +845,7 @@ declare module Phaser { visible: boolean; renderable: boolean; width: number; + height: number; health: number; damage(amount: number): Phaser.Sprite; }