The entire Phaser library has been updated to match the new JSHint configuration.

This commit is contained in:
photonstorm
2013-11-25 04:40:04 +00:00
parent 13a2cc2feb
commit 299115ca5d
74 changed files with 4992 additions and 4977 deletions
+5 -5
View File
@@ -172,7 +172,7 @@ Phaser.BitmapData.prototype = {
{
this.data32[y * this.width + x] = (red << 24) | (green << 16) | (blue << 8) | alpha;
}
*/
*/
// this.imageData.data.set(this.data8);
@@ -229,10 +229,10 @@ Phaser.BitmapData.prototype = {
},
/**
* Get pixels in array in a specific Rectangle.
* @param rect {Rectangle} The specific Rectangle.
* @return {array} CanvasPixelArray.
*/
* Get pixels in array in a specific Rectangle.
* @param rect {Rectangle} The specific Rectangle.
* @return {array} CanvasPixelArray.
*/
getPixels: function (rect) {
return this.context.getImageData(rect.x, rect.y, rect.width, rect.height);
+32 -36
View File
@@ -21,10 +21,14 @@ Phaser.BitmapText = function (game, x, y, text, style) {
x = x || 0;
y = y || 0;
text = text || '';
style = style || '';
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
this.game = game;
/**
* @property {boolean} exists - If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.
* @default
@@ -38,53 +42,51 @@ Phaser.BitmapText = function (game, x, y, text, style) {
this.alive = true;
/**
* @property {Description} group - Description.
* @default
* @property {Phaser.Group} group - The parent Group of this BitmapText.
*/
this.group = null;
/**
* @property {string} name - Description.
* @property {string} name - The user defined name given to this BitmapText.
* @default
*/
this.name = '';
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
* @property {number} type - The const type of this object.
* @readonly
*/
this.game = game;
this.type = Phaser.BITMAPTEXT;
PIXI.BitmapText.call(this, text, style);
/**
* @property {Description} type - Description.
*/
this.type = Phaser.BITMAPTEXT;
/**
* @property {number} position.x - Description.
* @property {number} position.x - The x position of this object.
*/
this.position.x = x;
/**
* @property {number} position.y - Description.
* @property {number} position.y - The y position of this object.
*/
this.position.y = y;
// Replaces the PIXI.Point with a slightly more flexible one
/**
* @property {Phaser.Point} anchor - Description.
* The anchor sets the origin point of the texture.
* The default is 0,0 this means the textures origin is the top left
* Setting than anchor to 0.5,0.5 means the textures origin is centered
* Setting the anchor to 1,1 would mean the textures origin points will be the bottom right
*
* @property {Phaser.Point} anchor - The anchor around which rotation and scaling takes place.
*/
this.anchor = new Phaser.Point();
/**
* @property {Phaser.Point} scale - Description.
* @property {Phaser.Point} scale - The scale of the object when rendered. By default it's set to 1 (no scale). You can modify it via scale.x or scale.y or scale.setTo(x, y). A value of 1 means no change to the scale, 0.5 means "half the size", 2 means "twice the size", etc.
*/
this.scale = new Phaser.Point(1, 1);
// A mini cache for storing all of the calculated values
/**
* @property {function} _cache - Description.
* @property {object} _cache - A mini cache for storing all of the calculated values.
* @private
*/
this._cache = {
@@ -114,15 +116,13 @@ Phaser.BitmapText = function (game, x, y, text, style) {
this._cache.y = this.y;
/**
* @property {boolean} renderable - Description.
* @private
* @property {boolean} renderable - A renderable object will be rendered to the context each frame.
*/
this.renderable = true;
};
Phaser.BitmapText.prototype = Object.create(PIXI.BitmapText.prototype);
// Phaser.BitmapText.prototype = Phaser.Utils.extend(true, PIXI.BitmapText.prototype);
Phaser.BitmapText.prototype.constructor = Phaser.BitmapText;
/**
@@ -180,11 +180,11 @@ Phaser.BitmapText.prototype.destroy = function() {
}
/**
* Get
* @returns {Description}
*//**
* Set
* @param {Description} value - Description
* Indicates the rotation of the BitmapText, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
* If you wish to work in radians instead of degrees use the property Sprite.rotation instead.
* @name Phaser.BitmapText#angle
* @property {number} angle - Gets or sets the angle of rotation in degrees.
*/
Object.defineProperty(Phaser.BitmapText.prototype, 'angle', {
@@ -199,11 +199,9 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'angle', {
});
/**
* Get
* @returns {Description}
*//**
* Set
* @param {Description} value - Description
* The x coordinate of this object in world space.
* @name Phaser.BitmapText#x
* @property {number} x - The x coordinate of this object in world space.
*/
Object.defineProperty(Phaser.BitmapText.prototype, 'x', {
@@ -218,11 +216,9 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'x', {
});
/**
* Get
* @returns {Description}
*//**
* Set
* @param {Description} value - Description
* The y coordinate of this object in world space.
* @name Phaser.BitmapText#y
* @property {number} y - The y coordinate of this object in world space.
*/
Object.defineProperty(Phaser.BitmapText.prototype, 'y', {
+31 -31
View File
@@ -100,14 +100,14 @@ Phaser.GameObjectFactory.prototype = {
},
/**
* Creates a new instance of the Sound class.
*
* Creates a new instance of the Sound class.
*
* @method Phaser.GameObjectFactory#audio
* @param {string} key - The Game.cache key of the sound that this object will use.
* @param {number} volume - The volume at which the sound will be played.
* @param {boolean} loop - Whether or not the sound will loop.
* @return {Phaser.Sound} The newly created text object.
*/
* @param {string} key - The Game.cache key of the sound that this object will use.
* @param {number} volume - The volume at which the sound will be played.
* @param {boolean} loop - Whether or not the sound will loop.
* @return {Phaser.Sound} The newly created text object.
*/
audio: function (key, volume, loop) {
return this.game.sound.add(key, volume, loop);
@@ -115,17 +115,17 @@ Phaser.GameObjectFactory.prototype = {
},
/**
* Creates a new <code>TileSprite</code>.
*
* Creates a new <code>TileSprite</code>.
*
* @method Phaser.GameObjectFactory#tileSprite
* @param {number} x - X position of the new tileSprite.
* @param {number} y - Y position of the new tileSprite.
* @param {number} width - the width of the tilesprite.
* @param {number} height - the height of the tilesprite.
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
* @param {string|number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
* @return {Phaser.TileSprite} The newly created tileSprite object.
*/
* @param {number} x - X position of the new tileSprite.
* @param {number} y - Y position of the new tileSprite.
* @param {number} width - the width of the tilesprite.
* @param {number} height - the height of the tilesprite.
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
* @param {string|number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
* @return {Phaser.TileSprite} The newly created tileSprite object.
*/
tileSprite: function (x, y, width, height, key, frame) {
return this.world.add(new Phaser.TileSprite(this.game, x, y, width, height, key, frame));
@@ -133,15 +133,15 @@ Phaser.GameObjectFactory.prototype = {
},
/**
* Creates a new <code>Text</code>.
*
* Creates a new <code>Text</code>.
*
* @method Phaser.GameObjectFactory#text
* @param {number} x - X position of the new text object.
* @param {number} y - Y position of the new text object.
* @param {string} text - The actual text that will be written.
* @param {object} style - The style object containing style attributes like font, font size , etc.
* @return {Phaser.Text} The newly created text object.
*/
* @param {number} x - X position of the new text object.
* @param {number} y - Y position of the new text object.
* @param {string} text - The actual text that will be written.
* @param {object} style - The style object containing style attributes like font, font size , etc.
* @return {Phaser.Text} The newly created text object.
*/
text: function (x, y, text, style) {
return this.world.add(new Phaser.Text(this.game, x, y, text, style));
@@ -169,13 +169,13 @@ Phaser.GameObjectFactory.prototype = {
},
/**
* Creates a new <code>Graphics</code> object.
*
* Creates a new <code>Graphics</code> object.
*
* @method Phaser.GameObjectFactory#graphics
* @param {number} x - X position of the new graphics object.
* @param {number} y - Y position of the new graphics object.
* @return {Phaser.Graphics} The newly created graphics object.
*/
* @param {number} x - X position of the new graphics object.
* @param {number} y - Y position of the new graphics object.
* @return {Phaser.Graphics} The newly created graphics object.
*/
graphics: function (x, y) {
return this.world.add(new Phaser.Graphics(this.game, x, y));
+3 -3
View File
@@ -165,17 +165,17 @@ Phaser.Sprite = function (game, x, y, key, frame) {
* Setting than anchor to 0.5,0.5 means the textures origin is centered
* Setting the anchor to 1,1 would mean the textures origin points will be the bottom right
*
* @property {Phaser.Point} anchor - The anchor around with Sprite rotation and scaling takes place.
* @property {Phaser.Point} anchor - The anchor around which rotation and scaling takes place.
*/
this.anchor = new Phaser.Point();
/**
* @property {number} x - The x coordinate (in world space) of this Sprite.
* @property {number} x - The x coordinate in world space of this Sprite.
*/
this.x = x;
/**
* @property {number} y - The y coordinate (in world space) of this Sprite.
* @property {number} y - The y coordinate in world space of this Sprite.
*/
this.y = y;
+56 -12
View File
@@ -27,24 +27,24 @@ Phaser.Text = function (game, x, y, text, style) {
this.game = game;
/**
* @property {boolean} exists - If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.
* @property {boolean} exists - If exists = false then the Text isn't updated by the core game loop.
* @default
*/
this.exists = true;
/**
* @property {boolean} alive - This is a handy little var your game can use to determine if a sprite is alive or not, it doesn't effect rendering.
* @property {boolean} alive - This is a handy little var your game can use to determine if an object is alive or not, it doesn't effect rendering.
* @default
*/
this.alive = true;
/**
* @property {Phaser.Group} group - The parent Group of this Sprite. This is usually set after Sprite instantiation by the parent.
* @property {Phaser.Group} group - The parent Group of this Text object.
*/
this.group = null;
/**
* @property {string} name - The user defined name given to this Sprite.
* @property {string} name - The user defined name given to this object.
* @default
*/
this.name = '';
@@ -70,8 +70,8 @@ Phaser.Text = function (game, x, y, text, style) {
PIXI.Text.call(this, text, style);
/**
* @property {Phaser.Point} position - The position of this Text object in world space.
*/
* @property {Phaser.Point} position - The position of this Text object in world space.
*/
this.position.x = this.x = x;
this.position.y = this.y = y;
@@ -81,7 +81,7 @@ Phaser.Text = function (game, x, y, text, style) {
* Setting than anchor to 0.5,0.5 means the textures origin is centered
* Setting the anchor to 1,1 would mean the textures origin points will be the bottom right
*
* @property {Phaser.Point} anchor - The anchor around with Sprite rotation and scaling takes place.
* @property {Phaser.Point} anchor - The anchor around which rotation and scaling takes place.
*/
this.anchor = new Phaser.Point();
@@ -182,11 +182,11 @@ Phaser.Text.prototype.destroy = function() {
}
/**
* Get
* @returns {Description}
*//**
* Set
* @param {Description} value - Description
* Indicates the rotation of the Text, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
* If you wish to work in radians instead of degrees use the property Sprite.rotation instead.
* @name Phaser.Text#angle
* @property {number} angle - Gets or sets the angle of rotation in degrees.
*/
Object.defineProperty(Phaser.Text.prototype, 'angle', {
@@ -200,6 +200,45 @@ Object.defineProperty(Phaser.Text.prototype, 'angle', {
});
/**
* The x coordinate of this object in world space.
* @name Phaser.BitmapText#x
* @property {number} x - The x coordinate of this object in world space.
*/
Object.defineProperty(Phaser.BitmapText.prototype, 'x', {
get: function() {
return this.position.x;
},
set: function(value) {
this.position.x = value;
}
});
/**
* The y coordinate of this object in world space.
* @name Phaser.BitmapText#y
* @property {number} y - The y coordinate of this object in world space.
*/
Object.defineProperty(Phaser.BitmapText.prototype, 'y', {
get: function() {
return this.position.y;
},
set: function(value) {
this.position.y = value;
}
});
/**
* The string to be rendered by this Text object.
* @name Phaser.Text#content
* @property {string} content - The string to be rendered by this Text object.
*/
Object.defineProperty(Phaser.Text.prototype, 'content', {
get: function() {
@@ -219,6 +258,11 @@ Object.defineProperty(Phaser.Text.prototype, 'content', {
});
/**
* The font the text will be rendered in.
* @name Phaser.Text#font
* @property {string} font - The font the text will be rendered in.
*/
Object.defineProperty(Phaser.Text.prototype, 'font', {
get: function() {