mirror of
https://github.com/wassname/phaser.git
synced 2026-07-18 12:30:44 +08:00
Removed input handler from Graphics as it's just meant to be used as a texture really, if you need input events you can apply Graphics to a Sprite.
You can now create a Physics Body directly via game.physics.createBody(), and Body has been updated so it's no longer always bound to a Sprite. Debug.renderPhysicsBody now works with Rectangles, Lines and multiple Convex shapes. Starting to get the Tiled polyline parsing working nicely. Not too far off a complete tilemap collision.
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
* @classdesc BitmapText objects work by taking a texture file and an XML file that describes the font layout.
|
||||
*
|
||||
* On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/
|
||||
*
|
||||
* On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner
|
||||
* For Web there is the great Littera: http://kvazars.com/littera/
|
||||
*
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
|
||||
@@ -47,16 +47,6 @@ Phaser.Graphics = function (game, x, y) {
|
||||
*/
|
||||
this.world = new Phaser.Point(x, y);
|
||||
|
||||
/**
|
||||
* @property {Phaser.Events} events - The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.
|
||||
*/
|
||||
this.events = new Phaser.Events(this);
|
||||
|
||||
/**
|
||||
* @property {Phaser.InputHandler|null} input - The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.
|
||||
*/
|
||||
this.input = null;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.
|
||||
*/
|
||||
@@ -202,42 +192,6 @@ Object.defineProperty(Phaser.Graphics.prototype, 'angle', {
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* By default a Graphics object won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is
|
||||
* activated for this object and it will then start to process click/touch events and more.
|
||||
*
|
||||
* @name Phaser.Graphics#inputEnabled
|
||||
* @property {boolean} inputEnabled - Set to true to allow this object to receive input events.
|
||||
*/
|
||||
Object.defineProperty(Phaser.Graphics.prototype, "inputEnabled", {
|
||||
|
||||
get: function () {
|
||||
|
||||
return (this.input && this.input.enabled);
|
||||
|
||||
},
|
||||
|
||||
set: function (value) {
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (this.input === null)
|
||||
{
|
||||
this.input = new Phaser.InputHandler(this);
|
||||
this.input.start();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.input && this.input.enabled)
|
||||
{
|
||||
this.input.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* An Graphics that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Graphics.cameraOffset.
|
||||
* Note that the cameraOffset values are in addition to any parent in the display list.
|
||||
|
||||
@@ -854,7 +854,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "physicsEnabled", {
|
||||
{
|
||||
if (this.body === null)
|
||||
{
|
||||
this.body = new Phaser.Physics.Body(this);
|
||||
this.body = new Phaser.Physics.Body(this.game, this, this.x, this.y, 1);
|
||||
this.anchor.set(0.5);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user