Merge pull request #12 from edgarjcfn/master

Added Support for Typescript
This commit is contained in:
Lewis Lane
2014-10-16 13:26:27 +01:00
6 changed files with 73 additions and 7 deletions
+5
View File
@@ -1,3 +1,8 @@
Fork changelog
==============
[14.10.2014] - Added Typescript Support
Phaser Isometric Plug-in
=======================
+8 -2
View File
@@ -45,9 +45,9 @@
Phaser.Plugin.Isometric = function (game, parent) {
Phaser.Plugin.call(this, game, parent);
this.projector = new Phaser.Plugin.Isometric.Projector(this.game, Phaser.Plugin.Isometric.CLASSIC);
// Add an instance of Isometric.Projector to game.iso if it doesn't exist already
this.game.iso = this.game.iso || new Phaser.Plugin.Isometric.Projector(this.game, Phaser.Plugin.Isometric.CLASSIC);
this.game.iso = this.game.iso || this.projector;
};
Phaser.Plugin.Isometric.prototype = Object.create(Phaser.Plugin.prototype);
@@ -965,6 +965,12 @@ Phaser.GameObjectFactory.prototype.isoSprite = function (x, y, z, key, frame, gr
};
Phaser.Plugin.Isometric.prototype.addIsoSprite = function (x, y, z, key, frame, group) {
return Phaser.GameObjectFactory.prototype.isoSprite.call(this.game.add, x, y, z, key, frame, group);
};
Phaser.Utils.Debug.prototype.isoSprite = function (sprite, color, filled) {
if (!sprite.isoBounds) {
File diff suppressed because one or more lines are too long
+49
View File
@@ -0,0 +1,49 @@
declare module Phaser.Plugin {
class Isometric extends Phaser.Plugin {
projector: Phaser.Plugin.Isometric.Projector;
constructor(game: Phaser.Game, parent?: any);
addIsoSprite(x: number, y: number, z: number, key?: any, frame?: any, group?: Phaser.Group): Phaser.Sprite;
}
module Isometric {
class Projector {
game: Phaser.Game;
anchor: Phaser.Point;
projectionAngle: number;
project(point3:Phaser.Plugin.Isometric.Point3, out:Phaser.Point) : Phaser.Point;
projectXy(point3:Phaser.Plugin.Isometric.Point3, out:Phaser.Point) : Phaser.Point;
unproject(point:Phaser.Point, out: Phaser.Plugin.Isometric.Point3, z: number): Phaser.Plugin.Isometric.Point3;
simpleSort(group: Phaser.Group);
topologicalSort(group: Phaser.Group, padding: number, prop: string);
}
class Point3 {
x: number;
y: number;
z: number;
constructor(x: number, y: number, z: number);
copyFrom(source:Phaser.Plugin.Isometric.Point3) : Phaser.Plugin.Isometric.Point3;
copyto(dest:Phaser.Plugin.Isometric.Point3) : Phaser.Plugin.Isometric.Point3;
equals(a:Phaser.Plugin.Isometric.Point3) : boolean;
set(x: number, y: number, z: number) : Phaser.Plugin.Isometric.Point3;
setTo(x: number, y: number, z: number) : Phaser.Plugin.Isometric.Point3;
add(x: number, y: number) : Phaser.Plugin.Isometric.Point3;
subtract(x: number, y: number, z: number) : Phaser.Plugin.Isometric.Point3;
multiply(x: number, y: number, z: number) : Phaser.Plugin.Isometric.Point3;
divide(x: number, y: number, z: number) : Phaser.Plugin.Isometric.Point3;
}
class IsoSprite extends Phaser.Sprite{
snap: number;
constructor(game: Phaser.Game, x: number, y: number, z: number, key?: any, frame?: any);
}
}
}
+6
View File
@@ -264,6 +264,12 @@ Phaser.GameObjectFactory.prototype.isoSprite = function (x, y, z, key, frame, gr
};
Phaser.Plugin.Isometric.prototype.addIsoSprite = function (x, y, z, key, frame, group) {
return Phaser.GameObjectFactory.prototype.isoSprite.call(this.game.add, x, y, z, key, frame, group);
};
Phaser.Utils.Debug.prototype.isoSprite = function (sprite, color, filled) {
if (!sprite.isoBounds) {
+2 -2
View File
@@ -45,9 +45,9 @@
Phaser.Plugin.Isometric = function (game, parent) {
Phaser.Plugin.call(this, game, parent);
this.projector = new Phaser.Plugin.Isometric.Projector(this.game, Phaser.Plugin.Isometric.CLASSIC);
// Add an instance of Isometric.Projector to game.iso if it doesn't exist already
this.game.iso = this.game.iso || new Phaser.Plugin.Isometric.Projector(this.game, Phaser.Plugin.Isometric.CLASSIC);
this.game.iso = this.game.iso || this.projector;
};
Phaser.Plugin.Isometric.prototype = Object.create(Phaser.Plugin.prototype);