mirror of
https://github.com/wassname/phaser-plugin-isometric.git
synced 2026-09-09 11:28:50 +08:00
Merge pull request #12 from edgarjcfn/master
Added Support for Typescript
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
Fork changelog
|
||||
==============
|
||||
[14.10.2014] - Added Typescript Support
|
||||
|
||||
|
||||
Phaser Isometric Plug-in
|
||||
=======================
|
||||
|
||||
|
||||
Vendored
+8
-2
@@ -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) {
|
||||
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
Vendored
+49
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user