mirror of
https://github.com/wassname/phaser.git
synced 2026-09-11 12:31:29 +08:00
Whole codebase updated to TypeScript 0.9.1, phew!
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - GameMath
|
||||
@@ -25,7 +25,7 @@ module Phaser {
|
||||
}
|
||||
}
|
||||
|
||||
public game: Game;
|
||||
public game: Phaser.Game;
|
||||
|
||||
// Pre-calculated tables containing Math.sin(angle) and Math.cos(angle) from -180 to 180
|
||||
// So sinA[sprite.rotation] would be the same as Math.sin(sprite.rotation) without a call to Math.sin
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../gameobjects/IGameObject.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - LinkedList
|
||||
@@ -23,7 +23,8 @@ module Phaser {
|
||||
/**
|
||||
* Stores a reference to an <code>IGameObject</code>.
|
||||
*/
|
||||
public object: IGameObject;
|
||||
//public object: IGameObject;
|
||||
public object;
|
||||
|
||||
/**
|
||||
* Stores a reference to the next link in the list.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Mat3
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../math/Vec2.ts" />
|
||||
/// <reference path="../math/Mat3.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Mat3Utils
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../geom/Rectangle.ts" />
|
||||
/// <reference path="LinkedList.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - QuadTree
|
||||
@@ -23,7 +21,8 @@ module Phaser {
|
||||
* @param {Number} height Desired height of this node.
|
||||
* @param {Number} parent The parent branch or node. Pass null to create a root.
|
||||
*/
|
||||
constructor(manager: Phaser.Physics.Manager, x: number, y: number, width: number, height: number, parent: QuadTree = null) {
|
||||
//constructor(manager: Phaser.Physics.Manager, x: number, y: number, width: number, height: number, parent: QuadTree = null) {
|
||||
constructor(manager, x: number, y: number, width: number, height: number, parent: QuadTree = null) {
|
||||
|
||||
super(x, y, width, height);
|
||||
|
||||
@@ -104,7 +103,8 @@ module Phaser {
|
||||
private _overlapProcessed: boolean;
|
||||
private _checkObject;
|
||||
|
||||
public static physics: Phaser.Physics.Manager;
|
||||
//public static physics: Phaser.Physics.Manager;
|
||||
public static physics;
|
||||
|
||||
/**
|
||||
* Flag for specifying that you want to add an object to the A list.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
var Shapes;
|
||||
(function (Shapes) {
|
||||
|
||||
var Point = Shapes.Point = (function () {
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.prototype.getDist = function () {
|
||||
return Math.sqrt((this.x * this.x) + (this.y * this.y));
|
||||
};
|
||||
Point.origin = new Point(0, 0);
|
||||
return Point;
|
||||
})();
|
||||
|
||||
})(Shapes || (Shapes = {}));
|
||||
|
||||
var p = new Shapes.Point(3, 4);
|
||||
var dist = p.getDist();
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - RandomDataGenerator
|
||||
@@ -17,7 +17,7 @@ module Phaser {
|
||||
* @param {Array} seeds
|
||||
* @return {Phaser.RandomDataGenerator}
|
||||
*/
|
||||
constructor(seeds: string[] = []) {
|
||||
constructor(seeds: string[]= []) {
|
||||
|
||||
this.sow(seeds);
|
||||
|
||||
@@ -55,7 +55,7 @@ module Phaser {
|
||||
* @method uint32
|
||||
* @private
|
||||
*/
|
||||
private uint32() {
|
||||
private uint32(): number {
|
||||
|
||||
return this.rnd.apply(this) * 0x100000000; // 2^32
|
||||
|
||||
@@ -65,7 +65,7 @@ module Phaser {
|
||||
* @method fract32
|
||||
* @private
|
||||
*/
|
||||
private fract32() {
|
||||
private fract32(): number {
|
||||
|
||||
return this.rnd.apply(this) + (this.rnd.apply(this) * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53
|
||||
|
||||
@@ -76,7 +76,7 @@ module Phaser {
|
||||
* @method rnd
|
||||
* @private
|
||||
*/
|
||||
private rnd() {
|
||||
private rnd(): number {
|
||||
|
||||
var t = 2091639 * this.s0 + this.c * 2.3283064365386963e-10; // 2^-32
|
||||
|
||||
@@ -122,7 +122,7 @@ module Phaser {
|
||||
* @method sow
|
||||
* @param {Array} seeds
|
||||
*/
|
||||
public sow(seeds: string[] = []) {
|
||||
public sow(seeds: string[]= []) {
|
||||
|
||||
this.s0 = this.hash(' ');
|
||||
this.s1 = this.hash(this.s0);
|
||||
@@ -230,7 +230,7 @@ module Phaser {
|
||||
b = a = '';
|
||||
a++ < 36;
|
||||
b += ~a % 5 | a * 3 & 4 ? (a ^ 15 ? 8 ^ this.frac * (a ^ 20 ? 16 : 4) : 4).toString(16) : '-'
|
||||
);
|
||||
);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
+18
-19
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Vec2
|
||||
@@ -47,7 +47,7 @@ module Phaser {
|
||||
* @param {any} source - The object to copy from.
|
||||
* @return {Vec2} This Vec2 object.
|
||||
**/
|
||||
public copyFrom(source: any): Vec2 {
|
||||
public copyFrom(source: any): Phaser.Vec2 {
|
||||
return this.setTo(source.x, source.y);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ module Phaser {
|
||||
* @param {Number} y The y position of the vector
|
||||
* @return {Vec2} This object
|
||||
**/
|
||||
public setTo(x: number, y: number): Vec2 {
|
||||
public setTo(x: number, y: number): Phaser.Vec2 {
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -71,7 +71,7 @@ module Phaser {
|
||||
* @param {Vec2} other The other Vector.
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public add(a: Vec2): Vec2 {
|
||||
public add(a: Phaser.Vec2): Phaser.Vec2 {
|
||||
|
||||
this.x += a.x;
|
||||
this.y += a.y;
|
||||
@@ -85,7 +85,7 @@ module Phaser {
|
||||
* @param {Vec2} other The other Vector.
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public subtract(v: Vec2): Vec2 {
|
||||
public subtract(v: Phaser.Vec2): Phaser.Vec2 {
|
||||
|
||||
this.x -= v.x;
|
||||
this.y -= v.y;
|
||||
@@ -99,7 +99,7 @@ module Phaser {
|
||||
* @param {Vec2} other The other Vector.
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public multiply(v: Vec2): Vec2 {
|
||||
public multiply(v: Phaser.Vec2): Phaser.Vec2 {
|
||||
|
||||
this.x *= v.x;
|
||||
this.y *= v.y;
|
||||
@@ -113,7 +113,7 @@ module Phaser {
|
||||
* @param {Vec2} other The other Vector.
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public divide(v: Vec2): Vec2 {
|
||||
public divide(v: Phaser.Vec2): Phaser.Vec2 {
|
||||
|
||||
this.x /= v.x;
|
||||
this.y /= v.y;
|
||||
@@ -144,7 +144,7 @@ module Phaser {
|
||||
*
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public normalize(): Vec2 {
|
||||
public normalize(): Phaser.Vec2 {
|
||||
|
||||
var inv = (this.x != 0 || this.y != 0) ? 1 / Math.sqrt(this.x * this.x + this.y * this.y) : 0;
|
||||
this.x *= inv;
|
||||
@@ -159,7 +159,7 @@ module Phaser {
|
||||
* @param {Vec2} a Reference to a source Vec2 object.
|
||||
* @return {Number}
|
||||
*/
|
||||
public dot(a: Vec2): number {
|
||||
public dot(a: Phaser.Vec2): number {
|
||||
return ((this.x * a.x) + (this.y * a.y));
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ module Phaser {
|
||||
* @param {Vec2} a Reference to a source Vec2 object.
|
||||
* @return {Number}
|
||||
*/
|
||||
public cross(a: Vec2): number {
|
||||
public cross(a: Phaser.Vec2): number {
|
||||
return ((this.x * a.y) - (this.y * a.x));
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ module Phaser {
|
||||
* @param {Vec2} a Reference to a source Vec2 object.
|
||||
* @return {Number}
|
||||
*/
|
||||
public projectionLength(a: Vec2): number {
|
||||
public projectionLength(a: Phaser.Vec2): number {
|
||||
|
||||
var den: number = a.dot(a);
|
||||
|
||||
@@ -200,7 +200,7 @@ module Phaser {
|
||||
* @param {Vec2} a Reference to a source Vec2 object.
|
||||
* @return {Number}
|
||||
*/
|
||||
public angle(a: Vec2): number {
|
||||
public angle(a: Phaser.Vec2): number {
|
||||
return Math.atan2(a.x * this.y - a.y * this.x, a.x * this.x + a.y * this.y);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ module Phaser {
|
||||
* @param {?number=} y The scaling factor in the y direction. If this is not specified, the x scaling factor will be used.
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public scale(x: number, y:number): Vec2 {
|
||||
public scale(x: number, y: number): Phaser.Vec2 {
|
||||
|
||||
this.x *= x;
|
||||
this.y *= y || x;
|
||||
@@ -225,7 +225,7 @@ module Phaser {
|
||||
* @param {number} scalar
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public multiplyByScalar(scalar: number): Vec2 {
|
||||
public multiplyByScalar(scalar: number): Phaser.Vec2 {
|
||||
|
||||
this.x *= scalar;
|
||||
this.y *= scalar;
|
||||
@@ -240,7 +240,7 @@ module Phaser {
|
||||
* @param {number} scalar
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public multiplyAddByScalar(a: Vec2, scalar: number): Vec2 {
|
||||
public multiplyAddByScalar(a: Phaser.Vec2, scalar: number): Phaser.Vec2 {
|
||||
|
||||
this.x += a.x * scalar;
|
||||
this.y += a.y * scalar;
|
||||
@@ -254,7 +254,7 @@ module Phaser {
|
||||
* @param {number} scalar
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public divideByScalar(scalar: number): Vec2 {
|
||||
public divideByScalar(scalar: number): Phaser.Vec2 {
|
||||
|
||||
this.x /= scalar;
|
||||
this.y /= scalar;
|
||||
@@ -267,7 +267,7 @@ module Phaser {
|
||||
*
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public reverse(): Vec2 {
|
||||
public reverse(): Phaser.Vec2 {
|
||||
|
||||
this.x = -this.x;
|
||||
this.y = -this.y;
|
||||
@@ -290,8 +290,7 @@ module Phaser {
|
||||
* @return {string} a string representation of the object.
|
||||
**/
|
||||
public toString(): string {
|
||||
//return "[{Vec2 (x=" + this.x + " y=" + this.y + ")}]";
|
||||
return "x=" + this.x + " y=" + this.y;
|
||||
return "[{Vec2 (x=" + this.x + " y=" + this.y + ")}]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="Vec2.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Vec2Utils
|
||||
|
||||
Reference in New Issue
Block a user