mirror of
https://github.com/wassname/phaser.git
synced 2026-07-23 13:00:41 +08:00
Input Handler mostly restored
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user