summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRubén Beltran del Río <ben@nsovocal.com>2018-06-26 22:00:10 +0000
committerRubén Beltran del Río <ben@nsovocal.com>2018-06-26 22:00:10 +0000
commitc80b2f4575cfc3d74ec8e0b112943cbd081ffcd7 (patch)
tree4d2c7a991fcc6510431af72225f7cea2c450f86a /doc
parentbe12c97f83026087e0974fc54508b09c3154c9eb (diff)
parentfd38d4096e65ba5afba8ed1ddc75ed1814ca8c16 (diff)
Merge branch 'feature/rbdr-update-docs' into 'master'
Update Documentation See merge request rbdr/tomato-sauce!1
Diffstat (limited to 'doc')
-rw-r--r--doc/README.md261
1 files changed, 261 insertions, 0 deletions
diff --git a/doc/README.md b/doc/README.md
new file mode 100644
index 0000000..c1054cd
--- /dev/null
+++ b/doc/README.md
@@ -0,0 +1,261 @@
+## Classes
+
+<dl>
+<dt><a href="#TomatoSauce">TomatoSauce</a> ⇐ <code>EventEmitter</code></dt>
+<dd></dd>
+</dl>
+
+## Members
+
+<dl>
+<dt><a href="#Util">Util</a> : <code>Object</code></dt>
+<dd><p>Module containing utility functions</p>
+</dd>
+</dl>
+
+## Functions
+
+<dl>
+<dt><a href="#256ColorsRenderer">256ColorsRenderer()</a></dt>
+<dd><p>Returns a 256 color, see <a href="https://en.wikipedia.org/wiki/ANSI_escape_code#Colors">https://en.wikipedia.org/wiki/ANSI_escape_code#Colors</a>
+for more info.</p>
+</dd>
+<dt><a href="#ANSIRenderer">ANSIRenderer()</a></dt>
+<dd><p>Returns a basic ansi color, see <a href="https://en.wikipedia.org/wiki/ANSI_escape_code#Colors">https://en.wikipedia.org/wiki/ANSI_escape_code#Colors</a>
+for more info.</p>
+</dd>
+<dt><a href="#FakeColorRenderer">FakeColorRenderer()</a></dt>
+<dd><p>Returns a malformed 24-bit ansi color</p>
+</dd>
+<dt><a href="#TrueColorRenderer">TrueColorRenderer()</a></dt>
+<dd><p>Returns an ANSI code for 24-bit True Color, see
+<a href="https://en.wikipedia.org/wiki/ANSI_escape_code#Colors">https://en.wikipedia.org/wiki/ANSI_escape_code#Colors</a> and look for
+24-bit colors for more info. Only looks good in supported terminals,
+otherwise looks like FakeColor</p>
+</dd>
+<dt><a href="#CircleScreen">CircleScreen()</a></dt>
+<dd><p>Draws concentric circles. Each ring has its own color.</p>
+</dd>
+<dt><a href="#GradientsScreen">GradientsScreen()</a></dt>
+<dd><p>Draws moving gradient boxes</p>
+</dd>
+<dt><a href="#MirrorsScreen">MirrorsScreen()</a></dt>
+<dd><p>Draws small moving gradient boxes and repeats them.</p>
+</dd>
+<dt><a href="#RandomScreen">RandomScreen()</a></dt>
+<dd><p>Draws random colors</p>
+</dd>
+<dt><a href="#SprinklesScreen">SprinklesScreen()</a></dt>
+<dd><p>Draws random sprinkles in the screen each frame. Same color per
+frame.</p>
+</dd>
+</dl>
+
+## Interfaces
+
+<dl>
+<dt><a href="#IScreen">IScreen</a> ⇒ <code>String</code></dt>
+<dd><p>A function that represents a screen, it is called frequently and should
+return a string consisting of commands to run.</p>
+</dd>
+<dt><a href="#IRenderer">IRenderer</a> ⇒ <code>String</code></dt>
+<dd><p>A function that represents a renderer, it should take in a color in RGB and
+return a string with the appropriate code to colorize the terminal.</p>
+</dd>
+</dl>
+
+<a name="IScreen"></a>
+
+## IScreen ⇒ <code>String</code>
+A function that represents a screen, it is called frequently and should
+return a string consisting of commands to run.
+
+**Kind**: global interface
+**Returns**: <code>String</code> - The commands used to render the screen elements
+
+| Param | Type | Description |
+| --- | --- | --- |
+| modulation | <code>Number</code> | A number between 0 and 255 representing the current step of the modulation |
+| width | <code>Number</code> | The width of the screen |
+| height | <code>Number</code> | The height of the screen |
+| renderer | [<code>IRenderer</code>](#IRenderer) | The renderer used to colorize the scfeen |
+
+<a name="IRenderer"></a>
+
+## IRenderer ⇒ <code>String</code>
+A function that represents a renderer, it should take in a color in RGB and
+return a string with the appropriate code to colorize the terminal.
+
+**Kind**: global interface
+**Returns**: <code>String</code> - The commands used to colorize the terminal
+
+| Param | Type | Description |
+| --- | --- | --- |
+| red | <code>Number</code> | The red component of the color between 0 and 255 |
+| green | <code>Number</code> | The green component of the color between 0 and 255 |
+| blue | <code>Number</code> | The green component of the color between 0 and 255 |
+
+<a name="TomatoSauce"></a>
+
+## TomatoSauce ⇐ <code>EventEmitter</code>
+**Kind**: global class
+**Extends**: <code>EventEmitter</code>
+**Properties**
+
+| Name | Type | Default | Description |
+| --- | --- | --- | --- |
+| screens | [<code>Array.&lt;IScreen&gt;</code>](#IScreen) | | an array of screens available to serve |
+| renderers | [<code>Array.&lt;IRenderer&gt;</code>](#IRenderer) | | an array of renderers available to colorize |
+| [port] | <code>Number</code> | <code>9999</code> | the port to listen on |
+| [frequency] | <code>Number</code> | <code>333</code> | how often to update the screen |
+| [modulation] | <code>Number</code> | <code>5</code> | number between 0-255 depicting current modulation step |
+
+
+* [TomatoSauce](#TomatoSauce) ⇐ <code>EventEmitter</code>
+ * [new TomatoSauce(config)](#new_TomatoSauce_new)
+ * [.run()](#TomatoSauce+run)
+
+<a name="new_TomatoSauce_new"></a>
+
+### new TomatoSauce(config)
+The main application for tomato sauce. Listens for connections and serves
+random combinations of screens and renderers
+
+The main entry point is the `#run()` function.
+
+It emits a listening event that contains the server information on
+the `server` key inside the `data` property of the event.
+
+It also emits an error event that contains the error information on
+the `error` key inside the `data` property of the event.
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| config | <code>object</code> | the configuration object used to extend the properties. |
+
+<a name="TomatoSauce+run"></a>
+
+### tomatoSauce.run()
+Main entry point, initializes the server and binds events for connections
+
+**Kind**: instance method of [<code>TomatoSauce</code>](#TomatoSauce)
+<a name="Util"></a>
+
+## Util : <code>Object</code>
+Module containing utility functions
+
+**Kind**: global variable
+
+* [Util](#Util) : <code>Object</code>
+ * [.parse16BitBuffer(buffer)](#Util.parse16BitBuffer) ⇒ <code>Number</code>
+ * [.pickRandom(array)](#Util.pickRandom) ⇒ <code>Any</code>
+ * [.loadFiles(path)](#Util.loadFiles) ⇒ <code>Array</code>
+
+<a name="Util.parse16BitBuffer"></a>
+
+### Util.parse16BitBuffer(buffer) ⇒ <code>Number</code>
+Parses a 16 bit number buffer
+
+**Kind**: static method of [<code>Util</code>](#Util)
+**Returns**: <code>Number</code> - the parsed value
+
+| Param | Type | Description |
+| --- | --- | --- |
+| buffer | <code>Array.&lt;String&gt;</code> | the buffer to parse |
+
+<a name="Util.pickRandom"></a>
+
+### Util.pickRandom(array) ⇒ <code>Any</code>
+Picks a random element from an array
+
+**Kind**: static method of [<code>Util</code>](#Util)
+**Returns**: <code>Any</code> - the picked element
+
+| Param | Type | Description |
+| --- | --- | --- |
+| array | <code>Array</code> | the array to use |
+
+<a name="Util.loadFiles"></a>
+
+### Util.loadFiles(path) ⇒ <code>Array</code>
+For a gi ven path, requires all of the files and returns an array
+with the results. If the directory contains any non-requireable
+files, it will fail.
+
+**Kind**: static method of [<code>Util</code>](#Util)
+**Returns**: <code>Array</code> - the array of all the loaded modules
+
+| Param | Type | Description |
+| --- | --- | --- |
+| path | <code>String</code> | the path where the files are located |
+
+<a name="256ColorsRenderer"></a>
+
+## 256ColorsRenderer()
+Returns a 256 color, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
+for more info.
+
+**Kind**: global function
+**Implements**: [<code>IRenderer</code>](#IRenderer)
+<a name="ANSIRenderer"></a>
+
+## ANSIRenderer()
+Returns a basic ansi color, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
+for more info.
+
+**Kind**: global function
+**Implements**: [<code>IRenderer</code>](#IRenderer)
+<a name="FakeColorRenderer"></a>
+
+## FakeColorRenderer()
+Returns a malformed 24-bit ansi color
+
+**Kind**: global function
+**Implements**: [<code>IRenderer</code>](#IRenderer)
+<a name="TrueColorRenderer"></a>
+
+## TrueColorRenderer()
+Returns an ANSI code for 24-bit True Color, see
+https://en.wikipedia.org/wiki/ANSI_escape_code#Colors and look for
+24-bit colors for more info. Only looks good in supported terminals,
+otherwise looks like FakeColor
+
+**Kind**: global function
+**Implements**: [<code>IRenderer</code>](#IRenderer)
+<a name="CircleScreen"></a>
+
+## CircleScreen()
+Draws concentric circles. Each ring has its own color.
+
+**Kind**: global function
+**Implements**: [<code>IScreen</code>](#IScreen)
+<a name="GradientsScreen"></a>
+
+## GradientsScreen()
+Draws moving gradient boxes
+
+**Kind**: global function
+**Implements**: [<code>IScreen</code>](#IScreen)
+<a name="MirrorsScreen"></a>
+
+## MirrorsScreen()
+Draws small moving gradient boxes and repeats them.
+
+**Kind**: global function
+**Implements**: [<code>IScreen</code>](#IScreen)
+<a name="RandomScreen"></a>
+
+## RandomScreen()
+Draws random colors
+
+**Kind**: global function
+**Implements**: [<code>IScreen</code>](#IScreen)
+<a name="SprinklesScreen"></a>
+
+## SprinklesScreen()
+Draws random sprinkles in the screen each frame. Same color per
+frame.
+
+**Kind**: global function
+**Implements**: [<code>IScreen</code>](#IScreen)