Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix some documentation TODOs

  • Loading branch information...
commit 9817dea48684c8416084782bca45f375da45e715 1 parent bd6aad6
Ian Beveridge authored
Showing with 256 additions and 114 deletions.
  1. +2 −2 dist/doc/8way.Face8Way.html
  2. +2 −1  dist/doc/animate.Animate.html
  3. +4 −4 dist/doc/apply-velocity.ApplyVelocity.html
  4. +2 −1  dist/doc/composite.Composite.html
  5. +6 −4 dist/doc/flock.Flock.html
  6. +1 −1  dist/doc/frame-phaser.FramePhaser.html
  7. +2 −2 dist/doc/ground-sprites.GroundSprites.html
  8. +3 −3 dist/doc/module-snaps.Snaps.html
  9. +49 −0 dist/doc/push-cam.PushCam.html
  10. +1 −1  dist/doc/sprite.Sprite.html
  11. +94 −0 dist/doc/staggered-isometric.StaggeredIsometric.html
  12. +2 −1  dist/doc/track.Track.html
  13. +44 −47 dist/snaps.js
  14. +12 −0 src/map/staggered-isometric.js
  15. +1 −2  src/plugins/ai/phasers/frame-phaser.js
  16. +5 −0 src/plugins/camera/push-cam.js
  17. +2 −4 src/plugins/layer/ground-sprites.js
  18. +2 −3 src/plugins/sprite/8way.js
  19. +3 −4 src/plugins/sprite/animate.js
  20. +4 −5 src/plugins/sprite/apply-velocity.js
  21. +0 −2  src/plugins/sprite/bounce.js
  22. +7 −8 src/plugins/sprite/flock.js
  23. +2 −2 src/plugins/sprite/track.js
  24. +3 −8 src/snaps.js
  25. +2 −3 src/sprites/composite.js
  26. +1 −3 src/sprites/sprite.js
  27. +0 −3  src/util/stats.js
