Bitmap Fonts added
Docs updated
This commit is contained in:
parent
ae98487b16
commit
b378c1ab85
68 changed files with 12469 additions and 3614 deletions
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
157
docs/files/src_pixi_Intro.js.html
Normal file
157
docs/files/src_pixi_Intro.js.html
Normal file
|
@ -0,0 +1,157 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>src/pixi/Intro.js - Pixi.JS</title>
|
||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.8.0/build/cssgrids/cssgrids-min.css">
|
||||
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
||||
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
|
||||
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
|
||||
<script src="http://yui.yahooapis.com/combo?3.8.0/build/yui/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://www.goodboydigital.com/pixijs/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="../classes/AssetLoader.html">AssetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
||||
<li><a href="../classes/MovieClip.html">MovieClip</a></li>
|
||||
|
||||
<li><a href="../classes/Point.html">Point</a></li>
|
||||
|
||||
<li><a href="../classes/Rectangle.html">Rectangle</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite.html">Sprite</a></li>
|
||||
|
||||
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
||||
<li><a href="../classes/Texture.html">Texture</a></li>
|
||||
|
||||
<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>
|
||||
|
||||
<ul id="api-modules" class="apis modules">
|
||||
|
||||
<li><a href="../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/pixi/Intro.js</h1>
|
||||
|
||||
<div class="file">
|
||||
<pre class="code prettyprint linenums">
|
||||
/**
|
||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||
*/
|
||||
|
||||
(function(){
|
||||
|
||||
var root = this;
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../assets/vendor/prettify/prettify-min.js"></script>
|
||||
<script>prettyPrint();</script>
|
||||
<script src="../assets/js/yui-prettify.js"></script>
|
||||
<script src="../assets/../api.js"></script>
|
||||
<script src="../assets/js/api-filter.js"></script>
|
||||
<script src="../assets/js/api-list.js"></script>
|
||||
<script src="../assets/js/api-search.js"></script>
|
||||
<script src="../assets/js/apidocs.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
164
docs/files/src_pixi_Outro.js.html
Normal file
164
docs/files/src_pixi_Outro.js.html
Normal file
|
@ -0,0 +1,164 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>src/pixi/Outro.js - Pixi.JS</title>
|
||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.8.0/build/cssgrids/cssgrids-min.css">
|
||||
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
||||
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
|
||||
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
|
||||
<script src="http://yui.yahooapis.com/combo?3.8.0/build/yui/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://www.goodboydigital.com/pixijs/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="../classes/AssetLoader.html">AssetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
||||
<li><a href="../classes/MovieClip.html">MovieClip</a></li>
|
||||
|
||||
<li><a href="../classes/Point.html">Point</a></li>
|
||||
|
||||
<li><a href="../classes/Rectangle.html">Rectangle</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite.html">Sprite</a></li>
|
||||
|
||||
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
||||
<li><a href="../classes/Texture.html">Texture</a></li>
|
||||
|
||||
<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>
|
||||
|
||||
<ul id="api-modules" class="apis modules">
|
||||
|
||||
<li><a href="../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/pixi/Outro.js</h1>
|
||||
|
||||
<div class="file">
|
||||
<pre class="code prettyprint linenums">
|
||||
/**
|
||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||
*/
|
||||
|
||||
if (typeof exports !== 'undefined') {
|
||||
if (typeof module !== 'undefined' && 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="../assets/vendor/prettify/prettify-min.js"></script>
|
||||
<script>prettyPrint();</script>
|
||||
<script src="../assets/js/yui-prettify.js"></script>
|
||||
<script src="../assets/../api.js"></script>
|
||||
<script src="../assets/js/api-filter.js"></script>
|
||||
<script src="../assets/js/api-list.js"></script>
|
||||
<script src="../assets/js/api-search.js"></script>
|
||||
<script src="../assets/js/apidocs.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
@ -127,17 +133,17 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* A Class that loads a bunch of images / 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 'loaded' event
|
||||
* As each individual item is loaded this class will dispatch a 'progress' event
|
||||
* A Class that loads a bunch of images / sprite sheet / 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 "onLoaded" event
|
||||
* As each individual item is loaded this class will dispatch a "onProgress" event
|
||||
* @class AssetLoader
|
||||
* @constructor
|
||||
* @extends EventTarget
|
||||
* @param assetURLs {Array} an array of image/sprite sheet urls that you would like loaded supported. Supported image formats include "jpeg", "jpg", "png", "gif". Supported sprite sheet data formats only include "JSON" at this time
|
||||
* @param {Array} assetURLs an array of image/sprite sheet urls that you would like loaded supported. Supported image formats include "jpeg", "jpg", "png", "gif". Supported sprite sheet data formats only include "JSON" at this time. Supported bitmap font data formats include "xml" and "fnt".
|
||||
*/
|
||||
PIXI.AssetLoader = function(assetURLs)
|
||||
{
|
||||
PIXI.EventTarget.call( this );
|
||||
PIXI.EventTarget.call(this);
|
||||
|
||||
/**
|
||||
* The array of asset URLs that are going to be loaded
|
||||
|
@ -145,11 +151,19 @@ PIXI.AssetLoader = function(assetURLs)
|
|||
* @type Array
|
||||
*/
|
||||
this.assetURLs = assetURLs;
|
||||
|
||||
this.assets = [];
|
||||
|
||||
this.crossorigin = false;
|
||||
}
|
||||
|
||||
this.loadersByType = {
|
||||
"jpg": PIXI.ImageLoader,
|
||||
"jpeg": PIXI.ImageLoader,
|
||||
"png": PIXI.ImageLoader,
|
||||
"gif": PIXI.ImageLoader,
|
||||
"json": PIXI.SpriteSheetLoader,
|
||||
"xml": PIXI.BitmapFontLoader,
|
||||
"fnt": PIXI.BitmapFontLoader
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
Fired when an item has loaded
|
||||
|
@ -169,105 +183,45 @@ PIXI.AssetLoader.constructor = PIXI.AssetLoader;
|
|||
*/
|
||||
PIXI.AssetLoader.prototype.load = function()
|
||||
{
|
||||
this.loadCount = this.assetURLs.length;
|
||||
var imageTypes = ["jpeg", "jpg", "png", "gif"];
|
||||
|
||||
var spriteSheetTypes = ["json"];
|
||||
|
||||
for (var i=0; i < this.assetURLs.length; i++)
|
||||
{
|
||||
var filename = this.assetURLs[i];
|
||||
var fileType = filename.split('.').pop().toLowerCase();
|
||||
// what are we loading?
|
||||
var type = null;
|
||||
|
||||
for (var j=0; j < imageTypes.length; j++)
|
||||
{
|
||||
if(fileType == imageTypes[j])
|
||||
{
|
||||
type = "img";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(type != "img")
|
||||
{
|
||||
for (var j=0; j < spriteSheetTypes.length; j++)
|
||||
{
|
||||
if(fileType == spriteSheetTypes[j])
|
||||
{
|
||||
type = "atlas";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(type == "img")
|
||||
{
|
||||
|
||||
var texture = PIXI.Texture.fromImage(filename, this.crossorigin);
|
||||
if(!texture.baseTexture.hasLoaded)
|
||||
{
|
||||
|
||||
var scope = this;
|
||||
texture.baseTexture.addEventListener( 'loaded', function ( event )
|
||||
{
|
||||
scope.onAssetLoaded();
|
||||
});
|
||||
|
||||
this.assets.push(texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// already loaded!
|
||||
this.loadCount--;
|
||||
// if this hits zero here.. then everything was cached!
|
||||
if(this.loadCount == 0)
|
||||
{
|
||||
this.dispatchEvent( { type: 'onComplete', content: this } );
|
||||
if(this.onComplete)this.onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(type == "atlas")
|
||||
{
|
||||
var spriteSheetLoader = new PIXI.SpriteSheetLoader(filename);
|
||||
spriteSheetLoader.crossorigin = this.crossorigin;
|
||||
this.assets.push(spriteSheetLoader);
|
||||
|
||||
var scope = this;
|
||||
spriteSheetLoader.addEventListener( 'loaded', function ( event )
|
||||
{
|
||||
scope.onAssetLoaded();
|
||||
});
|
||||
|
||||
spriteSheetLoader.load();
|
||||
}
|
||||
else
|
||||
{
|
||||
// dont know what the file is! :/
|
||||
//this.loadCount--;
|
||||
throw new Error(filename + " is an unsupported file type " + this);
|
||||
}
|
||||
|
||||
//this.assets[i].load();
|
||||
};
|
||||
}
|
||||
var scope = this;
|
||||
|
||||
this.loadCount = this.assetURLs.length;
|
||||
|
||||
for (var i=0; i < this.assetURLs.length; i++)
|
||||
{
|
||||
var fileName = this.assetURLs[i];
|
||||
var fileType = fileName.split(".").pop().toLowerCase();
|
||||
|
||||
var loaderClass = this.loadersByType[fileType];
|
||||
if(!loaderClass)
|
||||
throw new Error(fileType + " is an unsupported file type");
|
||||
|
||||
var loader = new loaderClass(fileName, this.crossorigin);
|
||||
|
||||
loader.addEventListener("loaded", function()
|
||||
{
|
||||
scope.onAssetLoaded();
|
||||
});
|
||||
loader.load();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Invoked after each file is loaded
|
||||
* @private
|
||||
*/
|
||||
PIXI.AssetLoader.prototype.onAssetLoaded = function()
|
||||
{
|
||||
this.loadCount--;
|
||||
this.dispatchEvent( { type: 'onProgress', content: this } );
|
||||
if(this.onProgress)this.onProgress();
|
||||
this.loadCount--;
|
||||
this.dispatchEvent({type: "onProgress", content: this});
|
||||
if(this.onProgress) this.onProgress();
|
||||
|
||||
if(this.loadCount == 0)
|
||||
{
|
||||
this.dispatchEvent( { type: 'onComplete', content: this } );
|
||||
if(this.onComplete)this.onComplete();
|
||||
this.dispatchEvent({type: "onComplete", content: this});
|
||||
if(this.onComplete) this.onComplete();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
</pre>
|
||||
|
|
275
docs/files/src_pixi_loaders_BitmapFontLoader.js.html
Normal file
275
docs/files/src_pixi_loaders_BitmapFontLoader.js.html
Normal file
|
@ -0,0 +1,275 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>src/pixi/loaders/BitmapFontLoader.js - Pixi.JS</title>
|
||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.8.0/build/cssgrids/cssgrids-min.css">
|
||||
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
||||
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
|
||||
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
|
||||
<script src="http://yui.yahooapis.com/combo?3.8.0/build/yui/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://www.goodboydigital.com/pixijs/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="../classes/AssetLoader.html">AssetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
||||
<li><a href="../classes/MovieClip.html">MovieClip</a></li>
|
||||
|
||||
<li><a href="../classes/Point.html">Point</a></li>
|
||||
|
||||
<li><a href="../classes/Rectangle.html">Rectangle</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite.html">Sprite</a></li>
|
||||
|
||||
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
||||
<li><a href="../classes/Texture.html">Texture</a></li>
|
||||
|
||||
<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>
|
||||
|
||||
<ul id="api-modules" class="apis modules">
|
||||
|
||||
<li><a href="../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/pixi/loaders/BitmapFontLoader.js</h1>
|
||||
|
||||
<div class="file">
|
||||
<pre class="code prettyprint linenums">
|
||||
/**
|
||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @class BitmapFontLoader
|
||||
* @extends EventTarget
|
||||
* @constructor
|
||||
* @param {String} url the url of the sprite sheet JSON file
|
||||
* @param {Boolean} crossorigin
|
||||
*/
|
||||
|
||||
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"
|
||||
*/
|
||||
PIXI.EventTarget.call(this);
|
||||
this.url = url;
|
||||
this.baseUrl = url.replace(/[^\/]*$/, "");
|
||||
this.texture = null;
|
||||
this.crossorigin = crossorigin;
|
||||
};
|
||||
|
||||
// constructor
|
||||
PIXI.BitmapFontLoader.constructor = PIXI.BitmapFontLoader;
|
||||
|
||||
/**
|
||||
* This will begin loading the JSON file
|
||||
*/
|
||||
PIXI.BitmapFontLoader.prototype.load = function()
|
||||
{
|
||||
this.ajaxRequest = new XMLHttpRequest();
|
||||
var scope = this;
|
||||
this.ajaxRequest.onreadystatechange = function()
|
||||
{
|
||||
scope.onXMLLoaded();
|
||||
};
|
||||
|
||||
this.ajaxRequest.open("GET", this.url, true);
|
||||
if (this.ajaxRequest.overrideMimeType) this.ajaxRequest.overrideMimeType("application/xml");
|
||||
this.ajaxRequest.send(null)
|
||||
};
|
||||
|
||||
/**
|
||||
* Invoked when XML file is loaded
|
||||
* @private
|
||||
*/
|
||||
PIXI.BitmapFontLoader.prototype.onXMLLoaded = function()
|
||||
{
|
||||
if (this.ajaxRequest.readyState == 4)
|
||||
{
|
||||
if (this.ajaxRequest.status == 200 || window.location.href.indexOf("http") == -1)
|
||||
{
|
||||
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);
|
||||
data.chars = {};
|
||||
|
||||
//parse letters
|
||||
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 textureRect = {
|
||||
x: parseInt(letters[i].attributes.getNamedItem("x").nodeValue, 10),
|
||||
y: parseInt(letters[i].attributes.getNamedItem("y").nodeValue, 10),
|
||||
width: parseInt(letters[i].attributes.getNamedItem("width").nodeValue, 10),
|
||||
height: parseInt(letters[i].attributes.getNamedItem("height").nodeValue, 10)
|
||||
};
|
||||
PIXI.TextureCache[charCode] = new PIXI.Texture(this.texture, textureRect);
|
||||
|
||||
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),
|
||||
kerning: {}
|
||||
};
|
||||
}
|
||||
|
||||
//parse kernings
|
||||
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);
|
||||
|
||||
data.chars[second].kerning[first] = amount;
|
||||
|
||||
}
|
||||
PIXI.BitmapText.fonts[data.font] = data;
|
||||
|
||||
var scope = this;
|
||||
image.addEventListener("loaded", function() {
|
||||
scope.onLoaded();
|
||||
});
|
||||
image.load();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Invoked when all files are loaded (xml/fnt and texture)
|
||||
* @private
|
||||
*/
|
||||
PIXI.BitmapFontLoader.prototype.onLoaded = function()
|
||||
{
|
||||
this.dispatchEvent({type: "loaded", content: this});
|
||||
};
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../assets/vendor/prettify/prettify-min.js"></script>
|
||||
<script>prettyPrint();</script>
|
||||
<script src="../assets/js/yui-prettify.js"></script>
|
||||
<script src="../assets/../api.js"></script>
|
||||
<script src="../assets/js/api-filter.js"></script>
|
||||
<script src="../assets/js/api-list.js"></script>
|
||||
<script src="../assets/js/api-search.js"></script>
|
||||
<script src="../assets/js/apidocs.js"></script>
|
||||
</body>
|
||||
</html>
|
200
docs/files/src_pixi_loaders_ImageLoader.js.html
Normal file
200
docs/files/src_pixi_loaders_ImageLoader.js.html
Normal file
|
@ -0,0 +1,200 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>src/pixi/loaders/ImageLoader.js - Pixi.JS</title>
|
||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.8.0/build/cssgrids/cssgrids-min.css">
|
||||
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
||||
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
|
||||
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
|
||||
<script src="http://yui.yahooapis.com/combo?3.8.0/build/yui/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://www.goodboydigital.com/pixijs/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="../classes/AssetLoader.html">AssetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
||||
<li><a href="../classes/MovieClip.html">MovieClip</a></li>
|
||||
|
||||
<li><a href="../classes/Point.html">Point</a></li>
|
||||
|
||||
<li><a href="../classes/Rectangle.html">Rectangle</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite.html">Sprite</a></li>
|
||||
|
||||
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
||||
<li><a href="../classes/Texture.html">Texture</a></li>
|
||||
|
||||
<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>
|
||||
|
||||
<ul id="api-modules" class="apis modules">
|
||||
|
||||
<li><a href="../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/pixi/loaders/ImageLoader.js</h1>
|
||||
|
||||
<div class="file">
|
||||
<pre class="code prettyprint linenums">
|
||||
/**
|
||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||
*/
|
||||
|
||||
/**
|
||||
* The image loader class is responsible for loading images file formats ("jpeg", "jpg", "png" and "gif")
|
||||
* 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 'loaded' event
|
||||
* @class ImageLoader
|
||||
* @extends EventTarget
|
||||
* @constructor
|
||||
* @param {String} url The url of the image
|
||||
* @param {Boolean} crossorigin
|
||||
*/
|
||||
PIXI.ImageLoader = function(url, crossorigin)
|
||||
{
|
||||
PIXI.EventTarget.call(this);
|
||||
this.texture = PIXI.Texture.fromImage(url, crossorigin);
|
||||
};
|
||||
|
||||
// constructor
|
||||
PIXI.ImageLoader.constructor = PIXI.ImageLoader;
|
||||
|
||||
/**
|
||||
* Loads image or takes it from cache
|
||||
*/
|
||||
PIXI.ImageLoader.prototype.load = function()
|
||||
{
|
||||
if(!this.texture.baseTexture.hasLoaded)
|
||||
{
|
||||
var scope = this;
|
||||
this.texture.baseTexture.addEventListener("loaded", function()
|
||||
{
|
||||
scope.onLoaded();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
this.onLoaded();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Invoked when image file is loaded or it is already cached and ready to use
|
||||
* @private
|
||||
*/
|
||||
PIXI.ImageLoader.prototype.onLoaded = function()
|
||||
{
|
||||
this.dispatchEvent({type: "loaded", content: this});
|
||||
};
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../assets/vendor/prettify/prettify-min.js"></script>
|
||||
<script>prettyPrint();</script>
|
||||
<script src="../assets/js/yui-prettify.js"></script>
|
||||
<script src="../assets/../api.js"></script>
|
||||
<script src="../assets/js/api-filter.js"></script>
|
||||
<script src="../assets/js/api-list.js"></script>
|
||||
<script src="../assets/js/api-search.js"></script>
|
||||
<script src="../assets/js/apidocs.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../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://www.codeandweb.com/texturepacker and publish the "JSON" 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') as it means sprite'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") as it means sprite"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 'loaded' event
|
||||
* When loaded this class will dispatch a "loaded" 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
|
||||
*/
|
||||
|
||||
PIXI.SpriteSheetLoader = function(url)
|
||||
PIXI.SpriteSheetLoader = function(url, crossorigin)
|
||||
{
|
||||
/*
|
||||
* i use texture packer to load the assets..
|
||||
* http://www.codeandweb.com/texturepacker
|
||||
* make sure to set the format as "JSON"
|
||||
*/
|
||||
PIXI.EventTarget.call( this );
|
||||
PIXI.EventTarget.call(this);
|
||||
this.url = url;
|
||||
this.baseUrl = url.replace(/[^\/]*$/, '');
|
||||
this.texture;
|
||||
this.baseUrl = url.replace(/[^\/]*$/, "");
|
||||
this.texture = null;
|
||||
this.frames = {};
|
||||
this.crossorigin = false;
|
||||
}
|
||||
this.crossorigin = crossorigin;
|
||||
};
|
||||
|
||||
// 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("GET", this.url, true)
|
||||
this.ajaxRequest.open("GET", this.url, true);
|
||||
if (this.ajaxRequest.overrideMimeType) this.ajaxRequest.overrideMimeType("application/json");
|
||||
this.ajaxRequest.send(null)
|
||||
}
|
||||
};
|
||||
|
||||
PIXI.SpriteSheetLoader.prototype.onLoaded = function()
|
||||
/**
|
||||
* Invoke when JSON file is loaded
|
||||
* @private
|
||||
*/
|
||||
PIXI.SpriteSheetLoader.prototype.onJSONLoaded = 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.href.indexOf("http") == -1)
|
||||
{
|
||||
var jsondata = eval("("+this.ajaxRequest.responseText+")");
|
||||
|
||||
var textureUrl = this.baseUrl + jsondata.meta.image;
|
||||
|
||||
this.texture = PIXI.Texture.fromImage(textureUrl, this.crossorigin).baseTexture;
|
||||
|
||||
// if(!this.texture)this.texture = new PIXI.Texture(textureUrl);
|
||||
|
||||
var frameData = jsondata.frames;
|
||||
for (var i in frameData)
|
||||
var jsonData = eval("(" + this.ajaxRequest.responseText + ")");
|
||||
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("loaded", 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()
|
|||
{
|
||||
//var realSize = frameData[i].spriteSourceSize;
|
||||
PIXI.TextureCache[i].realSize = frameData[i].spriteSourceSize;
|
||||
PIXI.TextureCache[i].trim.x = 0// (realSize.x / rect.w)
|
||||
PIXI.TextureCache[i].trim.x = 0;// (realSize.x / rect.w)
|
||||
// calculate the offset!
|
||||
}
|
||||
// this.frames[i] = ;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.texture.hasLoaded)
|
||||
{
|
||||
this.dispatchEvent( { type: 'loaded', content: this } );
|
||||
}
|
||||
else
|
||||
{
|
||||
var scope = this;
|
||||
// wait for the texture to load..
|
||||
this.texture.addEventListener('loaded', function(){
|
||||
|
||||
scope.dispatchEvent( { type: 'loaded', content: scope } );
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
image.load();
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Invoke when all files are loaded (json and texture)
|
||||
* @private
|
||||
*/
|
||||
PIXI.SpriteSheetLoader.prototype.onLoaded = function()
|
||||
{
|
||||
this.dispatchEvent({type: "loaded", content: this});
|
||||
};
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
306
docs/files/src_pixi_text_BitmapText.js.html
Normal file
306
docs/files/src_pixi_text_BitmapText.js.html
Normal file
|
@ -0,0 +1,306 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>src/pixi/text/BitmapText.js - Pixi.JS</title>
|
||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.8.0/build/cssgrids/cssgrids-min.css">
|
||||
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
||||
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
|
||||
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
|
||||
<script src="http://yui.yahooapis.com/combo?3.8.0/build/yui/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://www.goodboydigital.com/pixijs/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="../classes/AssetLoader.html">AssetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
||||
<li><a href="../classes/MovieClip.html">MovieClip</a></li>
|
||||
|
||||
<li><a href="../classes/Point.html">Point</a></li>
|
||||
|
||||
<li><a href="../classes/Rectangle.html">Rectangle</a></li>
|
||||
|
||||
<li><a href="../classes/Sprite.html">Sprite</a></li>
|
||||
|
||||
<li><a href="../classes/SpriteSheetLoader.html">SpriteSheetLoader</a></li>
|
||||
|
||||
<li><a href="../classes/Stage.html">Stage</a></li>
|
||||
|
||||
<li><a href="../classes/Text.html">Text</a></li>
|
||||
|
||||
<li><a href="../classes/Texture.html">Texture</a></li>
|
||||
|
||||
<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>
|
||||
|
||||
<ul id="api-modules" class="apis modules">
|
||||
|
||||
<li><a href="../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/pixi/text/BitmapText.js</h1>
|
||||
|
||||
<div class="file">
|
||||
<pre class="code prettyprint linenums">
|
||||
/**
|
||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||
*/
|
||||
|
||||
/**
|
||||
* A Text Object will create a line(s) of text using bitmap font
|
||||
* You can generate the fnt files using
|
||||
* http://www.angelcode.com/products/bmfont/ for windows of
|
||||
* http://www.bmglyph.com/ 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 "20pt Arial" The size and bitmap font id (must have loaded previously)
|
||||
* @param {String} [style.align="left"] An alignment of the multiline text ("left", "center" or "right")
|
||||
*/
|
||||
//* @param {Object} [style.font="bold 20pt Arial"] 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
|
||||
|
||||
};
|
||||
|
||||
// constructor
|
||||
PIXI.BitmapText.constructor = PIXI.BitmapText;
|
||||
PIXI.BitmapText.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
|
||||
|
||||
/**
|
||||
* Set the copy for the text object
|
||||
* @methos setText
|
||||
* @param {String} text The copy that you would like the text to display
|
||||
*/
|
||||
PIXI.BitmapText.prototype.setText = function(text)
|
||||
{
|
||||
this.text = text || " ";
|
||||
this.dirty = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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="left"] An alignment of the multiline text ("left", "center" or "right")
|
||||
*/
|
||||
PIXI.BitmapText.prototype.setStyle = function(style)
|
||||
{
|
||||
style = style || {};
|
||||
style.align = style.align || "left";
|
||||
this.style = style;
|
||||
|
||||
var font = style.font.split(" ");
|
||||
this.fontName = font[font.length - 1];
|
||||
this.fontSize = font.length >= 2 ? parseInt(font[font.length - 2], 10) : PIXI.BitmapText.fonts[this.fontName].size;
|
||||
|
||||
this.dirty = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders text
|
||||
* @private
|
||||
*/
|
||||
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 / data.size;
|
||||
for(var i = 0; i < this.text.length; i++)
|
||||
{
|
||||
var charCode = this.text.charCodeAt(i);
|
||||
if(charCode == "\n".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 && 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 <= line; i++)
|
||||
{
|
||||
var alignOffset = 0;
|
||||
if(this.style.align == "right")
|
||||
{
|
||||
alignOffset = maxLineWidth - lineWidths[i];
|
||||
}
|
||||
else if(this.style.align == "center")
|
||||
{
|
||||
alignOffset = (maxLineWidth - lineWidths[i]) / 2;
|
||||
}
|
||||
lineAlignOffsets.push(alignOffset);
|
||||
}
|
||||
|
||||
for(i = 0; i < 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;
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
PIXI.BitmapText.prototype.updateTransform = function()
|
||||
{
|
||||
if(this.dirty)
|
||||
{
|
||||
while(this.children.length > 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="../assets/vendor/prettify/prettify-min.js"></script>
|
||||
<script>prettyPrint();</script>
|
||||
<script src="../assets/js/yui-prettify.js"></script>
|
||||
<script src="../assets/../api.js"></script>
|
||||
<script src="../assets/js/api-filter.js"></script>
|
||||
<script src="../assets/js/api-list.js"></script>
|
||||
<script src="../assets/js/api-search.js"></script>
|
||||
<script src="../assets/js/apidocs.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>src/pixi/Text.js - Pixi.JS</title>
|
||||
<title>src/pixi/text/Text.js - Pixi.JS</title>
|
||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.8.0/build/cssgrids/cssgrids-min.css">
|
||||
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
||||
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
|
||||
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../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/pixi/Text.js</h1>
|
||||
<h1 class="file-heading">File: src/pixi/text/Text.js</h1>
|
||||
|
||||
<div class="file">
|
||||
<pre class="code prettyprint linenums">
|
||||
|
@ -127,110 +133,156 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* 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 "\n"
|
||||
* @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 "bold 20px Arial"
|
||||
* @param fillStyle {Object} a canvas fillstyle that will be used on the text eg "red", "#00FF00" can also be null
|
||||
* @param strokeStyle {String} a canvas fillstyle that will be used on the text stroke eg "blue", "#FCFF00" 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 "bold 20pt Arial" The style and size of the font
|
||||
* @param {Object} [style.fill="black"] A canvas fillstyle that will be used on the text eg "red", "#00FF00"
|
||||
* @param {String} [style.align="left"] An alignment of the multiline text ("left", "center" or "right")
|
||||
* @param {String} [style.stroke] A canvas fillstyle that will be used on the text stroke eg "blue", "#FCFF00"
|
||||
* @param {Number} [style.strokeThickness=0] A number that represents the thickness of the stroke. Default is 0 (no stroke)
|
||||
*/
|
||||
PIXI.Text = function(text, fontStyle, fillStyle, strokeStyle, strokeThickness)
|
||||
PIXI.Text = function(text, style)
|
||||
{
|
||||
this.canvas = document.createElement("canvas");
|
||||
|
||||
this.context = this.canvas.getContext("2d");
|
||||
//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));
|
||||
|
||||
// need to store a canvas that can
|
||||
}
|
||||
this.canvas = document.createElement("canvas");
|
||||
this.context = this.canvas.getContext("2d");
|
||||
PIXI.Sprite.call(this, PIXI.Texture.fromCanvas(this.canvas));
|
||||
|
||||
this.setText(text);
|
||||
this.setStyle(style);
|
||||
this.updateText();
|
||||
this.dirty = false;
|
||||
};
|
||||
|
||||
// constructor
|
||||
PIXI.Text.constructor = PIXI.Text;
|
||||
PIXI.Text.prototype = Object.create( PIXI.Sprite.prototype );
|
||||
|
||||
/**
|
||||
* Set the copy for the text object
|
||||
* @methos setText
|
||||
* @param text {String} The copy that you would like the text to display
|
||||
*/
|
||||
PIXI.Text.prototype.setText = function(text)
|
||||
{
|
||||
this.text = text || " ";
|
||||
this.dirty = true;
|
||||
}
|
||||
PIXI.Text.prototype = Object.create(PIXI.Sprite.prototype);
|
||||
|
||||
/**
|
||||
* Set the style of the text
|
||||
* @method setStyle
|
||||
* @constructor
|
||||
* @param fontStyle {String} the style and size of the font eg "bold 20px Arial"
|
||||
* @param fillStyle {Object} a canvas fillstyle that will be used on the text eg "red", "#00FF00" can also be null
|
||||
* @param strokeStyle {String} a canvas fillstyle that will be used on the text stroke eg "blue", "#FCFF00" 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="bold 20pt Arial"] The style and size of the font
|
||||
* @param {Object} [style.fill="black"] A canvas fillstyle that will be used on the text eg "red", "#00FF00"
|
||||
* @param {String} [style.align="left"] An alignment of the multiline text ("left", "center" or "right")
|
||||
* @param {String} [style.stroke] A canvas fillstyle that will be used on the text stroke eg "blue", "#FCFF00"
|
||||
* @param {Number} [style.strokeThickness=0] A number that represents the thickness of the stroke. Default is 0 (no stroke)
|
||||
*/
|
||||
PIXI.Text.prototype.setStyle = function(fontStyle, fillStyle, strokeStyle, strokeThickness)
|
||||
PIXI.Text.prototype.setStyle = function(style)
|
||||
{
|
||||
this.fontStyle = fontStyle || "bold 20pt Arial";
|
||||
this.fillStyle = fillStyle;
|
||||
this.strokeStyle = strokeStyle;
|
||||
this.strokeThickness = strokeThickness || 0;
|
||||
|
||||
this.dirty = true;
|
||||
}
|
||||
style = style || {};
|
||||
style.font = style.font || "bold 20pt Arial";
|
||||
style.fill = style.fill || "black";
|
||||
style.align = style.align || "left";
|
||||
style.strokeThickness = style.strokeThickness || 0;
|
||||
this.style = style;
|
||||
this.dirty = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the copy for the text object. To split a line you can use "\n"
|
||||
* @methos setText
|
||||
* @param {String} text The copy that you would like the text to display
|
||||
*/
|
||||
PIXI.Sprite.prototype.setText = function(text)
|
||||
{
|
||||
this.text = text || " ";
|
||||
this.dirty = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders text
|
||||
* @private
|
||||
*/
|
||||
PIXI.Text.prototype.updateText = function()
|
||||
{
|
||||
// console.log(this.text);
|
||||
this.context.font = this.fontStyle;
|
||||
|
||||
this.canvas.width = this.context.measureText(this.text).width + this.strokeThickness//textDimensions.width;
|
||||
this.canvas.height = this.determineFontHeight("font: " + this.fontStyle + ";")+ this.strokeThickness;// textDimensions.height;
|
||||
this.context.font = this.style.font;
|
||||
|
||||
this.context.fillStyle = this.fillStyle;
|
||||
this.context.font = this.fontStyle;
|
||||
//split text into lines
|
||||
var lines = this.text.split("\n");
|
||||
|
||||
//calculate text width
|
||||
var lineWidths = [];
|
||||
var maxLineWidth = 0;
|
||||
for (var i = 0; i < 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;
|
||||
//calculate text height
|
||||
var lineHeight = this.determineFontHeight("font: " + this.style.font + ";") + this.style.strokeThickness;
|
||||
this.canvas.height = lineHeight * lines.length;
|
||||
|
||||
this.context.textBaseline="top";
|
||||
|
||||
if(this.strokeStyle && this.strokeThickness)this.context.strokeText(this.text, this.strokeThickness/2, this.strokeThickness/2);
|
||||
if(this.fillStyle)this.context.fillText(this.text, this.strokeThickness/2, this.strokeThickness/2);
|
||||
//set canvas text styles
|
||||
this.context.fillStyle = this.style.fill;
|
||||
this.context.font = this.style.font;
|
||||
|
||||
|
||||
// console.log("//")
|
||||
}
|
||||
this.context.strokeStyle = this.style.stroke;
|
||||
this.context.lineWidth = this.style.strokeThickness;
|
||||
|
||||
this.context.textBaseline = "top";
|
||||
|
||||
//draw lines line by line
|
||||
for (i = 0; i < lines.length; i++)
|
||||
{
|
||||
var linePosition = new PIXI.Point(this.style.strokeThickness / 2, this.style.strokeThickness / 2 + i * lineHeight);
|
||||
|
||||
if(this.style.align == "right")
|
||||
{
|
||||
linePosition.x += maxLineWidth - lineWidths[i];
|
||||
}
|
||||
else if(this.style.align == "center")
|
||||
{
|
||||
linePosition.x += (maxLineWidth - lineWidths[i]) / 2;
|
||||
}
|
||||
|
||||
if(this.style.stroke && 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();
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates texture size based on canvas size
|
||||
* @private
|
||||
*/
|
||||
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);
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
PIXI.Text.prototype.updateTransform = function()
|
||||
{
|
||||
if(this.dirty)
|
||||
{
|
||||
this.updateText();
|
||||
|
||||
// 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);
|
||||
};
|
||||
|
||||
/*
|
||||
* http://stackoverflow.com/users/34441/ellisbben
|
||||
|
@ -238,9 +290,9 @@ PIXI.Text.prototype.updateTransform = function()
|
|||
*/
|
||||
PIXI.Text.prototype.determineFontHeight = function(fontStyle)
|
||||
{
|
||||
// build a little refference dictionary so if the font style has been used return a
|
||||
// build a little reference dictionary so if the font style has been used return a
|
||||
// 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 = {};
|
||||
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
|
@ -45,12 +45,18 @@
|
|||
|
||||
<li><a href="../classes/BaseTexture.html">BaseTexture</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapFontLoader.html">BitmapFontLoader</a></li>
|
||||
|
||||
<li><a href="../classes/BitmapText.html">BitmapText</a></li>
|
||||
|
||||
<li><a href="../classes/CanvasRenderer.html">CanvasRenderer</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObject.html">DisplayObject</a></li>
|
||||
|
||||
<li><a href="../classes/DisplayObjectContainer.html">DisplayObjectContainer</a></li>
|
||||
|
||||
<li><a href="../classes/ImageLoader.html">ImageLoader</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionData.html">InteractionData</a></li>
|
||||
|
||||
<li><a href="../classes/InteractionManager.html">InteractionManager</a></li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue