Input Handler mostly restored

This commit is contained in:
Richard Davey
2013-09-08 13:23:21 +01:00
parent 78598ae54a
commit 90b1946c25
7 changed files with 831 additions and 40 deletions
+46
View File
@@ -14,8 +14,11 @@ Phaser.Sprite = function (game, x, y, key, frame) {
this.alive = true;
this.group = null;
this.name = '';
this.renderOrderID = -1;
if (key)
{
PIXI.Sprite.call(this, PIXI.TextureCache[key]);
@@ -149,6 +152,7 @@ Phaser.Sprite.prototype.update = function() {
if (!this.exists)
{
this.renderOrderID = -1;
return;
}
@@ -173,6 +177,8 @@ Phaser.Sprite.prototype.update = function() {
if (this.visible)
{
this.renderOrderID = this.game.world.currentRenderOrderID++;
// |a c tx|
// |b d ty|
// |0 0 1|
@@ -256,6 +262,11 @@ Phaser.Sprite.prototype.update = function() {
this.body.update();
if (this.input.enabled)
{
this.input.update();
}
}
Phaser.Sprite.prototype.postUpdate = function() {
@@ -374,3 +385,38 @@ Object.defineProperty(Phaser.Sprite.prototype, "inCamera", {
}
});
Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", {
/**
* Get the input enabled state of this Sprite.
*/
get: function () {
return (this.input.enabled);
},
/**
* Set the ability for this sprite to receive input events.
*/
set: function (value) {
if (value)
{
if (this.input.enabled == false)
{
this.input.start();
}
}
else
{
if (this.input.enabled)
{
this.input.stop();
}
}
}
});