4 dist/doc/8way.Face8Way.html
View
@@ -52,8 +52,8 @@ <h4 class="name" id="Face8Way"><span class="type-signature"></span>new Face8Way<
A sprite updater that sets the sprite's state extension to a compass direction
('n', 'ne', 'e', 'se'...)
based on the direction values in the sprite. Direction updates automatically when the sprite
-moves but can be overridden with setDirection. The compass direction takes into account the
-isometric projection.
+moves but can be overridden with <a href="sprite.Sprite.html#setDirection"><code>setDirection</code></a>.
+The compass direction takes into account the isometric projection.
<p>
Note that this should not be constructed directly, but rather via the updates or commit
property in your spawnSprite data, e.g. <code>updates:[{name:'8way'}]</code>.
3  dist/doc/animate.Animate.html
View
@@ -51,7 +51,8 @@ <h4 class="name" id="Animate"><span class="type-signature"></span>new Animate<sp
<div class="description">
A sprite updater that animates one or more properties on the sprite. Properties are modified
directly, so handle with care. Be aware that property updates on things such as position will bypass
-the automatic direction setting you'd get if you had called Sprite#move.
+the automatic direction setting you'd get if you had called <a href="sprite.Sprite.html#move"><code>move</code></a>
+on your sprite.
<p>
Note that this should not be constructed directly, but rather via the updates or commit
property in your spawnSprite data, e.g. <code>updates:[{name:'animate'}]</code>.
8 dist/doc/apply-velocity.ApplyVelocity.html
View
@@ -50,10 +50,10 @@ <h4 class="name" id="ApplyVelocity"><span class="type-signature"></span>new Appl
<div class="description">
A sprite updater that simply takes the velocityx and velocityy properties on the sprite and
-applies it to the position via move. This is useful in situations where another plugin is
-updating valocities but those velocities depend upon the momentary positions of sprites. E.g.
-you have a flock update which updates velocity. In that case you would have this plugin as
-a commit to apply the velocity calculated by flock.
+applies it to the position via <a href="sprite.Sprite.html#move"><code>move</code></a>. This is useful
+in situations where another plugin is updating valocities but those velocities depend upon
+the momentary positions of sprites. E.g. you have a flock update which updates velocity.
+In that case you would have this plugin as a commit to apply the velocity calculated by flock.
<p>
Snaps runs all sprite updates first, then runs all sprite commits.
<p>
3  dist/doc/composite.Composite.html
View
@@ -526,7 +526,8 @@ <h4 class="name" id="addSprite"><span class="type-signature"></span>addSprite<sp
- <td class="description last">See snaps.spawnSprite for a full list of options.</td>
+ <td class="description last">For a list of parameters
+see the opts parameter on the <a href="sprite.Sprite.html"><code>Sprite class constructor</code></a>.</td>
</tr>
10 dist/doc/flock.Flock.html
View
@@ -56,8 +56,9 @@ <h4 class="name" id="Flock"><span class="type-signature"></span>new Flock<span c
accuracy with phased updates.
<p>
Note that this plugin will not move the sprites, it only calculates velocity. To move the
-sprites you should add the apply-velocity plugin after this one as a commit update. In this way
-the sprites accurately update based on their positions at the same moment in time.
+sprites you should add the <a href="apply-velocity.ApplyVelocity.html"><code>apply-velocity</code></a>
+plugin after this one as a commit update. In this way the sprites accurately update based on
+their positions at the same moment in time.
<p>
Note that this should not be constructed directly, but rather via the updates or commit
property in your spawnSprite data, e.g. <code>update:[{name:'flock'}]</code>.
@@ -65,8 +66,9 @@ <h4 class="name" id="Flock"><span class="type-signature"></span>new Flock<span c
Alongside the name, you can pass the following options
<dl>
<dt>tracker</dt><dd>Pass a tracker object here. See ProximityTracker. Sprites that flock
- with the same tracker will belong to the same flock. You should also apply the track
- plugin to track the sprite in the proximity tracker.</dd>
+ with the same tracker will belong to the same flock. You should also apply the
+ <a href="track.Track.html"><code>track plugin</code></a> to track the sprite in the
+ <a href="proximity-tracker.ProximityTracker.html"><code>proximity tracker</code></a>.</dd>
<dt>flock_speed</dt><dd>In pixels/second. This is the maximum speed for any flockmate.</dd>
<dt>flock_neighborhood</dt><dd>The radius that defines the influential
flockmates, in pixels. Larger is generally better but slower, dependant on the tracker.</dd>
2  dist/doc/frame-phaser.FramePhaser.html
View
@@ -272,7 +272,7 @@ <h4 class="name" id="addSprite"><span class="type-signature"></span>addSprite<sp
- <td class="description last">The sprite to add</td>
+ <td class="description last">The <a href="sprite.Sprite.html"><code>sprite</code></a> to add</td>
</tr>
4 dist/doc/ground-sprites.GroundSprites.html
View
@@ -466,8 +466,8 @@ <h4 class="name" id="spawnSprite"><span class="type-signature"></span>spawnSprit
- <td class="description last">Optional parameter object. See sn.spawnSprite for sprite
-spawn option values.</td>
+ <td class="description last">Optional parameter object. For a list of parameters
+see the opts parameter on the <a href="sprite.Sprite.html"><code>Sprite class constructor</code></a>.</td>
</tr>
6 dist/doc/module-snaps.Snaps.html
View
@@ -953,7 +953,7 @@ <h4 class="name" id="bindKeys"><span class="type-signature"></span>bindKeys<span
<div class="description">
Call this to bind keys to actions which you can test later on with
-the <code>actioning</code> method.
+the <a href="module-snaps.Snaps.html#actioning"><code>actioning</code></a> method.
<pre>
sn.bindKeys([
{key:'left', action:'left'},
@@ -1370,7 +1370,7 @@ <h4 class="name" id="createCamera"><span class="type-signature"></span>createCam
<div class="description">
Create a new camera for use in game. Creating a camera does not
-activate it. You need to then call <code>switchToCamera</code>.
+activate it. You need to then call <a href="module-snaps.Snaps.html#switchToCamera"><code>switchToCamera</code></a>.
</div>
@@ -2649,7 +2649,7 @@ <h4 class="name" id="getTile"><span class="type-signature"></span>getTile<span c
<div class="param-desc">
- A tile, or null if the input was out of range.
+ A <a href="tile.Tile.html"><code>Tile</code></a>, or null if the input was out of range.
</div>
49 dist/doc/push-cam.PushCam.html
View
@@ -175,6 +175,55 @@ <h4 class="name" id="PushCam"><span class="type-signature"></span>new PushCam<sp
+ <h3 class="subsection-title">Members</h3>
+
+ <dl>
+
+<dt>
+ <h4 class="name" id="follow"><span class="type-signature"></span>follow<span class="type-signature"> :Object</span></h4>
+
+
+</dt>
+<dd>
+
+ <div class="description">
+ The sprite that this camera is following.
+ </div>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</dl>
+
+
+
+</dd>
+
+ </dl>
+
2  dist/doc/sprite.Sprite.html
View
@@ -50,7 +50,7 @@ <h4 class="name" id="Sprite"><span class="type-signature"></span>new Sprite<span
<div class="description">
Creates a new sprite object. Note that you shouldn't normally call this constructor directly.
-Call the factory method <code>sn.spawnSprite</code> instead.
+Call the factory method <a href="module-snaps.Snaps.html#spawnSprite"><code>spawnSprite</code></a> instead.
<p>
Some parameters or options accept functions. An example of how to pass a random range into any
Function/Number parameters would be to bind the rnd function in util/rnd. E.g.
94 dist/doc/staggered-isometric.StaggeredIsometric.html
View
@@ -299,6 +299,100 @@ <h4 class="name" id="StaggeredIsometric"><span class="type-signature"></span>new
+ <h3 class="subsection-title">Members</h3>
+
+ <dl>
+
+<dt>
+ <h4 class="name" id="clientHeight"><span class="type-signature"></span>clientHeight<span class="type-signature"> :Number</span></h4>
+
+
+</dt>
+<dd>
+
+ <div class="description">
+ The canvas height
+ </div>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</dl>
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="clientWidth"><span class="type-signature"></span>clientWidth<span class="type-signature"> :Number</span></h4>
+
+
+</dt>
+<dd>
+
+ <div class="description">
+ The canvas width
+ </div>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</dl>
+
+
+
+</dd>
+
+ </dl>
+
<h3 class="subsection-title">Methods</h3>
3  dist/doc/track.Track.html
View
@@ -82,7 +82,8 @@ <h4 class="name" id="Track"><span class="type-signature"></span>new Track<span c
</pre>
</dd>
</dl>
-The register and deregister functions are useful when combined with the ProximityTracker
+The register and deregister functions are useful when combined with the
+<a href="proximity-tracker.ProximityTracker.html"><code>ProximityTracker</code></a>
to track large numbers of autonomous sprites. See
<a href="proximity-tracker.ProximityTracker.html"><code>ProximityTracker.track</code></a> for
an example of how to set that up.
91 dist/snaps.js
View
@@ -171,7 +171,7 @@ define('sprites/sprite',['util/js'], function(js) {
var clone = js.clone;
/** Creates a new sprite object. Note that you shouldn't normally call this constructor directly.
- * Call the factory method <code>sn.spawnSprite</code> instead.
+ * Call the factory method {@link module:snaps.Snaps#spawnSprite|spawnSprite} instead.
* <p>
* Some parameters or options accept functions. An example of how to pass a random range into any
* Function/Number parameters would be to bind the rnd function in util/rnd. E.g.
@@ -223,8 +223,6 @@ define('sprites/sprite',['util/js'], function(js) {
*/
function Sprite(sn, def, x, y, h, opts) {
- /* TODO: Docs - link to spawnSprite */
-
opts = opts||{};
this.def = def;
@@ -804,12 +802,11 @@ define('sprites/composite',['util/js', 'sprites/sprite'], function(js, Sprite) {
* no parameters and return a number.
* @param {Number} h The height off the ground. If a function, it should take
* no parameters and return a number.
- * @param {Object} [opts] See snaps.spawnSprite for a full list of options.
+ * @param {Object} [opts] For a list of parameters
+ * see the opts parameter on the {@link module:sprites/sprite.Sprite|Sprite class constructor}.
*/
Composite.prototype.addSprite = function(defName, stateName, x, y, h, opts) {
- /* TODO: Docs - Link to spawnSprite in opts param */
-
if (opts===undefined) {
opts = {};
}
@@ -1598,9 +1595,6 @@ define('util/stats',[],function() {
*/
function Stats() {
- /* TODO: Docs - Go through every constructor looking for this properties that can be exposed
- * through documentation. */
-
this.samples = {};
this.totals = {};
@@ -1832,7 +1826,19 @@ define('map/staggered-isometric',['map/tile', 'util/bitmap', 'util/debug', 'util
this.hitTests = hitTests;
this.maxXOverdraw = 0;
this.maxYOverdraw = 0;
+
+ /**
+ * The canvas width
+ * @type {Number}
+ * @member module:map/staggered-isometric.StaggeredIsometric#clientWidth
+ */
this.clientWidth = clientWidth;
+
+ /**
+ * The canvas height
+ * @type {Number}
+ * @member module:map/staggered-isometric.StaggeredIsometric#clientHeight
+ */
this.clientHeight = clientHeight;
this.hideBuildings = false;
@@ -2454,8 +2460,6 @@ define('plugins/sprite/bounce',[],function() {
}
- /* TODO: All docs. Search for {Bool} and make it Boolean */
-
/** Called with the sprite as the function context.
* @method module:plugins/sprite/bounce.Bounce#update
* @private
@@ -2582,14 +2586,15 @@ define('plugins/sprite/animate',[],function() {
/**
* A sprite updater that animates one or more properties on the sprite. Properties are modified
* directly, so handle with care. Be aware that property updates on things such as position will bypass
- * the automatic direction setting you'd get if you had called Sprite#move.
+ * the automatic direction setting you'd get if you had called {@link module:sprites/sprite.Sprite#move|move}
+ * on your sprite.
* <p>
* Note that this should not be constructed directly, but rather via the updates or commit
* property in your spawnSprite data, e.g. <code>updates:[{name:'animate'}]</code>.
* <p>
* Alongside the name, you can pass the following options
* <dl>
- * <dt>tween</dt><dd>The name of the tween function. See the tweens module for a full list of options.</dd>
+ * <dt>tween</dt><dd>The name of the tween function. See the {@link animate/tween|tweens} module for a full list of options.</dd>
* <dt>props</dt><dd>An object describing the properties to adjust. Values are relative adjustments, not
* absolute values. E.g.
* <pre>
@@ -2607,8 +2612,6 @@ define('plugins/sprite/animate',[],function() {
* @constructor module:plugins/sprite/animate.Animate
*/
function Animate() {
- /* TODO: Docs - link to tweens functions. */
- /* TODO: Docs - link to sprite move function. */
}
@@ -2694,8 +2697,8 @@ define('plugins/sprite/8way',[],function() {
* A sprite updater that sets the sprite's state extension to a compass direction
* ('n', 'ne', 'e', 'se'...)
* based on the direction values in the sprite. Direction updates automatically when the sprite
- * moves but can be overridden with setDirection. The compass direction takes into account the
- * isometric projection.
+ * moves but can be overridden with {@link module:sprites/sprite.Sprite#setDirection|setDirection}.
+ * The compass direction takes into account the isometric projection.
* <p>
* Note that this should not be constructed directly, but rather via the updates or commit
* property in your spawnSprite data, e.g. <code>updates:[{name:'8way'}]</code>.
@@ -2704,7 +2707,6 @@ define('plugins/sprite/8way',[],function() {
* @constructor module:plugins/sprite/8way.Face8Way
*/
function Face8Way() {
- /* TODO: Docs. Link to Sprite#setDirection, and also spawnSprite(s) or composite sprites */
}
/** Called with the update options as the function context, one of which
@@ -2834,14 +2836,14 @@ define('plugins/sprite/track',[],function() {
* </pre>
* </dd>
* </dl>
- * The register and deregister functions are useful when combined with the ProximityTracker
+ * The register and deregister functions are useful when combined with the
+ * {@link module:ai/proximity-tracker.ProximityTracker|ProximityTracker}
* to track large numbers of autonomous sprites. See
* {@link module:ai/proximity-tracker.ProximityTracker|ProximityTracker.track} for
* an example of how to set that up.
* @constructor module:plugins/sprite/track.Track
*/
function Track() {
- /* TODO: Docs - link to ProximityTracker */
}
/** Called with the update options as the function context, one of which
@@ -2920,8 +2922,9 @@ define('plugins/sprite/flock',[],function() {
* accuracy with phased updates.
* <p>
* Note that this plugin will not move the sprites, it only calculates velocity. To move the
- * sprites you should add the apply-velocity plugin after this one as a commit update. In this way
- * the sprites accurately update based on their positions at the same moment in time.
+ * sprites you should add the {@link module:plugins/sprite/apply-velocity.ApplyVelocity|apply-velocity}
+ * plugin after this one as a commit update. In this way the sprites accurately update based on
+ * their positions at the same moment in time.
* <p>
* Note that this should not be constructed directly, but rather via the updates or commit
* property in your spawnSprite data, e.g. <code>update:[{name:'flock'}]</code>.
@@ -2929,8 +2932,9 @@ define('plugins/sprite/flock',[],function() {
* Alongside the name, you can pass the following options
* <dl>
* <dt>tracker</dt><dd>Pass a tracker object here. See ProximityTracker. Sprites that flock
- * with the same tracker will belong to the same flock. You should also apply the track
- * plugin to track the sprite in the proximity tracker.</dd>
+ * with the same tracker will belong to the same flock. You should also apply the
+ * {@link module:plugins/sprite/track.Track|track plugin} to track the sprite in the
+ * {@link module:ai/proximity-tracker.ProximityTracker|proximity tracker}.</dd>
* <dt>flock_speed</dt><dd>In pixels/second. This is the maximum speed for any flockmate.</dd>
* <dt>flock_neighborhood</dt><dd>The radius that defines the influential
* flockmates, in pixels. Larger is generally better but slower, dependant on the tracker.</dd>
@@ -2956,10 +2960,7 @@ define('plugins/sprite/flock',[],function() {
* @constructor module:plugins/sprite/flock.Flock
*/
function Flock() {
- /* TODO: Docs - link to proximity tracker */
- /* TODO: Docs - link to apply velocity plugin */
- /* TODO: Docs - link to track plugin. Also show an example of a complete flocked sprite with
- * all required plugins. */
+ /* TODO: Docs - Show an example of a complete flocked sprite with all required plugins. */
/* TODO: Add support for phased updates */
this.xy=[0,0];
this.xy2=[0,0];
@@ -3135,10 +3136,10 @@ define('plugins/sprite/apply-velocity',[],function() {
/**
* A sprite updater that simply takes the velocityx and velocityy properties on the sprite and
- * applies it to the position via move. This is useful in situations where another plugin is
- * updating valocities but those velocities depend upon the momentary positions of sprites. E.g.
- * you have a flock update which updates velocity. In that case you would have this plugin as
- * a commit to apply the velocity calculated by flock.
+ * applies it to the position via {@link module:sprites/sprite.Sprite#move|move}. This is useful
+ * in situations where another plugin is updating valocities but those velocities depend upon
+ * the momentary positions of sprites. E.g. you have a flock update which updates velocity.
+ * In that case you would have this plugin as a commit to apply the velocity calculated by flock.
* <p>
* Snaps runs all sprite updates first, then runs all sprite commits.
* <p>
@@ -3154,7 +3155,6 @@ define('plugins/sprite/apply-velocity',[],function() {
* @constructor module:plugins/sprite/apply-velocity.ApplyVelocity
*/
function ApplyVelocity() {
- /* TODO: Docs - link to sprite move method in description. */
/* TODO: Pass collision ratio to the collision callback */
}
@@ -3327,13 +3327,11 @@ function(Sprite, uid) {
* no parameters and return a number.
* @param {Function/Number} y The world y coordinate. If a function, it should take
* no parameters and return a number.
- * @param {Object} [opts] Optional parameter object. See sn.spawnSprite for sprite
- * spawn option values.
+ * @param {Object} [opts] Optional parameter object. For a list of parameters
+ * see the opts parameter on the {@link module:sprites/sprite.Sprite|Sprite class constructor}.
*/
GroundSprites.prototype.spawnSprite = function(defName, stateName, stateExt, x, y, opts) {
- /* TODO: Docs - link to spawnSprite in opts param */
-
opts = opts||{};
if (opts.id===undefined) {
@@ -3688,10 +3686,9 @@ define('plugins/ai/phasers/frame-phaser',[],function() {
* Adds a sprite to this phaser. The phaser will reschedule the sprites
* but cannot guarantee the first frame of update the sprite will receive.
* @method module:plugins/ai/phasers/frame-phaser.FramePhaser#addSprite
- * @param {Object} s The sprite to add
+ * @param {Object} s The {@link module:sprites/sprite.Sprite|sprite} to add
*/
FramePhaser.prototype.addSprite = function(s) {
- /* TODO: Docs - link to the sprite class */
if (s.phaserData===undefined) {
s.phaserData = {};
}
@@ -3813,6 +3810,11 @@ define('plugins/camera/push-cam',[],function() {
* </dl>
*/
function PushCam(opts) {
+ /**
+ * The sprite that this camera is following.
+ * @type {Object}
+ * @member module:plugins/ai/camera/push-cam.PushCam#follow
+ */
this.follow = sn.sprite(opts.follow);
if (!this.follow) {
throw "Camera can't follow missing sprite: "+opts.follow;
@@ -5817,7 +5819,7 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
/**
* Call this to bind keys to actions which you can test later on with
- * the <code>actioning</code> method.
+ * the {@link module:snaps.Snaps#actioning|actioning} method.
* <pre>
* sn.bindKeys([
* {key:'left', action:'left'},
@@ -5837,7 +5839,6 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
* properties. See the description for an example.
*/
this.bindKeys = function(keybinds) {
- /* TODO: Docs - Link to actioning method */
for (var i = 0; i < keybinds.length; i++) {
var keybind = keybinds[i];
_this.keyboard.bind(keybind.key, keybind.action);
@@ -5980,8 +5981,6 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
drawDebug();
_this.lastFrameTime = _this.now;
-
- //console.log(_this.stats.averages);
}
preloader.load(
@@ -6137,10 +6136,9 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
* @param {Object} layer The layer to search for tiles.
* @param {Number} c The column, aka x position in the data.
* @param {Number} r the row, aka y position in the data.
- * @return {Object} A tile, or null if the input was out of range.
+ * @return {Object} A {@link module:map/tile.Tile|Tile}, or null if the input was out of range.
*/
this.getTile = function(layer, c, r) {
- /* TODO: Docs - Link to tile class */
return this.map.getTile(layer, c, r);
};
@@ -6203,7 +6201,7 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
/**
* Create a new camera for use in game. Creating a camera does not
- * activate it. You need to then call <code>switchToCamera</code>.
+ * activate it. You need to then call {@link module:snaps.Snaps#switchToCamera|switchToCamera}.
* @method module:snaps.Snaps#createCamera
* @param {String} name The name of the camera so that you can refer
* to it again.
@@ -6212,7 +6210,6 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
* @return {Object} The new camera.
*/
this.createCamera = function(name, type, opts) {
- /* TODO: Docs - Link to switchToCamera */
if(!_this.cameraPlugins.hasOwnProperty(type)) {
throw "Warning: undefined camera plugin: " + type;
}
12 src/map/staggered-isometric.js
View
@@ -30,7 +30,19 @@ define(['map/tile', 'util/bitmap', 'util/debug', 'util/js'], function(Tile, Bitm
this.hitTests = hitTests;
this.maxXOverdraw = 0;
this.maxYOverdraw = 0;
+
+ /**
+ * The canvas width
+ * @type {Number}
+ * @member module:map/staggered-isometric.StaggeredIsometric#clientWidth
+ */
this.clientWidth = clientWidth;
+
+ /**
+ * The canvas height
+ * @type {Number}
+ * @member module:map/staggered-isometric.StaggeredIsometric#clientHeight
+ */
this.clientHeight = clientHeight;
this.hideBuildings = false;
3  src/plugins/ai/phasers/frame-phaser.js
View
@@ -48,10 +48,9 @@ define(function() {
* Adds a sprite to this phaser. The phaser will reschedule the sprites
* but cannot guarantee the first frame of update the sprite will receive.
* @method module:plugins/ai/phasers/frame-phaser.FramePhaser#addSprite
- * @param {Object} s The sprite to add
+ * @param {Object} s The {@link module:sprites/sprite.Sprite|sprite} to add
*/
FramePhaser.prototype.addSprite = function(s) {
- /* TODO: Docs - link to the sprite class */
if (s.phaserData===undefined) {
s.phaserData = {};
}
5 src/plugins/camera/push-cam.js
View
@@ -21,6 +21,11 @@ define(function() {
* </dl>
*/
function PushCam(opts) {
+ /**
+ * The sprite that this camera is following.
+ * @type {Object}
+ * @member module:plugins/ai/camera/push-cam.PushCam#follow
+ */
this.follow = sn.sprite(opts.follow);
if (!this.follow) {
throw "Camera can't follow missing sprite: "+opts.follow;
6 src/plugins/layer/ground-sprites.js
View
@@ -75,13 +75,11 @@ function(Sprite, uid) {
* no parameters and return a number.
* @param {Function/Number} y The world y coordinate. If a function, it should take
* no parameters and return a number.
- * @param {Object} [opts] Optional parameter object. See sn.spawnSprite for sprite
- * spawn option values.
+ * @param {Object} [opts] Optional parameter object. For a list of parameters
+ * see the opts parameter on the {@link module:sprites/sprite.Sprite|Sprite class constructor}.
*/
GroundSprites.prototype.spawnSprite = function(defName, stateName, stateExt, x, y, opts) {
- /* TODO: Docs - link to spawnSprite in opts param */
-
opts = opts||{};
if (opts.id===undefined) {
5 src/plugins/sprite/8way.js
View
@@ -15,8 +15,8 @@ define(function() {
* A sprite updater that sets the sprite's state extension to a compass direction
* ('n', 'ne', 'e', 'se'...)
* based on the direction values in the sprite. Direction updates automatically when the sprite
- * moves but can be overridden with setDirection. The compass direction takes into account the
- * isometric projection.
+ * moves but can be overridden with {@link module:sprites/sprite.Sprite#setDirection|setDirection}.
+ * The compass direction takes into account the isometric projection.
* <p>
* Note that this should not be constructed directly, but rather via the updates or commit
* property in your spawnSprite data, e.g. <code>updates:[{name:'8way'}]</code>.
@@ -25,7 +25,6 @@ define(function() {
* @constructor module:plugins/sprite/8way.Face8Way
*/
function Face8Way() {
- /* TODO: Docs. Link to Sprite#setDirection, and also spawnSprite(s) or composite sprites */
}
/** Called with the update options as the function context, one of which
7 src/plugins/sprite/animate.js
View
@@ -12,14 +12,15 @@ define(function() {
/**
* A sprite updater that animates one or more properties on the sprite. Properties are modified
* directly, so handle with care. Be aware that property updates on things such as position will bypass
- * the automatic direction setting you'd get if you had called Sprite#move.
+ * the automatic direction setting you'd get if you had called {@link module:sprites/sprite.Sprite#move|move}
+ * on your sprite.
* <p>
* Note that this should not be constructed directly, but rather via the updates or commit
* property in your spawnSprite data, e.g. <code>updates:[{name:'animate'}]</code>.
* <p>
* Alongside the name, you can pass the following options
* <dl>
- * <dt>tween</dt><dd>The name of the tween function. See the tweens module for a full list of options.</dd>
+ * <dt>tween</dt><dd>The name of the tween function. See the {@link animate/tween|tweens} module for a full list of options.</dd>
* <dt>props</dt><dd>An object describing the properties to adjust. Values are relative adjustments, not
* absolute values. E.g.
* <pre>
@@ -37,8 +38,6 @@ define(function() {
* @constructor module:plugins/sprite/animate.Animate
*/
function Animate() {
- /* TODO: Docs - link to tweens functions. */
- /* TODO: Docs - link to sprite move function. */
}
9 src/plugins/sprite/apply-velocity.js
View
@@ -11,10 +11,10 @@ define(function() {
/**
* A sprite updater that simply takes the velocityx and velocityy properties on the sprite and
- * applies it to the position via move. This is useful in situations where another plugin is
- * updating valocities but those velocities depend upon the momentary positions of sprites. E.g.
- * you have a flock update which updates velocity. In that case you would have this plugin as
- * a commit to apply the velocity calculated by flock.
+ * applies it to the position via {@link module:sprites/sprite.Sprite#move|move}. This is useful
+ * in situations where another plugin is updating valocities but those velocities depend upon
+ * the momentary positions of sprites. E.g. you have a flock update which updates velocity.
+ * In that case you would have this plugin as a commit to apply the velocity calculated by flock.
* <p>
* Snaps runs all sprite updates first, then runs all sprite commits.
* <p>
@@ -30,7 +30,6 @@ define(function() {
* @constructor module:plugins/sprite/apply-velocity.ApplyVelocity
*/
function ApplyVelocity() {
- /* TODO: Docs - link to sprite move method in description. */
/* TODO: Pass collision ratio to the collision callback */
}
2  src/plugins/sprite/bounce.js
View
@@ -29,8 +29,6 @@ define(function() {
}
- /* TODO: All docs. Search for {Bool} and make it Boolean */
-
/** Called with the sprite as the function context.
* @method module:plugins/sprite/bounce.Bounce#update
* @private
15 src/plugins/sprite/flock.js
View
@@ -17,8 +17,9 @@ define(function() {
* accuracy with phased updates.
* <p>
* Note that this plugin will not move the sprites, it only calculates velocity. To move the
- * sprites you should add the apply-velocity plugin after this one as a commit update. In this way
- * the sprites accurately update based on their positions at the same moment in time.
+ * sprites you should add the {@link module:plugins/sprite/apply-velocity.ApplyVelocity|apply-velocity}
+ * plugin after this one as a commit update. In this way the sprites accurately update based on
+ * their positions at the same moment in time.
* <p>
* Note that this should not be constructed directly, but rather via the updates or commit
* property in your spawnSprite data, e.g. <code>update:[{name:'flock'}]</code>.
@@ -26,8 +27,9 @@ define(function() {
* Alongside the name, you can pass the following options
* <dl>
* <dt>tracker</dt><dd>Pass a tracker object here. See ProximityTracker. Sprites that flock
- * with the same tracker will belong to the same flock. You should also apply the track
- * plugin to track the sprite in the proximity tracker.</dd>
+ * with the same tracker will belong to the same flock. You should also apply the
+ * {@link module:plugins/sprite/track.Track|track plugin} to track the sprite in the
+ * {@link module:ai/proximity-tracker.ProximityTracker|proximity tracker}.</dd>
* <dt>flock_speed</dt><dd>In pixels/second. This is the maximum speed for any flockmate.</dd>
* <dt>flock_neighborhood</dt><dd>The radius that defines the influential
* flockmates, in pixels. Larger is generally better but slower, dependant on the tracker.</dd>
@@ -53,10 +55,7 @@ define(function() {
* @constructor module:plugins/sprite/flock.Flock
*/
function Flock() {
- /* TODO: Docs - link to proximity tracker */
- /* TODO: Docs - link to apply velocity plugin */
- /* TODO: Docs - link to track plugin. Also show an example of a complete flocked sprite with
- * all required plugins. */
+ /* TODO: Docs - Show an example of a complete flocked sprite with all required plugins. */
/* TODO: Add support for phased updates */
this.xy=[0,0];
this.xy2=[0,0];
4 src/plugins/sprite/track.js
View
@@ -43,14 +43,14 @@ define(function() {
* </pre>
* </dd>
* </dl>
- * The register and deregister functions are useful when combined with the ProximityTracker
+ * The register and deregister functions are useful when combined with the
+ * {@link module:ai/proximity-tracker.ProximityTracker|ProximityTracker}
* to track large numbers of autonomous sprites. See
* {@link module:ai/proximity-tracker.ProximityTracker|ProximityTracker.track} for
* an example of how to set that up.
* @constructor module:plugins/sprite/track.Track
*/
function Track() {
- /* TODO: Docs - link to ProximityTracker */
}
/** Called with the update options as the function context, one of which
11 src/snaps.js
View
@@ -323,7 +323,7 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
/**
* Call this to bind keys to actions which you can test later on with
- * the <code>actioning</code> method.
+ * the {@link module:snaps.Snaps#actioning|actioning} method.
* <pre>
* sn.bindKeys([
* {key:'left', action:'left'},
@@ -343,7 +343,6 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
* properties. See the description for an example.
*/
this.bindKeys = function(keybinds) {
- /* TODO: Docs - Link to actioning method */
for (var i = 0; i < keybinds.length; i++) {
var keybind = keybinds[i];
_this.keyboard.bind(keybind.key, keybind.action);
@@ -486,8 +485,6 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
drawDebug();
_this.lastFrameTime = _this.now;
-
- //console.log(_this.stats.averages);
}
preloader.load(
@@ -643,10 +640,9 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
* @param {Object} layer The layer to search for tiles.
* @param {Number} c The column, aka x position in the data.
* @param {Number} r the row, aka y position in the data.
- * @return {Object} A tile, or null if the input was out of range.
+ * @return {Object} A {@link module:map/tile.Tile|Tile}, or null if the input was out of range.
*/
this.getTile = function(layer, c, r) {
- /* TODO: Docs - Link to tile class */
return this.map.getTile(layer, c, r);
};
@@ -709,7 +705,7 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
/**
* Create a new camera for use in game. Creating a camera does not
- * activate it. You need to then call <code>switchToCamera</code>.
+ * activate it. You need to then call {@link module:snaps.Snaps#switchToCamera|switchToCamera}.
* @method module:snaps.Snaps#createCamera
* @param {String} name The name of the camera so that you can refer
* to it again.
@@ -718,7 +714,6 @@ function(SpriteDef, Sprite, Composite, Keyboard, Mouse, util, StaggeredIsometric
* @return {Object} The new camera.
*/
this.createCamera = function(name, type, opts) {
- /* TODO: Docs - Link to switchToCamera */
if(!_this.cameraPlugins.hasOwnProperty(type)) {
throw "Warning: undefined camera plugin: " + type;
}
5 src/sprites/composite.js
View
@@ -59,12 +59,11 @@ define(['util/js', 'sprites/sprite'], function(js, Sprite) {
* no parameters and return a number.
* @param {Number} h The height off the ground. If a function, it should take
* no parameters and return a number.
- * @param {Object} [opts] See snaps.spawnSprite for a full list of options.
+ * @param {Object} [opts] For a list of parameters
+ * see the opts parameter on the {@link module:sprites/sprite.Sprite|Sprite class constructor}.
*/
Composite.prototype.addSprite = function(defName, stateName, x, y, h, opts) {
- /* TODO: Docs - Link to spawnSprite in opts param */
-
if (opts===undefined) {
opts = {};
}
4 src/sprites/sprite.js
View
@@ -11,7 +11,7 @@ define(['util/js'], function(js) {
var clone = js.clone;
/** Creates a new sprite object. Note that you shouldn't normally call this constructor directly.
- * Call the factory method <code>sn.spawnSprite</code> instead.
+ * Call the factory method {@link module:snaps.Snaps#spawnSprite|spawnSprite} instead.
* <p>
* Some parameters or options accept functions. An example of how to pass a random range into any
* Function/Number parameters would be to bind the rnd function in util/rnd. E.g.
@@ -63,8 +63,6 @@ define(['util/js'], function(js) {
*/
function Sprite(sn, def, x, y, h, opts) {
- /* TODO: Docs - link to spawnSprite */
-
opts = opts||{};
this.def = def;
3  src/util/stats.js
View
@@ -13,9 +13,6 @@ define(function() {
*/
function Stats() {
- /* TODO: Docs - Go through every constructor looking for this properties that can be exposed
- * through documentation. */
-
this.samples = {};
this.totals = {};
Please sign in to comment.
Something went wrong with that request. Please try again.