mirror of
https://github.com/wassname/phaser.git
synced 2026-07-13 01:00:12 +08:00
Updating all files to adhere to the JSHint settings and fixing lots of documentation errors on the way.
This commit is contained in:
+56
-38
@@ -21,81 +21,99 @@ Phaser.Text = function (game, x, y, text, style) {
|
||||
text = text || '';
|
||||
style = style || '';
|
||||
|
||||
// If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all
|
||||
/**
|
||||
* @property {boolean} exists - Description.
|
||||
* @default
|
||||
*/
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
this.exists = true;
|
||||
|
||||
// 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 - Description.
|
||||
* @default
|
||||
*/
|
||||
/**
|
||||
* @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.
|
||||
* @default
|
||||
*/
|
||||
this.alive = true;
|
||||
|
||||
/**
|
||||
* @property {Description} group - Description.
|
||||
* @default
|
||||
*/
|
||||
/**
|
||||
* @property {Phaser.Group} group - The parent Group of this Sprite. This is usually set after Sprite instantiation by the parent.
|
||||
*/
|
||||
this.group = null;
|
||||
|
||||
/**
|
||||
* @property {string} name - Description.
|
||||
* @default
|
||||
*/
|
||||
/**
|
||||
* @property {string} name - The user defined name given to this Sprite.
|
||||
* @default
|
||||
*/
|
||||
this.name = '';
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - A reference to the currently running game.
|
||||
* @property {number} type - The const type of this object.
|
||||
* @default
|
||||
*/
|
||||
this.game = game;
|
||||
this.type = Phaser.TEXT;
|
||||
|
||||
/**
|
||||
* @property {string} _text - Internal value.
|
||||
* @private
|
||||
*/
|
||||
this._text = text;
|
||||
|
||||
/**
|
||||
* @property {string} _style - Internal value.
|
||||
* @private
|
||||
*/
|
||||
this._style = style;
|
||||
|
||||
PIXI.Text.call(this, text, style);
|
||||
|
||||
/**
|
||||
* @property {Description} type - Description.
|
||||
*/
|
||||
this.type = Phaser.TEXT;
|
||||
|
||||
/**
|
||||
* @property {Description} position - Description.
|
||||
* @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;
|
||||
|
||||
// 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 with Sprite 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 {Description} _cache - Description.
|
||||
* @property {object} _cache - A mini cache for storing all of the calculated values.
|
||||
* @private
|
||||
*/
|
||||
this._cache = {
|
||||
this._cache = {
|
||||
|
||||
dirty: false,
|
||||
|
||||
// Transform cache
|
||||
a00: 1, a01: 0, a02: x, a10: 0, a11: 1, a12: y, id: 1,
|
||||
a00: 1,
|
||||
a01: 0,
|
||||
a02: x,
|
||||
a10: 0,
|
||||
a11: 1,
|
||||
a12: y,
|
||||
id: 1,
|
||||
|
||||
// The previous calculated position
|
||||
x: -1, y: -1,
|
||||
x: -1,
|
||||
y: -1,
|
||||
|
||||
// The actual scale values based on the worldTransform
|
||||
scaleX: 1, scaleY: 1
|
||||
scaleX: 1,
|
||||
scaleY: 1
|
||||
|
||||
};
|
||||
|
||||
@@ -103,7 +121,7 @@ Phaser.Text = function (game, x, y, text, style) {
|
||||
this._cache.y = this.y;
|
||||
|
||||
/**
|
||||
* @property {boolean} renderable - Description.
|
||||
* @property {boolean} renderable - A renderable object will be rendered to the context each frame.
|
||||
*/
|
||||
this.renderable = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user