Bitmap Fonts added

Docs updated
This commit is contained in:
Mat Groves 2013-05-06 21:59:37 +01:00
parent ae98487b16
commit b378c1ab85
68 changed files with 12469 additions and 3614 deletions

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -0,0 +1,157 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;pixi&#x2F;Intro.js - Pixi.JS</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.8.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.8.0&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http:&#x2F;&#x2F;www.goodboydigital.com&#x2F;pixijs&#x2F;logo_small.png" title="Pixi.JS"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 1.0.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
<li><a href="..&#x2F;classes/MovieClip.html">MovieClip</a></li>
<li><a href="..&#x2F;classes/Point.html">Point</a></li>
<li><a href="..&#x2F;classes/Rectangle.html">Rectangle</a></li>
<li><a href="..&#x2F;classes/Sprite.html">Sprite</a></li>
<li><a href="..&#x2F;classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="..&#x2F;classes/Stage.html">Stage</a></li>
<li><a href="..&#x2F;classes/Text.html">Text</a></li>
<li><a href="..&#x2F;classes/Texture.html">Texture</a></li>
<li><a href="..&#x2F;classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="..&#x2F;classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="..&#x2F;classes/WebGLRenderer.html">WebGLRenderer</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="..&#x2F;modules/PIXI.html">PIXI</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;Intro.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;**
* @author Mat Groves http:&#x2F;&#x2F;matgroves.com&#x2F; @Doormat23
*&#x2F;
(function(){
var root = this;
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -0,0 +1,164 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;pixi&#x2F;Outro.js - Pixi.JS</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.8.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.8.0&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http:&#x2F;&#x2F;www.goodboydigital.com&#x2F;pixijs&#x2F;logo_small.png" title="Pixi.JS"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 1.0.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
<li><a href="..&#x2F;classes/MovieClip.html">MovieClip</a></li>
<li><a href="..&#x2F;classes/Point.html">Point</a></li>
<li><a href="..&#x2F;classes/Rectangle.html">Rectangle</a></li>
<li><a href="..&#x2F;classes/Sprite.html">Sprite</a></li>
<li><a href="..&#x2F;classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="..&#x2F;classes/Stage.html">Stage</a></li>
<li><a href="..&#x2F;classes/Text.html">Text</a></li>
<li><a href="..&#x2F;classes/Texture.html">Texture</a></li>
<li><a href="..&#x2F;classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="..&#x2F;classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="..&#x2F;classes/WebGLRenderer.html">WebGLRenderer</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="..&#x2F;modules/PIXI.html">PIXI</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;Outro.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;**
* @author Mat Groves http:&#x2F;&#x2F;matgroves.com&#x2F; @Doormat23
*&#x2F;
if (typeof exports !== &#x27;undefined&#x27;) {
if (typeof module !== &#x27;undefined&#x27; &amp;&amp; module.exports) {
exports = module.exports = PIXI;
}
exports.PIXI = PIXI;
} else {
root.PIXI = PIXI;
}
}).call(this);
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
@ -127,17 +133,17 @@
*&#x2F;
&#x2F;**
* A Class that loads a bunch of images &#x2F; sprite sheet files. Once the assets have been loaded they are added to the PIXI Texture cache and can be accessed easily through PIXI.Texture.fromFrame(), PIXI.Texture.fromImage() and PIXI.Sprite.fromImage(), PIXI.Sprite.fromFromeId()
* When all items have been loaded this class will dispatch a &#x27;loaded&#x27; event
* As each individual item is loaded this class will dispatch a &#x27;progress&#x27; event
* A Class that loads a bunch of images &#x2F; sprite sheet &#x2F; bitmap font files. Once the assets have been loaded they are added to the PIXI Texture cache and can be accessed easily through PIXI.Texture.fromImage() and PIXI.Sprite.fromImage()
* When all items have been loaded this class will dispatch a &quot;onLoaded&quot; event
* As each individual item is loaded this class will dispatch a &quot;onProgress&quot; event
* @class AssetLoader
* @constructor
* @extends EventTarget
* @param assetURLs {Array} an array of image&#x2F;sprite sheet urls that you would like loaded supported. Supported image formats include &quot;jpeg&quot;, &quot;jpg&quot;, &quot;png&quot;, &quot;gif&quot;. Supported sprite sheet data formats only include &quot;JSON&quot; at this time
* @param {Array} assetURLs an array of image&#x2F;sprite sheet urls that you would like loaded supported. Supported image formats include &quot;jpeg&quot;, &quot;jpg&quot;, &quot;png&quot;, &quot;gif&quot;. Supported sprite sheet data formats only include &quot;JSON&quot; at this time. Supported bitmap font data formats include &quot;xml&quot; and &quot;fnt&quot;.
*&#x2F;
PIXI.AssetLoader = function(assetURLs)
{
PIXI.EventTarget.call( this );
PIXI.EventTarget.call(this);
&#x2F;**
* The array of asset URLs that are going to be loaded
@ -145,11 +151,19 @@ PIXI.AssetLoader = function(assetURLs)
* @type Array
*&#x2F;
this.assetURLs = assetURLs;
this.assets = [];
this.crossorigin = false;
}
this.loadersByType = {
&quot;jpg&quot;: PIXI.ImageLoader,
&quot;jpeg&quot;: PIXI.ImageLoader,
&quot;png&quot;: PIXI.ImageLoader,
&quot;gif&quot;: PIXI.ImageLoader,
&quot;json&quot;: PIXI.SpriteSheetLoader,
&quot;xml&quot;: PIXI.BitmapFontLoader,
&quot;fnt&quot;: PIXI.BitmapFontLoader
};
};
&#x2F;**
Fired when an item has loaded
@ -169,105 +183,45 @@ PIXI.AssetLoader.constructor = PIXI.AssetLoader;
*&#x2F;
PIXI.AssetLoader.prototype.load = function()
{
this.loadCount = this.assetURLs.length;
var imageTypes = [&quot;jpeg&quot;, &quot;jpg&quot;, &quot;png&quot;, &quot;gif&quot;];
var spriteSheetTypes = [&quot;json&quot;];
for (var i=0; i &lt; this.assetURLs.length; i++)
{
var filename = this.assetURLs[i];
var fileType = filename.split(&#x27;.&#x27;).pop().toLowerCase();
&#x2F;&#x2F; what are we loading?
var type = null;
for (var j=0; j &lt; imageTypes.length; j++)
{
if(fileType == imageTypes[j])
{
type = &quot;img&quot;;
break;
}
}
if(type != &quot;img&quot;)
{
for (var j=0; j &lt; spriteSheetTypes.length; j++)
{
if(fileType == spriteSheetTypes[j])
{
type = &quot;atlas&quot;;
break;
}
}
}
if(type == &quot;img&quot;)
{
var texture = PIXI.Texture.fromImage(filename, this.crossorigin);
if(!texture.baseTexture.hasLoaded)
{
var scope = this;
texture.baseTexture.addEventListener( &#x27;loaded&#x27;, function ( event )
{
scope.onAssetLoaded();
});
this.assets.push(texture);
}
else
{
&#x2F;&#x2F; already loaded!
this.loadCount--;
&#x2F;&#x2F; if this hits zero here.. then everything was cached!
if(this.loadCount == 0)
{
this.dispatchEvent( { type: &#x27;onComplete&#x27;, content: this } );
if(this.onComplete)this.onComplete();
}
}
}
else if(type == &quot;atlas&quot;)
{
var spriteSheetLoader = new PIXI.SpriteSheetLoader(filename);
spriteSheetLoader.crossorigin = this.crossorigin;
this.assets.push(spriteSheetLoader);
var scope = this;
spriteSheetLoader.addEventListener( &#x27;loaded&#x27;, function ( event )
{
scope.onAssetLoaded();
});
spriteSheetLoader.load();
}
else
{
&#x2F;&#x2F; dont know what the file is! :&#x2F;
&#x2F;&#x2F;this.loadCount--;
throw new Error(filename + &quot; is an unsupported file type &quot; + this);
}
&#x2F;&#x2F;this.assets[i].load();
};
}
var scope = this;
this.loadCount = this.assetURLs.length;
for (var i=0; i &lt; this.assetURLs.length; i++)
{
var fileName = this.assetURLs[i];
var fileType = fileName.split(&quot;.&quot;).pop().toLowerCase();
var loaderClass = this.loadersByType[fileType];
if(!loaderClass)
throw new Error(fileType + &quot; is an unsupported file type&quot;);
var loader = new loaderClass(fileName, this.crossorigin);
loader.addEventListener(&quot;loaded&quot;, function()
{
scope.onAssetLoaded();
});
loader.load();
}
};
&#x2F;**
* Invoked after each file is loaded
* @private
*&#x2F;
PIXI.AssetLoader.prototype.onAssetLoaded = function()
{
this.loadCount--;
this.dispatchEvent( { type: &#x27;onProgress&#x27;, content: this } );
if(this.onProgress)this.onProgress();
this.loadCount--;
this.dispatchEvent({type: &quot;onProgress&quot;, content: this});
if(this.onProgress) this.onProgress();
if(this.loadCount == 0)
{
this.dispatchEvent( { type: &#x27;onComplete&#x27;, content: this } );
if(this.onComplete)this.onComplete();
this.dispatchEvent({type: &quot;onComplete&quot;, content: this});
if(this.onComplete) this.onComplete();
}
}
};
</pre>

View file

@ -0,0 +1,275 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;pixi&#x2F;loaders&#x2F;BitmapFontLoader.js - Pixi.JS</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.8.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.8.0&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http:&#x2F;&#x2F;www.goodboydigital.com&#x2F;pixijs&#x2F;logo_small.png" title="Pixi.JS"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 1.0.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
<li><a href="..&#x2F;classes/MovieClip.html">MovieClip</a></li>
<li><a href="..&#x2F;classes/Point.html">Point</a></li>
<li><a href="..&#x2F;classes/Rectangle.html">Rectangle</a></li>
<li><a href="..&#x2F;classes/Sprite.html">Sprite</a></li>
<li><a href="..&#x2F;classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="..&#x2F;classes/Stage.html">Stage</a></li>
<li><a href="..&#x2F;classes/Text.html">Text</a></li>
<li><a href="..&#x2F;classes/Texture.html">Texture</a></li>
<li><a href="..&#x2F;classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="..&#x2F;classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="..&#x2F;classes/WebGLRenderer.html">WebGLRenderer</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="..&#x2F;modules/PIXI.html">PIXI</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;loaders&#x2F;BitmapFontLoader.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;**
* @author Mat Groves http:&#x2F;&#x2F;matgroves.com&#x2F; @Doormat23
*&#x2F;
&#x2F;**
* The xml loader is used to load in XML bitmap font data (&quot;xml&quot; or &quot;fnt&quot;)
* To generate the data you can use http:&#x2F;&#x2F;www.angelcode.com&#x2F;products&#x2F;bmfont&#x2F;
* This loader will also load the image file as the data.
* When loaded this class will dispatch a &quot;loaded&quot; event
* @class BitmapFontLoader
* @extends EventTarget
* @constructor
* @param {String} url the url of the sprite sheet JSON file
* @param {Boolean} crossorigin
*&#x2F;
PIXI.BitmapFontLoader = function(url, crossorigin)
{
&#x2F;*
* i use texture packer to load the assets..
* http:&#x2F;&#x2F;www.codeandweb.com&#x2F;texturepacker
* make sure to set the format as &quot;JSON&quot;
*&#x2F;
PIXI.EventTarget.call(this);
this.url = url;
this.baseUrl = url.replace(&#x2F;[^\&#x2F;]*$&#x2F;, &quot;&quot;);
this.texture = null;
this.crossorigin = crossorigin;
};
&#x2F;&#x2F; constructor
PIXI.BitmapFontLoader.constructor = PIXI.BitmapFontLoader;
&#x2F;**
* This will begin loading the JSON file
*&#x2F;
PIXI.BitmapFontLoader.prototype.load = function()
{
this.ajaxRequest = new XMLHttpRequest();
var scope = this;
this.ajaxRequest.onreadystatechange = function()
{
scope.onXMLLoaded();
};
this.ajaxRequest.open(&quot;GET&quot;, this.url, true);
if (this.ajaxRequest.overrideMimeType) this.ajaxRequest.overrideMimeType(&quot;application&#x2F;xml&quot;);
this.ajaxRequest.send(null)
};
&#x2F;**
* Invoked when XML file is loaded
* @private
*&#x2F;
PIXI.BitmapFontLoader.prototype.onXMLLoaded = function()
{
if (this.ajaxRequest.readyState == 4)
{
if (this.ajaxRequest.status == 200 || window.location.href.indexOf(&quot;http&quot;) == -1)
{
var textureUrl = this.baseUrl + this.ajaxRequest.responseXML.getElementsByTagName(&quot;page&quot;)[0].attributes.getNamedItem(&quot;file&quot;).nodeValue;
var image = new PIXI.ImageLoader(textureUrl, this.crossorigin);
this.texture = image.texture.baseTexture;
var data = {};
var info = this.ajaxRequest.responseXML.getElementsByTagName(&quot;info&quot;)[0];
var common = this.ajaxRequest.responseXML.getElementsByTagName(&quot;common&quot;)[0];
data.font = info.attributes.getNamedItem(&quot;face&quot;).nodeValue;
data.size = parseInt(info.attributes.getNamedItem(&quot;size&quot;).nodeValue, 10);
data.lineHeight = parseInt(common.attributes.getNamedItem(&quot;lineHeight&quot;).nodeValue, 10);
data.chars = {};
&#x2F;&#x2F;parse letters
var letters = this.ajaxRequest.responseXML.getElementsByTagName(&quot;char&quot;);
for (var i = 0; i &lt; letters.length; i++)
{
var charCode = parseInt(letters[i].attributes.getNamedItem(&quot;id&quot;).nodeValue, 10);
var textureRect = {
x: parseInt(letters[i].attributes.getNamedItem(&quot;x&quot;).nodeValue, 10),
y: parseInt(letters[i].attributes.getNamedItem(&quot;y&quot;).nodeValue, 10),
width: parseInt(letters[i].attributes.getNamedItem(&quot;width&quot;).nodeValue, 10),
height: parseInt(letters[i].attributes.getNamedItem(&quot;height&quot;).nodeValue, 10)
};
PIXI.TextureCache[charCode] = new PIXI.Texture(this.texture, textureRect);
data.chars[charCode] = {
xOffset: parseInt(letters[i].attributes.getNamedItem(&quot;xoffset&quot;).nodeValue, 10),
yOffset: parseInt(letters[i].attributes.getNamedItem(&quot;yoffset&quot;).nodeValue, 10),
xAdvance: parseInt(letters[i].attributes.getNamedItem(&quot;xadvance&quot;).nodeValue, 10),
kerning: {}
};
}
&#x2F;&#x2F;parse kernings
var kernings = this.ajaxRequest.responseXML.getElementsByTagName(&quot;kerning&quot;);
for (i = 0; i &lt; kernings.length; i++)
{
var first = parseInt(kernings[i].attributes.getNamedItem(&quot;first&quot;).nodeValue, 10);
var second = parseInt(kernings[i].attributes.getNamedItem(&quot;second&quot;).nodeValue, 10);
var amount = parseInt(kernings[i].attributes.getNamedItem(&quot;amount&quot;).nodeValue, 10);
data.chars[second].kerning[first] = amount;
}
PIXI.BitmapText.fonts[data.font] = data;
var scope = this;
image.addEventListener(&quot;loaded&quot;, function() {
scope.onLoaded();
});
image.load();
}
}
};
&#x2F;**
* Invoked when all files are loaded (xml&#x2F;fnt and texture)
* @private
*&#x2F;
PIXI.BitmapFontLoader.prototype.onLoaded = function()
{
this.dispatchEvent({type: &quot;loaded&quot;, content: this});
};
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

View file

@ -0,0 +1,200 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;pixi&#x2F;loaders&#x2F;ImageLoader.js - Pixi.JS</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.8.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.8.0&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http:&#x2F;&#x2F;www.goodboydigital.com&#x2F;pixijs&#x2F;logo_small.png" title="Pixi.JS"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 1.0.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
<li><a href="..&#x2F;classes/MovieClip.html">MovieClip</a></li>
<li><a href="..&#x2F;classes/Point.html">Point</a></li>
<li><a href="..&#x2F;classes/Rectangle.html">Rectangle</a></li>
<li><a href="..&#x2F;classes/Sprite.html">Sprite</a></li>
<li><a href="..&#x2F;classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="..&#x2F;classes/Stage.html">Stage</a></li>
<li><a href="..&#x2F;classes/Text.html">Text</a></li>
<li><a href="..&#x2F;classes/Texture.html">Texture</a></li>
<li><a href="..&#x2F;classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="..&#x2F;classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="..&#x2F;classes/WebGLRenderer.html">WebGLRenderer</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="..&#x2F;modules/PIXI.html">PIXI</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;loaders&#x2F;ImageLoader.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;**
* @author Mat Groves http:&#x2F;&#x2F;matgroves.com&#x2F; @Doormat23
*&#x2F;
&#x2F;**
* The image loader class is responsible for loading images file formats (&quot;jpeg&quot;, &quot;jpg&quot;, &quot;png&quot; and &quot;gif&quot;)
* Once the image has been loaded it is stored in the PIXI texture cache and can be accessed though PIXI.Texture.fromFrameId() and PIXI.Sprite.fromFromeId()
* When loaded this class will dispatch a &#x27;loaded&#x27; event
* @class ImageLoader
* @extends EventTarget
* @constructor
* @param {String} url The url of the image
* @param {Boolean} crossorigin
*&#x2F;
PIXI.ImageLoader = function(url, crossorigin)
{
PIXI.EventTarget.call(this);
this.texture = PIXI.Texture.fromImage(url, crossorigin);
};
&#x2F;&#x2F; constructor
PIXI.ImageLoader.constructor = PIXI.ImageLoader;
&#x2F;**
* Loads image or takes it from cache
*&#x2F;
PIXI.ImageLoader.prototype.load = function()
{
if(!this.texture.baseTexture.hasLoaded)
{
var scope = this;
this.texture.baseTexture.addEventListener(&quot;loaded&quot;, function()
{
scope.onLoaded();
});
}
else
{
this.onLoaded();
}
};
&#x2F;**
* Invoked when image file is loaded or it is already cached and ready to use
* @private
*&#x2F;
PIXI.ImageLoader.prototype.onLoaded = function()
{
this.dispatchEvent({type: &quot;loaded&quot;, content: this});
};
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
@ -130,30 +136,31 @@
* The sprite sheet loader is used to load in JSON sprite sheet data
* To generate the data you can use http:&#x2F;&#x2F;www.codeandweb.com&#x2F;texturepacker and publish the &quot;JSON&quot; format
* There is a free version so thats nice, although the paid version is great value for money.
* It is highly recommended to use Sprite sheets (also know as texture atlas&#x27;) as it means sprite&#x27;s can be batched and drawn together for highly increased rendering speed.
* It is highly recommended to use Sprite sheets (also know as texture atlas&quot;) as it means sprite&quot;s can be batched and drawn together for highly increased rendering speed.
* Once the data has been loaded the frames are stored in the PIXI texture cache and can be accessed though PIXI.Texture.fromFrameId() and PIXI.Sprite.fromFromeId()
* This loader will also load the image file that the Spritesheet points to as well as the data.
* When loaded this class will dispatch a &#x27;loaded&#x27; event
* When loaded this class will dispatch a &quot;loaded&quot; event
* @class SpriteSheetLoader
* @extends EventTarget
* @constructor
* @param url {String} the url of the sprite sheet JSON file
* @param {String} url the url of the sprite sheet JSON file
* @param {Boolean} crossorigin
*&#x2F;
PIXI.SpriteSheetLoader = function(url)
PIXI.SpriteSheetLoader = function(url, crossorigin)
{
&#x2F;*
* i use texture packer to load the assets..
* http:&#x2F;&#x2F;www.codeandweb.com&#x2F;texturepacker
* make sure to set the format as &quot;JSON&quot;
*&#x2F;
PIXI.EventTarget.call( this );
PIXI.EventTarget.call(this);
this.url = url;
this.baseUrl = url.replace(&#x2F;[^\&#x2F;]*$&#x2F;, &#x27;&#x27;);
this.texture;
this.baseUrl = url.replace(&#x2F;[^\&#x2F;]*$&#x2F;, &quot;&quot;);
this.texture = null;
this.frames = {};
this.crossorigin = false;
}
this.crossorigin = crossorigin;
};
&#x2F;&#x2F; constructor
PIXI.SpriteSheetLoader.constructor = PIXI.SpriteSheetLoader;
@ -165,32 +172,38 @@ PIXI.SpriteSheetLoader.prototype.load = function()
{
this.ajaxRequest = new AjaxRequest();
var scope = this;
this.ajaxRequest.onreadystatechange=function()
this.ajaxRequest.onreadystatechange = function()
{
scope.onLoaded();
}
scope.onJSONLoaded();
};
this.ajaxRequest.open(&quot;GET&quot;, this.url, true)
this.ajaxRequest.open(&quot;GET&quot;, this.url, true);
if (this.ajaxRequest.overrideMimeType) this.ajaxRequest.overrideMimeType(&quot;application&#x2F;json&quot;);
this.ajaxRequest.send(null)
}
};
PIXI.SpriteSheetLoader.prototype.onLoaded = function()
&#x2F;**
* Invoke when JSON file is loaded
* @private
*&#x2F;
PIXI.SpriteSheetLoader.prototype.onJSONLoaded = function()
{
if (this.ajaxRequest.readyState==4)
if (this.ajaxRequest.readyState == 4)
{
if (this.ajaxRequest.status==200 || window.location.href.indexOf(&quot;http&quot;)==-1)
if (this.ajaxRequest.status == 200 || window.location.href.indexOf(&quot;http&quot;) == -1)
{
var jsondata = eval(&quot;(&quot;+this.ajaxRequest.responseText+&quot;)&quot;);
var textureUrl = this.baseUrl + jsondata.meta.image;
this.texture = PIXI.Texture.fromImage(textureUrl, this.crossorigin).baseTexture;
&#x2F;&#x2F; if(!this.texture)this.texture = new PIXI.Texture(textureUrl);
var frameData = jsondata.frames;
for (var i in frameData)
var jsonData = eval(&quot;(&quot; + this.ajaxRequest.responseText + &quot;)&quot;);
var textureUrl = this.baseUrl + jsonData.meta.image;
var image = new PIXI.ImageLoader(textureUrl, this.crossorigin);
this.texture = image.texture.baseTexture;
var scope = this;
image.addEventListener(&quot;loaded&quot;, function(event) {
scope.onLoaded();
});
var frameData = jsonData.frames;
for (var i in frameData)
{
var rect = frameData[i].frame;
if (rect)
@ -201,32 +214,24 @@ PIXI.SpriteSheetLoader.prototype.onLoaded = function()
{
&#x2F;&#x2F;var realSize = frameData[i].spriteSourceSize;
PIXI.TextureCache[i].realSize = frameData[i].spriteSourceSize;
PIXI.TextureCache[i].trim.x = 0&#x2F;&#x2F; (realSize.x &#x2F; rect.w)
PIXI.TextureCache[i].trim.x = 0;&#x2F;&#x2F; (realSize.x &#x2F; rect.w)
&#x2F;&#x2F; calculate the offset!
}
&#x2F;&#x2F; this.frames[i] = ;
}
}
if(this.texture.hasLoaded)
{
this.dispatchEvent( { type: &#x27;loaded&#x27;, content: this } );
}
else
{
var scope = this;
&#x2F;&#x2F; wait for the texture to load..
this.texture.addEventListener(&#x27;loaded&#x27;, function(){
scope.dispatchEvent( { type: &#x27;loaded&#x27;, content: scope } );
});
}
}
}
}
image.load();
}
}
};
&#x2F;**
* Invoke when all files are loaded (json and texture)
* @private
*&#x2F;
PIXI.SpriteSheetLoader.prototype.onLoaded = function()
{
this.dispatchEvent({type: &quot;loaded&quot;, content: this});
};
</pre>
</div>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -0,0 +1,306 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;pixi&#x2F;text&#x2F;BitmapText.js - Pixi.JS</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.8.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.8.0&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http:&#x2F;&#x2F;www.goodboydigital.com&#x2F;pixijs&#x2F;logo_small.png" title="Pixi.JS"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 1.0.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/AssetLoader.html">AssetLoader</a></li>
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
<li><a href="..&#x2F;classes/MovieClip.html">MovieClip</a></li>
<li><a href="..&#x2F;classes/Point.html">Point</a></li>
<li><a href="..&#x2F;classes/Rectangle.html">Rectangle</a></li>
<li><a href="..&#x2F;classes/Sprite.html">Sprite</a></li>
<li><a href="..&#x2F;classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
<li><a href="..&#x2F;classes/Stage.html">Stage</a></li>
<li><a href="..&#x2F;classes/Text.html">Text</a></li>
<li><a href="..&#x2F;classes/Texture.html">Texture</a></li>
<li><a href="..&#x2F;classes/TilingSprite.html">TilingSprite</a></li>
<li><a href="..&#x2F;classes/WebGLBatch.html">WebGLBatch</a></li>
<li><a href="..&#x2F;classes/WebGLRenderer.html">WebGLRenderer</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="..&#x2F;modules/PIXI.html">PIXI</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;text&#x2F;BitmapText.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;**
* @author Mat Groves http:&#x2F;&#x2F;matgroves.com&#x2F; @Doormat23
*&#x2F;
&#x2F;**
* A Text Object will create a line(s) of text using bitmap font
* You can generate the fnt files using
* http:&#x2F;&#x2F;www.angelcode.com&#x2F;products&#x2F;bmfont&#x2F; for windows of
* http:&#x2F;&#x2F;www.bmglyph.com&#x2F; for mac.
* @class BitmapText
* @extends DisplayObjectContainer
* @constructor
* @param {String} text The copy that you would like the text to display
* @param {Object} [style] The style parameters
* @param {String} [style.font] default is &quot;20pt Arial&quot; The size and bitmap font id (must have loaded previously)
* @param {String} [style.align=&quot;left&quot;] An alignment of the multiline text (&quot;left&quot;, &quot;center&quot; or &quot;right&quot;)
*&#x2F;
&#x2F;&#x2F;* @param {Object} [style.font=&quot;bold 20pt Arial&quot;] The style and size of the font
PIXI.BitmapText = function(text, style)
{
PIXI.DisplayObjectContainer.call(this);
this.setText(text);
this.setStyle(style);
this.updateText();
this.dirty = false
};
&#x2F;&#x2F; constructor
PIXI.BitmapText.constructor = PIXI.BitmapText;
PIXI.BitmapText.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
&#x2F;**
* Set the copy for the text object
* @methos setText
* @param {String} text The copy that you would like the text to display
*&#x2F;
PIXI.BitmapText.prototype.setText = function(text)
{
this.text = text || &quot; &quot;;
this.dirty = true;
};
&#x2F;**
* Set the style of the text
* @method setStyle
* @param {Object} [style] The style parameters
* @param {Object} style.font The style and size of the font. If font size is not specified, it uses default bitmap font size. Font name is required
* @param {String} [style.align=&quot;left&quot;] An alignment of the multiline text (&quot;left&quot;, &quot;center&quot; or &quot;right&quot;)
*&#x2F;
PIXI.BitmapText.prototype.setStyle = function(style)
{
style = style || {};
style.align = style.align || &quot;left&quot;;
this.style = style;
var font = style.font.split(&quot; &quot;);
this.fontName = font[font.length - 1];
this.fontSize = font.length &gt;= 2 ? parseInt(font[font.length - 2], 10) : PIXI.BitmapText.fonts[this.fontName].size;
this.dirty = true;
};
&#x2F;**
* Renders text
* @private
*&#x2F;
PIXI.BitmapText.prototype.updateText = function()
{
var data = PIXI.BitmapText.fonts[this.fontName];
var pos = new PIXI.Point();
var prevCharCode = null;
var chars = [];
var maxLineWidth = 0;
var lineWidths = [];
var line = 0;
var scale = this.fontSize &#x2F; data.size;
for(var i = 0; i &lt; this.text.length; i++)
{
var charCode = this.text.charCodeAt(i);
if(charCode == &quot;\n&quot;.charCodeAt(0))
{
lineWidths.push(pos.x);
maxLineWidth = Math.max(maxLineWidth, pos.x);
line++;
pos.x = 0;
pos.y += data.lineHeight;
prevCharCode = null;
continue;
}
var charData = data.chars[charCode];
if(!charData) continue;
if(prevCharCode &amp;&amp; charData[prevCharCode])
{
pos.x += charData.kerning[prevCharCode];
}
chars.push({line: line, charCode: charCode, position: new PIXI.Point(pos.x + charData.xOffset, pos.y + charData.yOffset)});
pos.x += charData.xAdvance;
prevCharCode = charCode;
}
lineWidths.push(pos.x);
maxLineWidth = Math.max(maxLineWidth, pos.x);
var lineAlignOffsets = [];
for(i = 0; i &lt;= line; i++)
{
var alignOffset = 0;
if(this.style.align == &quot;right&quot;)
{
alignOffset = maxLineWidth - lineWidths[i];
}
else if(this.style.align == &quot;center&quot;)
{
alignOffset = (maxLineWidth - lineWidths[i]) &#x2F; 2;
}
lineAlignOffsets.push(alignOffset);
}
for(i = 0; i &lt; chars.length; i++)
{
var char = PIXI.Sprite.fromFrame(chars[i].charCode);
char.position.x = (chars[i].position.x + lineAlignOffsets[chars[i].line]) * scale;
char.position.y = chars[i].position.y * scale;
char.scale.x = char.scale.y = scale;
this.addChild(char);
}
this.width = pos.x * scale;
this.height = (pos.y + data.lineHeight) * scale;
};
&#x2F;**
* @private
*&#x2F;
PIXI.BitmapText.prototype.updateTransform = function()
{
if(this.dirty)
{
while(this.children.length &gt; 0)
{
this.removeChild(this.getChildAt(0));
}
this.updateText();
this.dirty = false;
}
PIXI.DisplayObjectContainer.prototype.updateTransform.call(this);
};
PIXI.BitmapText.fonts = {};
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

View file

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;pixi&#x2F;Text.js - Pixi.JS</title>
<title>src&#x2F;pixi&#x2F;text&#x2F;Text.js - Pixi.JS</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.8.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>
@ -118,7 +124,7 @@
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;Text.js</h1>
<h1 class="file-heading">File: src&#x2F;pixi&#x2F;text&#x2F;Text.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
@ -127,110 +133,156 @@
*&#x2F;
&#x2F;**
* A Text Object will create a line of text
* A Text Object will create a line(s) of text to split a line you can use &quot;\n&quot;
* @class Text
* @extends Sprite
* @constructor
* @param text {String} The copy that you would like the text to display
* @param fontStyle {String} the style and size of the font eg &quot;bold 20px Arial&quot;
* @param fillStyle {Object} a canvas fillstyle that will be used on the text eg &quot;red&quot;, &quot;#00FF00&quot; can also be null
* @param strokeStyle {String} a canvas fillstyle that will be used on the text stroke eg &quot;blue&quot;, &quot;#FCFF00&quot; can also be null
* @param strokeThickness {Number} A number that represents the thicknes of the stroke. default is 0 (no stroke)
* @param {String} text The copy that you would like the text to display
* @param {Object} [style] The style parameters
* @param {String} [style.font] default &quot;bold 20pt Arial&quot; The style and size of the font
* @param {Object} [style.fill=&quot;black&quot;] A canvas fillstyle that will be used on the text eg &quot;red&quot;, &quot;#00FF00&quot;
* @param {String} [style.align=&quot;left&quot;] An alignment of the multiline text (&quot;left&quot;, &quot;center&quot; or &quot;right&quot;)
* @param {String} [style.stroke] A canvas fillstyle that will be used on the text stroke eg &quot;blue&quot;, &quot;#FCFF00&quot;
* @param {Number} [style.strokeThickness=0] A number that represents the thickness of the stroke. Default is 0 (no stroke)
*&#x2F;
PIXI.Text = function(text, fontStyle, fillStyle, strokeStyle, strokeThickness)
PIXI.Text = function(text, style)
{
this.canvas = document.createElement(&quot;canvas&quot;);
this.context = this.canvas.getContext(&quot;2d&quot;);
&#x2F;&#x2F;document.body.appendChild(this.canvas);
this.setText(text);
this.setStyle(fontStyle, fillStyle, strokeStyle, strokeThickness);
this.updateText();
PIXI.Sprite.call( this, PIXI.Texture.fromCanvas(this.canvas));
&#x2F;&#x2F; need to store a canvas that can
}
this.canvas = document.createElement(&quot;canvas&quot;);
this.context = this.canvas.getContext(&quot;2d&quot;);
PIXI.Sprite.call(this, PIXI.Texture.fromCanvas(this.canvas));
this.setText(text);
this.setStyle(style);
this.updateText();
this.dirty = false;
};
&#x2F;&#x2F; constructor
PIXI.Text.constructor = PIXI.Text;
PIXI.Text.prototype = Object.create( PIXI.Sprite.prototype );
&#x2F;**
* Set the copy for the text object
* @methos setText
* @param text {String} The copy that you would like the text to display
*&#x2F;
PIXI.Text.prototype.setText = function(text)
{
this.text = text || &quot; &quot;;
this.dirty = true;
}
PIXI.Text.prototype = Object.create(PIXI.Sprite.prototype);
&#x2F;**
* Set the style of the text
* @method setStyle
* @constructor
* @param fontStyle {String} the style and size of the font eg &quot;bold 20px Arial&quot;
* @param fillStyle {Object} a canvas fillstyle that will be used on the text eg &quot;red&quot;, &quot;#00FF00&quot; can also be null
* @param strokeStyle {String} a canvas fillstyle that will be used on the text stroke eg &quot;blue&quot;, &quot;#FCFF00&quot; can also be null
* @param strokeThickness {Number} A number that represents the thicknes of the stroke. default is 0 (no stroke)
* @param {Object} [style] The style parameters
* @param {String} [style.font=&quot;bold 20pt Arial&quot;] The style and size of the font
* @param {Object} [style.fill=&quot;black&quot;] A canvas fillstyle that will be used on the text eg &quot;red&quot;, &quot;#00FF00&quot;
* @param {String} [style.align=&quot;left&quot;] An alignment of the multiline text (&quot;left&quot;, &quot;center&quot; or &quot;right&quot;)
* @param {String} [style.stroke] A canvas fillstyle that will be used on the text stroke eg &quot;blue&quot;, &quot;#FCFF00&quot;
* @param {Number} [style.strokeThickness=0] A number that represents the thickness of the stroke. Default is 0 (no stroke)
*&#x2F;
PIXI.Text.prototype.setStyle = function(fontStyle, fillStyle, strokeStyle, strokeThickness)
PIXI.Text.prototype.setStyle = function(style)
{
this.fontStyle = fontStyle || &quot;bold 20pt Arial&quot;;
this.fillStyle = fillStyle;
this.strokeStyle = strokeStyle;
this.strokeThickness = strokeThickness || 0;
this.dirty = true;
}
style = style || {};
style.font = style.font || &quot;bold 20pt Arial&quot;;
style.fill = style.fill || &quot;black&quot;;
style.align = style.align || &quot;left&quot;;
style.strokeThickness = style.strokeThickness || 0;
this.style = style;
this.dirty = true;
};
&#x2F;**
* Set the copy for the text object. To split a line you can use &quot;\n&quot;
* @methos setText
* @param {String} text The copy that you would like the text to display
*&#x2F;
PIXI.Sprite.prototype.setText = function(text)
{
this.text = text || &quot; &quot;;
this.dirty = true;
};
&#x2F;**
* Renders text
* @private
*&#x2F;
PIXI.Text.prototype.updateText = function()
{
&#x2F;&#x2F; console.log(this.text);
this.context.font = this.fontStyle;
this.canvas.width = this.context.measureText(this.text).width + this.strokeThickness&#x2F;&#x2F;textDimensions.width;
this.canvas.height = this.determineFontHeight(&quot;font: &quot; + this.fontStyle + &quot;;&quot;)+ this.strokeThickness;&#x2F;&#x2F; textDimensions.height;
this.context.font = this.style.font;
this.context.fillStyle = this.fillStyle;
this.context.font = this.fontStyle;
&#x2F;&#x2F;split text into lines
var lines = this.text.split(&quot;\n&quot;);
&#x2F;&#x2F;calculate text width
var lineWidths = [];
var maxLineWidth = 0;
for (var i = 0; i &lt; lines.length; i++)
{
var lineWidth = this.context.measureText(lines[i]).width;
lineWidths[i] = lineWidth;
maxLineWidth = Math.max(maxLineWidth, lineWidth);
}
this.canvas.width = maxLineWidth + this.style.strokeThickness;
this.context.strokeStyle = this.strokeStyle;
this.context.lineWidth = this.strokeThickness;
&#x2F;&#x2F;calculate text height
var lineHeight = this.determineFontHeight(&quot;font: &quot; + this.style.font + &quot;;&quot;) + this.style.strokeThickness;
this.canvas.height = lineHeight * lines.length;
this.context.textBaseline=&quot;top&quot;;
if(this.strokeStyle &amp;&amp; this.strokeThickness)this.context.strokeText(this.text, this.strokeThickness&#x2F;2, this.strokeThickness&#x2F;2);
if(this.fillStyle)this.context.fillText(this.text, this.strokeThickness&#x2F;2, this.strokeThickness&#x2F;2);
&#x2F;&#x2F;set canvas text styles
this.context.fillStyle = this.style.fill;
this.context.font = this.style.font;
&#x2F;&#x2F; console.log(&quot;&#x2F;&#x2F;&quot;)
}
this.context.strokeStyle = this.style.stroke;
this.context.lineWidth = this.style.strokeThickness;
this.context.textBaseline = &quot;top&quot;;
&#x2F;&#x2F;draw lines line by line
for (i = 0; i &lt; lines.length; i++)
{
var linePosition = new PIXI.Point(this.style.strokeThickness &#x2F; 2, this.style.strokeThickness &#x2F; 2 + i * lineHeight);
if(this.style.align == &quot;right&quot;)
{
linePosition.x += maxLineWidth - lineWidths[i];
}
else if(this.style.align == &quot;center&quot;)
{
linePosition.x += (maxLineWidth - lineWidths[i]) &#x2F; 2;
}
if(this.style.stroke &amp;&amp; this.style.strokeThickness)
{
this.context.strokeText(lines[i], linePosition.x, linePosition.y);
}
if(this.style.fill)
{
this.context.fillText(lines[i], linePosition.x, linePosition.y);
}
}
this.updateTexture();
};
&#x2F;**
* Updates texture size based on canvas size
* @private
*&#x2F;
PIXI.Text.prototype.updateTexture = function()
{
this.texture.baseTexture.width = this.canvas.width;
this.texture.baseTexture.height = this.canvas.height;
this.texture.frame.width = this.canvas.width;
this.texture.frame.height = this.canvas.height;
PIXI.texturesToUpdate.push(this.texture.baseTexture);
};
&#x2F;**
* @private
*&#x2F;
PIXI.Text.prototype.updateTransform = function()
{
if(this.dirty)
{
this.updateText();
&#x2F;&#x2F; update the texture..
this.texture.baseTexture.width = this.canvas.width;
this.texture.baseTexture.height = this.canvas.height;
this.texture.frame.width = this.canvas.width;
this.texture.frame.height = this.canvas.height;
PIXI.texturesToUpdate.push(this.texture.baseTexture);
this.dirty = false;
}
PIXI.Sprite.prototype.updateTransform.call( this );
}
PIXI.Sprite.prototype.updateTransform.call(this);
};
&#x2F;*
* http:&#x2F;&#x2F;stackoverflow.com&#x2F;users&#x2F;34441&#x2F;ellisbben
@ -238,9 +290,9 @@ PIXI.Text.prototype.updateTransform = function()
*&#x2F;
PIXI.Text.prototype.determineFontHeight = function(fontStyle)
{
&#x2F;&#x2F; build a little refference dictionary so if the font style has been used return a
&#x2F;&#x2F; build a little reference dictionary so if the font style has been used return a
&#x2F;&#x2F; cached version...
var result = PIXI.Text.heightCache[fontStyle]
var result = PIXI.Text.heightCache[fontStyle];
if(!result)
{
@ -252,7 +304,7 @@ PIXI.Text.prototype.determineFontHeight = function(fontStyle)
body.appendChild(dummy);
result = dummy.offsetHeight;
PIXI.Text.heightCache[fontStyle] = result
PIXI.Text.heightCache[fontStyle] = result;
body.removeChild(dummy);
}
@ -267,7 +319,7 @@ PIXI.Text.prototype.destroy = function(destroyTexture)
this.texture.destroy();
}
}
};
PIXI.Text.heightCache = {};

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>

View file

@ -45,12 +45,18 @@
<li><a href="..&#x2F;classes/BaseTexture.html">BaseTexture</a></li>
<li><a href="..&#x2F;classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
<li><a href="..&#x2F;classes/BitmapText.html">BitmapText</a></li>
<li><a href="..&#x2F;classes/CanvasRenderer.html">CanvasRenderer</a></li>
<li><a href="..&#x2F;classes/DisplayObject.html">DisplayObject</a></li>
<li><a href="..&#x2F;classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
<li><a href="..&#x2F;classes/ImageLoader.html">ImageLoader</a></li>
<li><a href="..&#x2F;classes/InteractionData.html">InteractionData</a></li>
<li><a href="..&#x2F;classes/InteractionManager.html">InteractionManager</a></li>