mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
Added Group IDs and references to Sprites, Group sorting, z-index values and child swapping. Also added all of the drag and bounds methods to Input.
This commit is contained in:
+35
-1
@@ -23,6 +23,7 @@ module Phaser {
|
||||
constructor(game: Game) {
|
||||
|
||||
this._game = game;
|
||||
this._stack = [];
|
||||
|
||||
this.mousePointer = new Pointer(this._game, 0);
|
||||
this.pointer1 = new Pointer(this._game, 1);
|
||||
@@ -42,7 +43,9 @@ module Phaser {
|
||||
this.onTap = new Phaser.Signal();
|
||||
this.onHold = new Phaser.Signal();
|
||||
|
||||
this.speed = new Vec2;
|
||||
this.position = new Vec2;
|
||||
this._oldPosition = new Vec2;
|
||||
this.circle = new Circle(0, 0, 44);
|
||||
|
||||
this.currentPointers = 0;
|
||||
@@ -54,6 +57,18 @@ module Phaser {
|
||||
*/
|
||||
private _game: Game;
|
||||
|
||||
/**
|
||||
* Temporary click sorting stack
|
||||
*/
|
||||
private _stack;
|
||||
|
||||
/**
|
||||
* A vector object representing the previous position of the Pointer.
|
||||
* @property vector
|
||||
* @type {Vec2}
|
||||
**/
|
||||
private _oldPosition: Vec2 = null;
|
||||
|
||||
/**
|
||||
* You can disable all Input by setting Input.disabled = true. While set all new input related events will be ignored.
|
||||
* If you need to disable just one type of input, for example mouse, use Input.mouse.disabled = true instead
|
||||
@@ -121,6 +136,14 @@ module Phaser {
|
||||
**/
|
||||
public position: Vec2 = null;
|
||||
|
||||
/**
|
||||
* A vector object representing the speed of the Pointer. Only really useful in single Pointer games,
|
||||
* otherwise see the Pointer objects directly.
|
||||
* @property vector
|
||||
* @type {Vec2}
|
||||
**/
|
||||
public speed: Vec2 = null;
|
||||
|
||||
/**
|
||||
* A Circle object centered on the x/y screen coordinates of the Input.
|
||||
* Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything
|
||||
@@ -415,7 +438,7 @@ module Phaser {
|
||||
* Starts the Input Manager running
|
||||
* @method start
|
||||
**/
|
||||
public start() {
|
||||
public boot() {
|
||||
|
||||
this.mouse.start();
|
||||
this.keyboard.start();
|
||||
@@ -431,6 +454,11 @@ module Phaser {
|
||||
**/
|
||||
public update() {
|
||||
|
||||
this.speed.x = this.position.x - this._oldPosition.x;
|
||||
this.speed.y = this.position.y - this._oldPosition.y;
|
||||
|
||||
this._oldPosition.copyFrom(this.position);
|
||||
|
||||
this.mousePointer.update();
|
||||
this.pointer1.update();
|
||||
this.pointer2.update();
|
||||
@@ -446,6 +474,12 @@ module Phaser {
|
||||
|
||||
}
|
||||
|
||||
public addToStack(item) {
|
||||
|
||||
this._stack.push(item);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all of the Pointers and Input states
|
||||
* @method reset
|
||||
|
||||
Reference in New Issue
Block a user