Whole codebase updated to TypeScript 0.9.1, phew!

This commit is contained in:
Richard Davey
2013-08-08 19:16:47 +01:00
parent df32190db8
commit 1248a6c06e
129 changed files with 38471 additions and 30343 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/// <reference path="../Game.ts" />
/// <reference path="../_definitions.ts" />
/**
* Phaser - Components - Events
@@ -30,7 +30,7 @@ module Phaser.Components {
/**
* Reference to Phaser.Game
*/
public game: Game;
public game: Phaser.Game;
/**
* Local private reference to its parent game object.
+32 -40
View File
@@ -1,12 +1,4 @@
/// <reference path="../Game.ts" />
/// <reference path="../tweens/Tween.ts" />
/// <reference path="../particles/ArcadeEmitter.ts" />
/// <reference path="../particles/ArcadeParticle.ts" />
/// <reference path="../gameobjects/Sprite.ts" />
/// <reference path="../ui/Button.ts" />
/// <reference path="../gameobjects/ScrollZone.ts" />
/// <reference path="../display/DynamicTexture.ts" />
/// <reference path="../tilemap/Tilemap.ts" />
/// <reference path="../_definitions.ts" />
/**
* Phaser - GameObjectFactory
@@ -48,7 +40,7 @@ module Phaser {
* @param height {number} Height of the new camera.
* @returns {Camera} The newly created camera object.
*/
public camera(x: number, y: number, width: number, height: number): Camera {
public camera(x: number, y: number, width: number, height: number): Phaser.Camera {
return this._world.cameras.addCamera(x, y, width, height);
}
@@ -76,8 +68,8 @@ module Phaser {
* @param [downFrame] {string|number} This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
* @returns {Button} The newly created button object.
*/
public button(x: number = 0, y: number = 0, key: string = null, callback = null, callbackContext = null, overFrame = null, outFrame = null, downFrame = null): UI.Button {
return <UI.Button> this._world.group.add(new UI.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame));
public button(x: number = 0, y: number = 0, key: string = null, callback = null, callbackContext = null, overFrame = null, outFrame = null, downFrame = null): Phaser.UI.Button {
return <Phaser.UI.Button> this._world.group.add(new Phaser.UI.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame));
}
/**
@@ -89,12 +81,12 @@ module Phaser {
* @param [frame] {string|number} If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
* @returns {Sprite} The newly created sprite object.
*/
public sprite(x: number, y: number, key: string = '', frame = null): Sprite {
return <Sprite> this._world.group.add(new Sprite(this.game, x, y, key, frame));
public sprite(x: number, y: number, key: string = '', frame = null): Phaser.Sprite {
return <Phaser.Sprite> this._world.group.add(new Phaser.Sprite(this.game, x, y, key, frame));
}
public audio(key: string, volume: number = 1, loop: boolean = false) {
return <Sound> this.game.sound.add(key, volume, loop);
public audio(key: string, volume: number = 1, loop: boolean = false): Phaser.Sound {
return <Phaser.Sound> this.game.sound.add(key, volume, loop);
}
/**
@@ -119,8 +111,8 @@ module Phaser {
* @param height {number} Height of the texture.
* @returns {DynamicTexture} The newly created dynamic texture object.
*/
public dynamicTexture(width: number, height: number): DynamicTexture {
return new DynamicTexture(this.game, width, height);
public dynamicTexture(width: number, height: number): Phaser.Display.DynamicTexture {
return new Phaser.Display.DynamicTexture(this.game, width, height);
}
/**
@@ -129,8 +121,8 @@ module Phaser {
* @param maxSize {number} Optional, capacity of this group.
* @returns {Group} The newly created group.
*/
public group(maxSize: number = 0): Group {
return <Group> this._world.group.add(new Group(this.game, maxSize));
public group(maxSize: number = 0): Phaser.Group {
return <Phaser.Group> this._world.group.add(new Phaser.Group(this.game, maxSize));
}
/**
@@ -138,9 +130,9 @@ module Phaser {
*
* @return {Particle} The newly created particle object.
*/
public particle(): ArcadeParticle {
return new ArcadeParticle(this.game);
}
//public particle(): ArcadeParticle {
// return new ArcadeParticle(this.game);
//}
/**
* Create a new Emitter.
@@ -150,9 +142,9 @@ module Phaser {
* @param size {number} Optional, size of this emitter.
* @return {Emitter} The newly created emitter object.
*/
public emitter(x: number = 0, y: number = 0, size: number = 0): ArcadeEmitter {
return <ArcadeEmitter> this._world.group.add(new ArcadeEmitter(this.game, x, y, size));
}
//public emitter(x: number = 0, y: number = 0, size: number = 0): ArcadeEmitter {
// return <ArcadeEmitter> this._world.group.add(new ArcadeEmitter(this.game, x, y, size));
//}
/**
* Create a new ScrollZone object with image key, position and size.
@@ -164,8 +156,8 @@ module Phaser {
* @param height {number} Height of this object.
* @returns {ScrollZone} The newly created scroll zone object.
*/
public scrollZone(key: string, x: number = 0, y: number = 0, width: number = 0, height: number = 0): ScrollZone {
return <ScrollZone> this._world.group.add(new ScrollZone(this.game, key, x, y, width, height));
public scrollZone(key: string, x: number = 0, y: number = 0, width: number = 0, height: number = 0): Phaser.ScrollZone {
return <Phaser.ScrollZone> this._world.group.add(new Phaser.ScrollZone(this.game, key, x, y, width, height));
}
/**
@@ -179,8 +171,8 @@ module Phaser {
* @param [tileHeight] {number} height of each tile.
* @return {Tilemap} The newly created tilemap object.
*/
public tilemap(key: string, mapData: string, format: number, resizeWorld: boolean = true, tileWidth: number = 0, tileHeight: number = 0): Tilemap {
return <Tilemap> this._world.group.add(new Tilemap(this.game, key, mapData, format, resizeWorld, tileWidth, tileHeight));
public tilemap(key: string, mapData: string, format: number, resizeWorld: boolean = true, tileWidth: number = 0, tileHeight: number = 0): Phaser.Tilemap {
return <Phaser.Tilemap> this._world.group.add(new Phaser.Tilemap(this.game, key, mapData, format, resizeWorld, tileWidth, tileHeight));
}
/**
@@ -190,7 +182,7 @@ module Phaser {
* @param [localReference] {bool} If true the tween will be stored in the object.tween property so long as it exists. If already set it'll be over-written.
* @return {Phaser.Tween} The newly created tween object.
*/
public tween(obj, localReference:boolean = false): Tween {
public tween(obj, localReference: boolean = false): Phaser.Tween {
return this.game.tweens.create(obj, localReference);
}
@@ -201,7 +193,7 @@ module Phaser {
* @param sprite The Sprite to add to the Game World
* @return {Phaser.Sprite} The Sprite object
*/
public existingSprite(sprite: Sprite): Sprite {
public existingSprite(sprite: Phaser.Sprite): Phaser.Sprite {
return this._world.group.add(sprite);
}
@@ -212,7 +204,7 @@ module Phaser {
* @param group The Group to add to the Game World
* @return {Phaser.Group} The Group object
*/
public existingGroup(group: Group): Group {
public existingGroup(group: Phaser.Group): Phaser.Group {
return this._world.group.add(group);
}
@@ -223,7 +215,7 @@ module Phaser {
* @param button The Button to add to the Game World
* @return {Phaser.Button} The Button object
*/
public existingButton(button: UI.Button): UI.Button {
public existingButton(button: Phaser.UI.Button): Phaser.UI.Button {
return this._world.group.add(button);
}
@@ -245,9 +237,9 @@ module Phaser {
* @param emitter The Emitter to add to the Game World
* @return {Phaser.Emitter} The Emitter object
*/
public existingEmitter(emitter: ArcadeEmitter): ArcadeEmitter {
return this._world.group.add(emitter);
}
//public existingEmitter(emitter: ArcadeEmitter): ArcadeEmitter {
// return this._world.group.add(emitter);
//}
/**
* Add an existing ScrollZone to the current world.
@@ -256,7 +248,7 @@ module Phaser {
* @param scrollZone The ScrollZone to add to the Game World
* @return {Phaser.ScrollZone} The ScrollZone object
*/
public existingScrollZone(scrollZone: ScrollZone): ScrollZone {
public existingScrollZone(scrollZone: Phaser.ScrollZone): Phaser.ScrollZone {
return this._world.group.add(scrollZone);
}
@@ -267,7 +259,7 @@ module Phaser {
* @param tilemap The Tilemap to add to the Game World
* @return {Phaser.Tilemap} The Tilemap object
*/
public existingTilemap(tilemap: Tilemap): Tilemap {
public existingTilemap(tilemap: Phaser.Tilemap): Phaser.Tilemap {
return this._world.group.add(tilemap);
}
@@ -278,7 +270,7 @@ module Phaser {
* @param tween The Tween to add to the Game World
* @return {Phaser.Tween} The Tween object
*/
public existingTween(tween: Tween): Tween {
public existingTween(tween: Phaser.Tween): Phaser.Tween {
return this.game.tweens.add(tween);
}
+5 -5
View File
@@ -1,4 +1,4 @@
/// <reference path="../Game.ts" />
/// <reference path="../_definitions.ts" />
module Phaser {
@@ -7,7 +7,7 @@ module Phaser {
/**
* Reference to the main game object
*/
game: Game;
game: Phaser.Game;
/**
* The type of game object.
@@ -17,7 +17,7 @@ module Phaser {
/**
* The ID of the Group this Sprite belongs to.
*/
group: Group;
group: Phaser.Group;
/**
* The name of the Game Object. Typically not set by Phaser, but extremely useful for debugging / logic.
@@ -62,12 +62,12 @@ module Phaser {
/**
* Associated events
*/
events;
events: Phaser.Components.Events;
/**
* The input component
*/
input;
input: Phaser.Components.InputHandler;
/**
* The texture used to render.
+1 -3
View File
@@ -1,6 +1,4 @@
/// <reference path="../Game.ts" />
/// <reference path="../geom/Rectangle.ts" />
/// <reference path="../math/Vec2.ts" />
/// <reference path="../_definitions.ts" />
/**
* Phaser - ScrollRegion
+6 -8
View File
@@ -1,6 +1,4 @@
/// <reference path="../Game.ts" />
/// <reference path="../geom/Rectangle.ts" />
/// <reference path="ScrollRegion.ts" />
/// <reference path="../_definitions.ts" />
/**
* Phaser - ScrollZone
@@ -62,13 +60,13 @@ module Phaser {
* Current region this zone is scrolling.
* @type {ScrollRegion}
*/
public currentRegion: ScrollRegion;
public currentRegion: Phaser.ScrollRegion;
/**
* Array contains all added regions.
* @type {ScrollRegion[]}
*/
public regions: ScrollRegion[];
public regions: Phaser.ScrollRegion[];
/**
* Add a new region to this zone.
@@ -80,7 +78,7 @@ module Phaser {
* @param [speedY] {number} y-axis scrolling speed.
* @return {ScrollRegion} The newly added region.
*/
public addRegion(x: number, y: number, width: number, height: number, speedX:number = 0, speedY:number = 0):ScrollRegion {
public addRegion(x: number, y: number, width: number, height: number, speedX: number = 0, speedY: number = 0): Phaser.ScrollRegion {
if (x > this.width || y > this.height || x < 0 || y < 0 || (x + width) > this.width || (y + height) > this.height)
{
@@ -88,7 +86,7 @@ module Phaser {
return null;
}
this.currentRegion = new ScrollRegion(x, y, width, height, speedX, speedY);
this.currentRegion = new Phaser.ScrollRegion(x, y, width, height, speedX, speedY);
this.regions.push(this.currentRegion);
@@ -134,7 +132,7 @@ module Phaser {
var tileWidth = Math.ceil(this.width / regionWidth) * regionWidth;
var tileHeight = Math.ceil(this.height / regionHeight) * regionHeight;
var dt: DynamicTexture = new DynamicTexture(this.game, tileWidth, tileHeight);
var dt: Phaser.Display.DynamicTexture = new Phaser.Display.DynamicTexture(this.game, tileWidth, tileHeight);
dt.context.rect(0, 0, tileWidth, tileHeight);
dt.context.fillStyle = dt.context.createPattern(this.texture.imageTexture, "repeat");
+7 -14
View File
@@ -1,12 +1,4 @@
/// <reference path="../Game.ts" />
/// <reference path="../math/Vec2.ts" />
/// <reference path="../geom/Rectangle.ts" />
/// <reference path="../animation/AnimationManager.ts" />
/// <reference path="../input/InputHandler.ts" />
/// <reference path="../display/Texture.ts" />
/// <reference path="TransformManager.ts" />
/// <reference path="Events.ts" />
/// <reference path="../physics/arcade/Body.ts" />
/// <reference path="../_definitions.ts" />
/**
* Phaser - Sprite
@@ -86,7 +78,7 @@ module Phaser {
/**
* Reference to the main game object
*/
public game: Game;
public game: Phaser.Game;
/**
* The type of game object.
@@ -101,7 +93,7 @@ module Phaser {
/**
* The Group this Sprite belongs to.
*/
public group: Group;
public group: Phaser.Group;
/**
* Controls if both <code>update</code> and render are called by the core game loop.
@@ -137,7 +129,8 @@ module Phaser {
/**
* Sprite physics body.
*/
public body: Phaser.Physics.Body = null;
//public body: Phaser.Physics.Body = null;
public body;
/**
* The texture used to render the Sprite.
@@ -236,7 +229,7 @@ module Phaser {
if (this.group)
{
this.group.bringToTop(this);
//this.group.bringToTop(this);
}
}
@@ -426,7 +419,7 @@ module Phaser {
if (removeFromGroup && this.group)
{
this.group.remove(this);
//this.group.remove(this);
}
this.events.onKilled.dispatch(this);
+20 -22
View File
@@ -1,6 +1,4 @@
/// <reference path="../Game.ts" />
/// <reference path="../math/Mat3.ts" />
/// <reference path="../geom/Point.ts" />
/// <reference path="../_definitions.ts" />
/**
* Phaser - Components - TransformManager
@@ -19,7 +17,7 @@ module Phaser.Components {
this.game = parent.game;
this.parent = parent;
this.local = new Mat3;
this.local = new Phaser.Mat3;
this.scrollFactor = new Phaser.Vec2(1, 1);
this.origin = new Phaser.Vec2;
@@ -63,7 +61,7 @@ module Phaser.Components {
/**
* Reference to Phaser.Game
*/
public game: Game;
public game: Phaser.Game;
/**
* Reference to the parent object (Sprite, Group, etc)
@@ -73,22 +71,22 @@ module Phaser.Components {
/**
* Scale of the object. A scale of 1.0 is the original size. 0.5 half size. 2.0 double sized.
*/
public scale: Vec2;
public scale: Phaser.Vec2;
/**
* Skew the object along the x and y axis. A skew value of 0 is no skew.
*/
public skew: Vec2;
public skew: Phaser.Vec2;
/**
* The influence of camera movement upon the object, if supported.
*/
public scrollFactor: Vec2;
public scrollFactor: Phaser.Vec2;
/**
* The origin is the point around which scale and rotation takes place and defaults to the top-left of the sprite.
*/
public origin: Vec2;
public origin: Phaser.Vec2;
/**
* This value is added to the rotation of the object.
@@ -131,7 +129,7 @@ module Phaser.Components {
/**
* The local transform matrix
*/
public local: Mat3;
public local: Phaser.Mat3;
/**
* The distance from the center of the transform to the rotation origin.
@@ -220,16 +218,16 @@ module Phaser.Components {
this._size.y = this.parent.height;
this._origin.x = this.origin.x;
this._origin.y = this.origin.y;
this._sc.x = Math.sin((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD);
this._sc.y = Math.cos((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD);
this._scA.y = Math.cos((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD + this._angle);
this._scA.x = Math.sin((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD + this._angle);
this._sc.x = Math.sin((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD);
this._sc.y = Math.cos((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD);
this._scA.y = Math.cos((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD + this._angle);
this._scA.x = Math.sin((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD + this._angle);
this._prevRotation = this.rotation;
if (this.parent.texture && this.parent.texture.renderRotation)
{
this._sc.x = Math.sin((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD);
this._sc.y = Math.cos((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD);
this._sc.x = Math.sin((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD);
this._sc.y = Math.cos((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD);
}
else
{
@@ -278,15 +276,15 @@ module Phaser.Components {
// 2) Rotation change
if (this.rotation != this._prevRotation)
{
this._sc.x = Math.sin((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD);
this._sc.y = Math.cos((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD);
this._scA.y = Math.cos((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD + this._angle);
this._scA.x = Math.sin((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD + this._angle);
this._sc.x = Math.sin((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD);
this._sc.y = Math.cos((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD);
this._scA.y = Math.cos((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD + this._angle);
this._scA.x = Math.sin((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD + this._angle);
if (this.parent.texture.renderRotation)
{
this._sc.x = Math.sin((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD);
this._sc.y = Math.cos((this.rotation + this.rotationOffset) * GameMath.DEG_TO_RAD);
this._sc.x = Math.sin((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD);
this._sc.y = Math.cos((this.rotation + this.rotationOffset) * Phaser.GameMath.DEG_TO_RAD);
}
else
{