mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 09:03:29 +00:00
88 lines
2.1 KiB
JavaScript
88 lines
2.1 KiB
JavaScript
/**
|
|
* A GraphicsData object.
|
|
*
|
|
* @class
|
|
* @memberof PIXI
|
|
* @param lineWidth {number} the width of the line to draw
|
|
* @param lineColor {number} the color of the line to draw
|
|
* @param lineAlpha {number} the alpha of the line to draw
|
|
* @param fillColor {number} the color of the fill
|
|
* @param fillAlpha {number} the alpha of the fill
|
|
* @param fill {boolean} whether or not the shape is filled with a colour
|
|
* @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw.
|
|
*/
|
|
|
|
Phaser.GraphicsData = function (lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) {
|
|
|
|
/*
|
|
* @member {number} the width of the line to draw
|
|
*/
|
|
this.lineWidth = lineWidth;
|
|
|
|
/*
|
|
* @member {number} the color of the line to draw
|
|
*/
|
|
this.lineColor = lineColor;
|
|
|
|
/*
|
|
* @member {number} the alpha of the line to draw
|
|
*/
|
|
this.lineAlpha = lineAlpha;
|
|
|
|
/*
|
|
* @member {number} cached tint of the line to draw
|
|
*/
|
|
this._lineTint = lineColor;
|
|
|
|
/*
|
|
* @member {number} the color of the fill
|
|
*/
|
|
this.fillColor = fillColor;
|
|
|
|
/*
|
|
* @member {number} the alpha of the fill
|
|
*/
|
|
this.fillAlpha = fillAlpha;
|
|
|
|
/*
|
|
* @member {number} cached tint of the fill
|
|
*/
|
|
this._fillTint = fillColor;
|
|
|
|
/*
|
|
* @member {boolean} whether or not the shape is filled with a color
|
|
*/
|
|
this.fill = fill;
|
|
|
|
/*
|
|
* @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw.
|
|
*/
|
|
this.shape = shape;
|
|
|
|
/*
|
|
* @member {number} The type of the shape, see the Const.Shapes file for all the existing types,
|
|
*/
|
|
this.type = shape.type;
|
|
|
|
};
|
|
|
|
Phaser.GraphicsData.prototype.constructor = Phaser.GraphicsData;
|
|
|
|
/**
|
|
* Creates a new GraphicsData object with the same values as this one.
|
|
*
|
|
* @return {GraphicsData}
|
|
*/
|
|
Phaser.GraphicsData.prototype.clone = function () {
|
|
|
|
return new Phaser.GraphicsData(
|
|
this.lineWidth,
|
|
this.lineColor,
|
|
this.lineAlpha,
|
|
this.fillColor,
|
|
this.fillAlpha,
|
|
this.fill,
|
|
this.shape
|
|
);
|
|
|
|
};
|