1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 09:09:30 +00:00
ubiquitousse/docs/modules/signal.html

421 lines
11 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Ubiquitousse reference</title>
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Ubiquitousse</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Module">Module </a></li>
<li><a href="#SignalRegistry_objects">SignalRegistry objects </a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/ubiquitousse.html">ubiquitousse</a></li>
<li><a href="../modules/asset.html">asset</a></li>
<li><a href="../modules/ecs.html">ecs</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><strong>signal</strong></li>
<li><a href="../modules/timer.html">timer</a></li>
<li><a href="../modules/util.html">util</a></li>
</ul>
<h2>Topics</h2>
<ul class="">
<li><a href="../topics/README.md.html">README</a></li>
<li><a href="../topics/LICENSE.html">LICENSE</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>signal</code></h1>
<p>Signal management for Lua.</p>
<p> No dependency.
Optional dependency: LÖVE to hook into LÖVE events.</p>
<h3>Usage:</h3>
<ul>
<pre class="example">TODO
</pre>
</ul>
<h2><a href="#Module">Module </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#new">new ()</a></td>
<td class="summary">Creates and return a new SignalRegistry.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#event">event</a></td>
<td class="summary"><a href="../modules/signal.html#SignalRegistry_objects">SignalRegistry</a> which will be used to bind signals that need to be called on game engine event; other ubiquitousse modules may bind to this registry
if avaible.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#registerEvents">registerEvents ()</a></td>
<td class="summary">Call this function to hook <a href="../modules/signal.html#event">signal.event</a> signals to LÖVE events.</td>
</tr>
</table>
<h2><a href="#SignalRegistry_objects">SignalRegistry objects </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#SignalRegistry.signals">SignalRegistry.signals</a></td>
<td class="summary">Map of signals to list of listeners.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:bind">SignalRegistry:bind (name, fn, ...)</a></td>
<td class="summary">Bind one or several functions to a signal name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:unbind">SignalRegistry:unbind (name, fn, ...)</a></td>
<td class="summary">Unbind one or several functions to a signal name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:unbindAll">SignalRegistry:unbindAll (name)</a></td>
<td class="summary">Remove every bound function to a signal name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:replace">SignalRegistry:replace (name, sourceFn, destFn)</a></td>
<td class="summary">Replace a bound function with another function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:clear">SignalRegistry:clear ()</a></td>
<td class="summary">Remove every bound function to every signal.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:emit">SignalRegistry:emit (name, ...)</a></td>
<td class="summary">Emit a signal, i.e.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Module"></a>Module </h2>
<dl class="function">
<dt>
<a name = "new"></a>
<strong>new ()</strong>
</dt>
<dd>
Creates and return a new SignalRegistry.
</ul>
</ul>
</ul>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../modules/signal.html#SignalRegistry_objects">SignalRegistry</a></span>
</ol>
</dd>
<dt>
<a name = "event"></a>
<strong>event</strong>
</dt>
<dd>
<p><a href="../modules/signal.html#SignalRegistry_objects">SignalRegistry</a> which will be used to bind signals that need to be called on game engine event; other ubiquitousse modules may bind to this registry
if avaible. </p>
<p> For example, every ubiquitousse module with a &ldquo;update&rdquo; function will bind it to the &ldquo;update&rdquo; signal in the registry;
you can then call this signal on each game update to update every ubiquitousse module easily.</p>
<p> Provided signals:</p>
<ul>
<li><code>update(dt)</code>, should be called on every game update</li>
<li><code>draw()</code>, should be called on every game draw</li>
<li>for LÖVE, there are callbacks for every LÖVE callback function that need to be called on their corresponding LÖVE callback</li>
</ul>
</ul>
<h3>Type:</h3>
<ul>
<code>SignalRegistry</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "registerEvents"></a>
<strong>registerEvents ()</strong>
</dt>
<dd>
Call this function to hook <a href="../modules/signal.html#event">signal.event</a> signals to LÖVE events.
This means overriding every existing LÖVE callback. If a callback is already defined, the new one will call the old function along with the signal:emit.
<h3>Requires:</h3>
<ul>
love
</ul>
</ul>
</ul>
</ul>
</dd>
</dl>
<h2 class="section-header has-description"><a name="SignalRegistry_objects"></a>SignalRegistry objects </h2>
<div class="section-description">
Signal registry. </p>
<p> A SignalRegistry is a separate ubiquitousse.signal instance: its signals will be independant from other registries.
</div>
<dl class="function">
<dt>
<a name = "SignalRegistry.signals"></a>
<strong>SignalRegistry.signals</strong>
</dt>
<dd>
Map of signals to list of listeners.
</ul>
<h3>Type:</h3>
<ul>
<code>{["name"]={fn,...}}</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "SignalRegistry:bind"></a>
<strong>SignalRegistry:bind (name, fn, ...)</strong>
</dt>
<dd>
Bind one or several functions to a signal name.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
the name of the signal
</li>
<li><span class="parameter">fn</span>
<span class="types"><span class="type">function</span></span>
the function to bind to the signal
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">function,...</span></span>
other function to bind to the signal
</li>
</ul>
</dd>
<dt>
<a name = "SignalRegistry:unbind"></a>
<strong>SignalRegistry:unbind (name, fn, ...)</strong>
</dt>
<dd>
Unbind one or several functions to a signal name.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
the name of the signal
</li>
<li><span class="parameter">fn</span>
<span class="types"><span class="type">function</span></span>
the function to unbind to the signal
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">function,...</span></span>
other function to unbind to the signal
</li>
</ul>
</dd>
<dt>
<a name = "SignalRegistry:unbindAll"></a>
<strong>SignalRegistry:unbindAll (name)</strong>
</dt>
<dd>
Remove every bound function to a signal name.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
the name of the signal
</li>
</ul>
</dd>
<dt>
<a name = "SignalRegistry:replace"></a>
<strong>SignalRegistry:replace (name, sourceFn, destFn)</strong>
</dt>
<dd>
Replace a bound function with another function.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
the name of the signal
</li>
<li><span class="parameter">sourceFn</span>
<span class="types"><span class="type">function</span></span>
the function currently bound to the signal
</li>
<li><span class="parameter">destFn</span>
<span class="types"><span class="type">function</span></span>
the function that will replace the previous one
</li>
</ul>
</dd>
<dt>
<a name = "SignalRegistry:clear"></a>
<strong>SignalRegistry:clear ()</strong>
</dt>
<dd>
Remove every bound function to every signal.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "SignalRegistry:emit"></a>
<strong>SignalRegistry:emit (name, ...)</strong>
</dt>
<dd>
Emit a signal, i.e. call every function bound to it, with the given arguments.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
the name of the signal
</li>
<li><span class="parameter">...</span>
arguments to pass to the functions bound to this signal
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2021-12-27 13:22:21 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>