Documentation first draft
This commit is contained in:
parent
5786d33f94
commit
0558060de2
65 changed files with 2106 additions and 423 deletions
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>pixi/loaders/AssetLoader.js - The Foo API</title>
|
||||
<title>pixi/loaders/AssetLoader.js - Pixi.js API</title>
|
||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.8.0pr2/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">
|
||||
|
@ -15,11 +15,11 @@
|
|||
<div id="hd" class="yui3-g header">
|
||||
<div class="yui3-u-3-4">
|
||||
|
||||
<h1><img src="../assets/css/logo.png" title="The Foo API"></h1>
|
||||
<h1><img src="../logo_small.png" title="Pixi.js API"></h1>
|
||||
|
||||
</div>
|
||||
<div class="yui3-u-1-4 version">
|
||||
<em>API Docs for: 1.2.1</em>
|
||||
<em>API Docs for: 0.9</em>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bd" class="yui3-g">
|
||||
|
@ -115,11 +115,11 @@
|
|||
<div class="file">
|
||||
<pre class="code prettyprint linenums">
|
||||
/**
|
||||
* @author Mat Groves http://matgroves.com/
|
||||
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.fromFrameId(), PIXI.Texture.fromImage() and PIXI.Sprite.fromImage(), PIXI.Sprite.fromFromeId()
|
||||
* 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
|
||||
* @class AssetLoader
|
||||
|
@ -131,7 +131,6 @@ PIXI.AssetLoader = function(assetURLs)
|
|||
{
|
||||
PIXI.EventTarget.call( this );
|
||||
|
||||
|
||||
/**
|
||||
* The array of asset URLs that are going to be loaded
|
||||
* @property assetURLs
|
||||
|
@ -142,6 +141,16 @@ PIXI.AssetLoader = function(assetURLs)
|
|||
this.assets = [];
|
||||
}
|
||||
|
||||
/**
|
||||
Fired when an item has loaded
|
||||
@event onProgress
|
||||
**/
|
||||
|
||||
/**
|
||||
Fired when all the assets have loaded
|
||||
@event onComplete
|
||||
**/
|
||||
|
||||
// constructor
|
||||
PIXI.AssetLoader.constructor = PIXI.AssetLoader;
|
||||
|
||||
|
@ -160,7 +169,7 @@ PIXI.AssetLoader.prototype.load = function()
|
|||
var filename = this.assetURLs[i];
|
||||
var fileType = filename.split('.').pop().toLowerCase();
|
||||
// what are we loading?
|
||||
var type;
|
||||
var type = null;
|
||||
|
||||
for (var j=0; j < imageTypes.length; j++)
|
||||
{
|
||||
|
@ -171,7 +180,7 @@ PIXI.AssetLoader.prototype.load = function()
|
|||
}
|
||||
}
|
||||
|
||||
if(!type)
|
||||
if(type != "img")
|
||||
{
|
||||
for (var j=0; j < spriteSheetTypes.length; j++)
|
||||
{
|
||||
|
@ -185,6 +194,7 @@ PIXI.AssetLoader.prototype.load = function()
|
|||
|
||||
if(type == "img")
|
||||
{
|
||||
|
||||
var texture = PIXI.Texture.fromImage(filename);
|
||||
if(!texture.hasLoaded)
|
||||
{
|
||||
|
@ -232,11 +242,13 @@ PIXI.AssetLoader.prototype.load = function()
|
|||
PIXI.AssetLoader.prototype.onAssetLoaded = function()
|
||||
{
|
||||
this.loadCount--;
|
||||
this.dispatchEvent( { type: 'progress', content: this } );
|
||||
this.dispatchEvent( { type: 'onProgress', content: this } );
|
||||
if(this.onProgress)this.onProgress();
|
||||
|
||||
if(this.loadCount == 0)
|
||||
{
|
||||
this.dispatchEvent( { type: 'loaded', content: this } );
|
||||
this.dispatchEvent( { type: 'onComplete', content: this } );
|
||||
if(this.onComplete)this.onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue