mirror of
https://github.com/wassname/phaser.git
synced 2026-08-20 12:40:12 +08:00
Whole codebase updated to TypeScript 0.9.1, phew!
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="Pointer.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Gestures
|
||||
*
|
||||
* The Gesture class monitors for gestures and dispatches the resulting signals when they occur.
|
||||
* Note: Android 2.x only supports 1 touch event at once, no multi-touch
|
||||
*/
|
||||
|
||||
module Phaser {
|
||||
|
||||
export class Gestures {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param {Game} game.
|
||||
* @return {Touch} This object.
|
||||
*/
|
||||
constructor(game: Game) {
|
||||
|
||||
this.game = game;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Local reference to Game.
|
||||
* @property _game
|
||||
* @type {Game}
|
||||
* @private
|
||||
**/
|
||||
public game: Game;
|
||||
|
||||
private _p1: Pointer;
|
||||
private _p2: Pointer;
|
||||
private _p3: Pointer;
|
||||
private _p4: Pointer;
|
||||
private _p5: Pointer;
|
||||
private _p6: Pointer;
|
||||
private _p7: Pointer;
|
||||
private _p8: Pointer;
|
||||
private _p9: Pointer;
|
||||
private _p10: Pointer;
|
||||
|
||||
public start() {
|
||||
|
||||
// Local references to the Phaser.Input.pointer objects
|
||||
this._p1 = this.game.input.pointer1;
|
||||
this._p2 = this.game.input.pointer2;
|
||||
this._p3 = this.game.input.pointer3;
|
||||
this._p4 = this.game.input.pointer4;
|
||||
this._p5 = this.game.input.pointer5;
|
||||
this._p6 = this.game.input.pointer6;
|
||||
this._p7 = this.game.input.pointer7;
|
||||
this._p8 = this.game.input.pointer8;
|
||||
this._p9 = this.game.input.pointer9;
|
||||
this._p10 = this.game.input.pointer10;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../utils/SpriteUtils.ts" />
|
||||
/// <reference path="../utils/RectangleUtils.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Components - InputHandler
|
||||
@@ -27,7 +25,7 @@ module Phaser.Components {
|
||||
/**
|
||||
* Reference to Phaser.Game
|
||||
*/
|
||||
public game: Game;
|
||||
public game: Phaser.Game;
|
||||
|
||||
/**
|
||||
* Local private reference to its parent game object.
|
||||
@@ -551,7 +549,7 @@ module Phaser.Components {
|
||||
* @param boundsRect If you want to restrict the drag of this sprite to a specific FlxRect, pass the FlxRect here, otherwise it's free to drag anywhere
|
||||
* @param boundsSprite If you want to restrict the drag of this sprite to within the bounding box of another sprite, pass it here
|
||||
*/
|
||||
public enableDrag(lockCenter: boolean = false, bringToTop: boolean = false, pixelPerfect: boolean = false, alphaThreshold: number = 255, boundsRect: Rectangle = null, boundsSprite: Phaser.Sprite = null): void {
|
||||
public enableDrag(lockCenter: boolean = false, bringToTop: boolean = false, pixelPerfect: boolean = false, alphaThreshold: number = 255, boundsRect: Rectangle = null, boundsSprite: Phaser.Sprite = null) {
|
||||
this._dragPoint = new Point;
|
||||
|
||||
this.draggable = true;
|
||||
@@ -576,7 +574,7 @@ module Phaser.Components {
|
||||
/**
|
||||
* Stops this sprite from being able to be dragged. If it is currently the target of an active drag it will be stopped immediately. Also disables any set callbacks.
|
||||
*/
|
||||
public disableDrag(): void {
|
||||
public disableDrag() {
|
||||
|
||||
if (this._pointerData)
|
||||
{
|
||||
@@ -595,7 +593,7 @@ module Phaser.Components {
|
||||
/**
|
||||
* Called by Pointer when drag starts on this Sprite. Should not usually be called directly.
|
||||
*/
|
||||
public startDrag(pointer: Pointer): void {
|
||||
public startDrag(pointer: Pointer) {
|
||||
|
||||
this.isDragged = true;
|
||||
this._draggedPointerID = pointer.id;
|
||||
@@ -625,7 +623,7 @@ module Phaser.Components {
|
||||
/**
|
||||
* Called by Pointer when drag is stopped on this Sprite. Should not usually be called directly.
|
||||
*/
|
||||
public stopDrag(pointer: Pointer): void {
|
||||
public stopDrag(pointer: Pointer) {
|
||||
|
||||
this.isDragged = false;
|
||||
this._draggedPointerID = -1;
|
||||
@@ -648,7 +646,7 @@ module Phaser.Components {
|
||||
* @param allowHorizontal To enable the sprite to be dragged horizontally set to true, otherwise false
|
||||
* @param allowVertical To enable the sprite to be dragged vertically set to true, otherwise false
|
||||
*/
|
||||
public setDragLock(allowHorizontal: boolean = true, allowVertical: boolean = true): void {
|
||||
public setDragLock(allowHorizontal: boolean = true, allowVertical: boolean = true) {
|
||||
this.allowHorizontalDrag = allowHorizontal;
|
||||
this.allowVerticalDrag = allowVertical;
|
||||
}
|
||||
@@ -662,7 +660,7 @@ module Phaser.Components {
|
||||
* @param onDrag If true the sprite will snap to the grid while being dragged
|
||||
* @param onRelease If true the sprite will snap to the grid when released
|
||||
*/
|
||||
public enableSnap(snapX: number, snapY: number, onDrag: boolean = true, onRelease: boolean = false): void {
|
||||
public enableSnap(snapX: number, snapY: number, onDrag: boolean = true, onRelease: boolean = false) {
|
||||
this.snapOnDrag = onDrag;
|
||||
this.snapOnRelease = onRelease;
|
||||
this.snapX = snapX;
|
||||
@@ -672,7 +670,7 @@ module Phaser.Components {
|
||||
/**
|
||||
* Stops the sprite from snapping to a grid during drag or release.
|
||||
*/
|
||||
public disableSnap(): void {
|
||||
public disableSnap() {
|
||||
this.snapOnDrag = false;
|
||||
this.snapOnRelease = false;
|
||||
}
|
||||
@@ -680,7 +678,7 @@ module Phaser.Components {
|
||||
/**
|
||||
* Bounds Rect check for the sprite drag
|
||||
*/
|
||||
private checkBoundsRect(): void {
|
||||
private checkBoundsRect() {
|
||||
if (this._parent.x < this.boundsRect.left)
|
||||
{
|
||||
this._parent.x = this.boundsRect.x;
|
||||
@@ -703,7 +701,7 @@ module Phaser.Components {
|
||||
/**
|
||||
* Parent Sprite Bounds check for the sprite drag
|
||||
*/
|
||||
private checkBoundsSprite(): void {
|
||||
private checkBoundsSprite() {
|
||||
if (this._parent.x < this.boundsSprite.x)
|
||||
{
|
||||
this._parent.x = this.boundsSprite.x;
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../core/Signal.ts" />
|
||||
/// <reference path="../utils/PointUtils.ts" />
|
||||
/// <reference path="../math/Vec2Utils.ts" />
|
||||
/// <reference path="Pointer.ts" />
|
||||
/// <reference path="MSPointer.ts" />
|
||||
/// <reference path="Gestures.ts" />
|
||||
/// <reference path="Mouse.ts" />
|
||||
/// <reference path="Keyboard.ts" />
|
||||
/// <reference path="Touch.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - InputManager
|
||||
@@ -32,7 +23,7 @@ module Phaser {
|
||||
this.keyboard = new Keyboard(this.game);
|
||||
this.touch = new Touch(this.game);
|
||||
this.mspointer = new MSPointer(this.game);
|
||||
this.gestures = new Gestures(this.game);
|
||||
//this.gestures = new Gestures(this.game);
|
||||
|
||||
this.onDown = new Phaser.Signal();
|
||||
this.onUp = new Phaser.Signal();
|
||||
@@ -58,7 +49,7 @@ module Phaser {
|
||||
/**
|
||||
* Local reference to game.
|
||||
*/
|
||||
public game: Game;
|
||||
public game: Phaser.Game;
|
||||
|
||||
/**
|
||||
* How often should the input pointers be checked for updates?
|
||||
@@ -171,7 +162,7 @@ module Phaser {
|
||||
* Phaser.Gestures handler
|
||||
* @type {Gestures}
|
||||
*/
|
||||
public gestures: Gestures;
|
||||
//public gestures: Gestures;
|
||||
|
||||
/**
|
||||
* A vector object representing the current position of the Pointer.
|
||||
@@ -458,7 +449,7 @@ module Phaser {
|
||||
this.keyboard.start();
|
||||
this.touch.start();
|
||||
this.mspointer.start();
|
||||
this.gestures.start();
|
||||
//this.gestures.start();
|
||||
|
||||
this.mousePointer.active = true;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Keyboard
|
||||
@@ -23,7 +23,7 @@ module Phaser {
|
||||
* @property game
|
||||
* @type {Phaser.Game}
|
||||
**/
|
||||
public game: Game;
|
||||
public game: Phaser.Game;
|
||||
|
||||
private _keys = {};
|
||||
private _capture = {};
|
||||
@@ -211,6 +211,7 @@ module Phaser {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
// Letters
|
||||
public static A: number = "A".charCodeAt(0);
|
||||
public static B: number = "B".charCodeAt(0);
|
||||
@@ -320,7 +321,7 @@ module Phaser {
|
||||
public static DELETE: number = 46;
|
||||
public static HELP: number = 47;
|
||||
public static NUM_LOCK: number = 144;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="Pointer.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - MSPointer
|
||||
@@ -29,7 +28,7 @@ module Phaser {
|
||||
* @property game
|
||||
* @type Game
|
||||
**/
|
||||
public game: Game;
|
||||
public game: Phaser.Game;
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Mouse
|
||||
@@ -22,7 +22,7 @@ module Phaser {
|
||||
* @property game
|
||||
* @type {Phaser.Game}
|
||||
**/
|
||||
public game: Game;
|
||||
public game: Phaser.Game;
|
||||
|
||||
public static LEFT_BUTTON: number = 0;
|
||||
public static MIDDLE_BUTTON: number = 1;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="../math/Vec2.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Pointer
|
||||
@@ -43,7 +42,7 @@ module Phaser {
|
||||
* @type {Phaser.Game}
|
||||
* @private
|
||||
**/
|
||||
public game: Game;
|
||||
public game: Phaser.Game;
|
||||
|
||||
/**
|
||||
* Local private variable to store the status of dispatching a hold event
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/// <reference path="../Game.ts" />
|
||||
/// <reference path="Pointer.ts" />
|
||||
/// <reference path="../_definitions.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Touch
|
||||
@@ -32,7 +31,7 @@ module Phaser {
|
||||
* @property game
|
||||
* @type {Phaser.Game}
|
||||
**/
|
||||
public game: Game;
|
||||
public game: Phaser.Game;
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
|
||||
Reference in New Issue
Block a user