UNPKG

tiny-ecs

Version:

A mean lean Entity-Component-System library.

1,573 lines (450 loc) 19.7 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: EntityManager</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: EntityManager</h1> <section> <header> <h2> EntityManager </h2> </header> <article> <div class="container-overview"> <dt> <h4 class="name" id="EntityManager"><span class="type-signature"></span>new EntityManager<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Manage, create, and destroy entities. Can use methods to mutate entities (tags, components) directly or via the facade on the Entity. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line12">line 12</a> </li></ul></dd> </dl> </dd> </div> <h3 class="subsection-title">Members</h3> <dl> <dt> <h4 class="name" id="_entities"><span class="type-signature"></span>_entities<span class="type-signature"> :Array.&lt;<a href="Entity.html">Entity</a>></span></h4> </dt> <dd> <h5>Type:</h5> <ul> <li> <span class="param-type">Array.&lt;<a href="Entity.html">Entity</a>></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line19">line 19</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="_groups"><span class="type-signature"></span>_groups<span class="type-signature"> :Array.&lt;<a href="Group.html">Group</a>></span></h4> </dt> <dd> <h5>Type:</h5> <ul> <li> <span class="param-type">Array.&lt;<a href="Group.html">Group</a>></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line24">line 24</a> </li></ul></dd> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <dt> <h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4> </dt> <dd> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line253">line 253</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Total number of entities. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> </dd> <dt> <h4 class="name" id="createEntity"><span class="type-signature"></span>createEntity<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Entity.html">Entity</a>}</span></h4> </dt> <dd> <div class="description"> Get a new entity. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line46">line 46</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Entity.html">Entity</a></span> </dd> </dl> </dd> <dt> <h4 class="name" id="entityAddComponent"><span class="type-signature"></span>entityAddComponent<span class="signature">(entity, Component)</span><span class="type-signature"></span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type"><a href="Entity.html">Entity</a></span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>Component</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line159">line 159</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="entityAddTag"><span class="type-signature"></span>entityAddTag<span class="signature">(entity, tag)</span><span class="type-signature"></span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type"><a href="Entity.html">Entity</a></span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>tag</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line125">line 125</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="entityRemoveComponent"><span class="type-signature"></span>entityRemoveComponent<span class="signature">(entity, Component)</span><span class="type-signature"></span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type"><a href="Entity.html">Entity</a></span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>Component</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line194">line 194</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="entityRemoveTag"><span class="type-signature"></span>entityRemoveTag<span class="signature">(entity, tag)</span><span class="type-signature"></span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type"><a href="Entity.html">Entity</a></span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>tag</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line143">line 143</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="poolStats"><span class="type-signature"></span>poolStats<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> </dt> <dd> <div class="description"> Get information about the object pools of the entities and the various components. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line286">line 286</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <dt> <h4 class="name" id="queryComponents"><span class="type-signature"></span>queryComponents<span class="signature">(Components)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="Entity.html">Entity</a>>}</span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>Components</code></td> <td class="type"> <span class="param-type">Array.&lt;function()></span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line225">line 225</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="Entity.html">Entity</a>></span> </dd> </dl> </dd> <dt> <h4 class="name" id="queryTag"><span class="type-signature"></span>queryTag<span class="signature">(tag)</span><span class="type-signature"> &rarr; {Array.&lt;<a href="Entity.html">Entity</a>>}</span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tag</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line240">line 240</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="Entity.html">Entity</a>></span> </dd> </dl> </dd> <dt> <h4 class="name" id="removeEntitiesByTag"><span class="type-signature"></span>removeEntitiesByTag<span class="signature">(tag)</span><span class="type-signature"></span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>tag</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line58">line 58</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="removeEntity"><span class="type-signature"></span>removeEntity<span class="signature">(entity)</span><span class="type-signature"></span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type"><a href="Entity.html">Entity</a></span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="EntityManager.js.html">EntityManager.js</a>, <a href="EntityManager.js.html#line73">line 73</a> </li></ul></dd> </dl> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Entity.html">Entity</a></li><li><a href="EntityManager.html">EntityManager</a></li><li><a href="Group.html">Group</a></li><li><a href="ObjectPool.html">ObjectPool</a></li><li><a href="QuadTree.html">QuadTree</a></li><li><a href="Spatial.html">Spatial</a></li><li><a href="Vec2.html">Vec2</a></li></ul> </nav> <br clear="both"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha3</a> on Wed Jan 29 2014 01:06:20 GMT-0600 (CST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>