Fixed graphics bug + updated docs
Fixed issue with getBounds being incorrect for graphics Updated docs Linted code
This commit is contained in:
parent
53506da65e
commit
7713731ab3
145 changed files with 15583 additions and 24078 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
</div>
|
||||
<div class="yui3-u-1-4 version">
|
||||
<em>API Docs for: 1.3.0</em>
|
||||
<em>API Docs for: 1.4.0</em>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bd" class="yui3-g">
|
||||
|
@ -45,6 +45,8 @@
|
|||
|
||||
<li><a href="../classes/AssetLoader.html">AssetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/AtlasLoader.html">AtlasLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
@ -61,7 +63,7 @@
|
|||
|
||||
<li><a href="../classes/ColorMatrixFilter.html">ColorMatrixFilter</a></li>
|
||||
|
||||
<li><a href="../classes/CustomRenderable.html">CustomRenderable</a></li>
|
||||
<li><a href="../classes/ColorStepFilter.html">ColorStepFilter</a></li>
|
||||
|
||||
<li><a href="../classes/DisplacementFilter.html">DisplacementFilter</a></li>
|
||||
|
||||
|
@ -75,7 +77,7 @@
|
|||
|
||||
<li><a href="../classes/Graphics.html">Graphics</a></li>
|
||||
|
||||
<li><a href="../classes/GreyFilter.html">GreyFilter</a></li>
|
||||
<li><a href="../classes/GrayFilter.html">GrayFilter</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
|
@ -87,6 +89,8 @@
|
|||
|
||||
<li><a href="../classes/PixelateFilter.html">PixelateFilter</a></li>
|
||||
|
||||
<li><a href="../classes/PIXI.PixiShader.html">PIXI.PixiShader</a></li>
|
||||
|
||||
<li><a href="../classes/Point.html">Point</a></li>
|
||||
|
||||
<li><a href="../classes/Polygon.html">Polygon</a></li>
|
||||
|
@ -109,10 +113,10 @@
|
|||
|
||||
<li><a href="../classes/Spine.html">Spine</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite.html">Sprite</a></li>
|
||||
|
||||
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite™.html">Sprite™</a></li>
|
||||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
@ -121,8 +125,6 @@
|
|||
|
||||
<li><a href="../classes/TilingSprite.html">TilingSprite</a></li>
|
||||
|
||||
<li><a href="../classes/WebGLBatch.html">WebGLBatch</a></li>
|
||||
|
||||
<li><a href="../classes/WebGLRenderer.html">WebGLRenderer</a></li>
|
||||
|
||||
</ul>
|
||||
|
@ -175,10 +177,10 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* The xml loader is used to load in XML bitmap font data ("xml" or "fnt")
|
||||
* The xml loader is used to load in XML bitmap font data ('xml' or 'fnt')
|
||||
* To generate the data you can use http://www.angelcode.com/products/bmfont/
|
||||
* This loader will also load the image file as the data.
|
||||
* When loaded this class will dispatch a "loaded" event
|
||||
* When loaded this class will dispatch a 'loaded' event
|
||||
*
|
||||
* @class BitmapFontLoader
|
||||
* @uses EventTarget
|
||||
|
@ -191,7 +193,7 @@ PIXI.BitmapFontLoader = function(url, crossorigin)
|
|||
/*
|
||||
* i use texture packer to load the assets..
|
||||
* http://www.codeandweb.com/texturepacker
|
||||
* make sure to set the format as "JSON"
|
||||
* make sure to set the format as 'JSON'
|
||||
*/
|
||||
PIXI.EventTarget.call(this);
|
||||
|
||||
|
@ -218,7 +220,7 @@ PIXI.BitmapFontLoader = function(url, crossorigin)
|
|||
* @type String
|
||||
* @readOnly
|
||||
*/
|
||||
this.baseUrl = url.replace(/[^\/]*$/, "");
|
||||
this.baseUrl = url.replace(/[^\/]*$/, '');
|
||||
|
||||
/**
|
||||
* [read-only] The texture of the bitmap font
|
||||
|
@ -246,9 +248,9 @@ PIXI.BitmapFontLoader.prototype.load = function()
|
|||
scope.onXMLLoaded();
|
||||
};
|
||||
|
||||
this.ajaxRequest.open("GET", this.url, true);
|
||||
if (this.ajaxRequest.overrideMimeType) this.ajaxRequest.overrideMimeType("application/xml");
|
||||
this.ajaxRequest.send(null)
|
||||
this.ajaxRequest.open('GET', this.url, true);
|
||||
if (this.ajaxRequest.overrideMimeType) this.ajaxRequest.overrideMimeType('application/xml');
|
||||
this.ajaxRequest.send(null);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -259,40 +261,40 @@ PIXI.BitmapFontLoader.prototype.load = function()
|
|||
*/
|
||||
PIXI.BitmapFontLoader.prototype.onXMLLoaded = function()
|
||||
{
|
||||
if (this.ajaxRequest.readyState == 4)
|
||||
if (this.ajaxRequest.readyState === 4)
|
||||
{
|
||||
if (this.ajaxRequest.status == 200 || window.location.href.indexOf("http") == -1)
|
||||
if (this.ajaxRequest.status === 200 || window.location.protocol.indexOf('http') === -1)
|
||||
{
|
||||
var textureUrl = this.baseUrl + this.ajaxRequest.responseXML.getElementsByTagName("page")[0].attributes.getNamedItem("file").nodeValue;
|
||||
var textureUrl = this.baseUrl + this.ajaxRequest.responseXML.getElementsByTagName('page')[0].attributes.getNamedItem('file').nodeValue;
|
||||
var image = new PIXI.ImageLoader(textureUrl, this.crossorigin);
|
||||
this.texture = image.texture.baseTexture;
|
||||
|
||||
var data = {};
|
||||
var info = this.ajaxRequest.responseXML.getElementsByTagName("info")[0];
|
||||
var common = this.ajaxRequest.responseXML.getElementsByTagName("common")[0];
|
||||
data.font = info.attributes.getNamedItem("face").nodeValue;
|
||||
data.size = parseInt(info.attributes.getNamedItem("size").nodeValue, 10);
|
||||
data.lineHeight = parseInt(common.attributes.getNamedItem("lineHeight").nodeValue, 10);
|
||||
var info = this.ajaxRequest.responseXML.getElementsByTagName('info')[0];
|
||||
var common = this.ajaxRequest.responseXML.getElementsByTagName('common')[0];
|
||||
data.font = info.attributes.getNamedItem('face').nodeValue;
|
||||
data.size = parseInt(info.attributes.getNamedItem('size').nodeValue, 10);
|
||||
data.lineHeight = parseInt(common.attributes.getNamedItem('lineHeight').nodeValue, 10);
|
||||
data.chars = {};
|
||||
|
||||
//parse letters
|
||||
var letters = this.ajaxRequest.responseXML.getElementsByTagName("char");
|
||||
var letters = this.ajaxRequest.responseXML.getElementsByTagName('char');
|
||||
|
||||
for (var i = 0; i < letters.length; i++)
|
||||
{
|
||||
var charCode = parseInt(letters[i].attributes.getNamedItem("id").nodeValue, 10);
|
||||
var charCode = parseInt(letters[i].attributes.getNamedItem('id').nodeValue, 10);
|
||||
|
||||
var textureRect = new PIXI.Rectangle(
|
||||
parseInt(letters[i].attributes.getNamedItem("x").nodeValue, 10),
|
||||
parseInt(letters[i].attributes.getNamedItem("y").nodeValue, 10),
|
||||
parseInt(letters[i].attributes.getNamedItem("width").nodeValue, 10),
|
||||
parseInt(letters[i].attributes.getNamedItem("height").nodeValue, 10)
|
||||
parseInt(letters[i].attributes.getNamedItem('x').nodeValue, 10),
|
||||
parseInt(letters[i].attributes.getNamedItem('y').nodeValue, 10),
|
||||
parseInt(letters[i].attributes.getNamedItem('width').nodeValue, 10),
|
||||
parseInt(letters[i].attributes.getNamedItem('height').nodeValue, 10)
|
||||
);
|
||||
|
||||
data.chars[charCode] = {
|
||||
xOffset: parseInt(letters[i].attributes.getNamedItem("xoffset").nodeValue, 10),
|
||||
yOffset: parseInt(letters[i].attributes.getNamedItem("yoffset").nodeValue, 10),
|
||||
xAdvance: parseInt(letters[i].attributes.getNamedItem("xadvance").nodeValue, 10),
|
||||
xOffset: parseInt(letters[i].attributes.getNamedItem('xoffset').nodeValue, 10),
|
||||
yOffset: parseInt(letters[i].attributes.getNamedItem('yoffset').nodeValue, 10),
|
||||
xAdvance: parseInt(letters[i].attributes.getNamedItem('xadvance').nodeValue, 10),
|
||||
kerning: {},
|
||||
texture: PIXI.TextureCache[charCode] = new PIXI.Texture(this.texture, textureRect)
|
||||
|
||||
|
@ -300,12 +302,12 @@ PIXI.BitmapFontLoader.prototype.onXMLLoaded = function()
|
|||
}
|
||||
|
||||
//parse kernings
|
||||
var kernings = this.ajaxRequest.responseXML.getElementsByTagName("kerning");
|
||||
var kernings = this.ajaxRequest.responseXML.getElementsByTagName('kerning');
|
||||
for (i = 0; i < kernings.length; i++)
|
||||
{
|
||||
var first = parseInt(kernings[i].attributes.getNamedItem("first").nodeValue, 10);
|
||||
var second = parseInt(kernings[i].attributes.getNamedItem("second").nodeValue, 10);
|
||||
var amount = parseInt(kernings[i].attributes.getNamedItem("amount").nodeValue, 10);
|
||||
var first = parseInt(kernings[i].attributes.getNamedItem('first').nodeValue, 10);
|
||||
var second = parseInt(kernings[i].attributes.getNamedItem('second').nodeValue, 10);
|
||||
var amount = parseInt(kernings[i].attributes.getNamedItem('amount').nodeValue, 10);
|
||||
|
||||
data.chars[second].kerning[first] = amount;
|
||||
|
||||
|
@ -314,7 +316,7 @@ PIXI.BitmapFontLoader.prototype.onXMLLoaded = function()
|
|||
PIXI.BitmapText.fonts[data.font] = data;
|
||||
|
||||
var scope = this;
|
||||
image.addEventListener("loaded", function() {
|
||||
image.addEventListener('loaded', function() {
|
||||
scope.onLoaded();
|
||||
});
|
||||
image.load();
|
||||
|
@ -330,7 +332,7 @@ PIXI.BitmapFontLoader.prototype.onXMLLoaded = function()
|
|||
*/
|
||||
PIXI.BitmapFontLoader.prototype.onLoaded = function()
|
||||
{
|
||||
this.dispatchEvent({type: "loaded", content: this});
|
||||
this.dispatchEvent({type: 'loaded', content: this});
|
||||
};
|
||||
|
||||
</pre>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue