1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 17:19:31 +00:00

Update and rebuild docs

This commit is contained in:
Étienne Fildadut 2022-09-16 20:07:53 +09:00
parent 21679dde5c
commit 7ad5c2d641
19 changed files with 3026 additions and 949 deletions

View file

@ -35,6 +35,7 @@
<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/input.html">input</a></li>
<li><a href="modules/ldtk.html">ldtk</a></li>
<li><a href="modules/scene.html">scene</a></li>
<li><a href="modules/signal.html">signal</a></li>
@ -71,6 +72,10 @@
<td class="name" nowrap><a href="modules/ecs.html">ecs</a></td>
<td class="summary">ECS (<a href="https://en.wikipedia.org/wiki/Entity_component_system">entity compenent system</a>) library for Lua.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/input.html">input</a></td>
<td class="summary">Input management facilities.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/ldtk.html">ldtk</a></td>
<td class="summary"><a href="https://ldtk.io/">LDtk</a> level importer for Lua and drawing using LÖVE.</td>
@ -81,7 +86,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="modules/signal.html">signal</a></td>
<td class="summary">Signal management for Lua.</td>
<td class="summary">Simple signal / observer pattern implementation for Lua.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/timer.html">timer</a></td>
@ -108,7 +113,7 @@
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -43,6 +43,7 @@
<li><a href="../modules/ubiquitousse.html">ubiquitousse</a></li>
<li><strong>asset</strong></li>
<li><a href="../modules/ecs.html">ecs</a></li>
<li><a href="../modules/input.html">input</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -67,6 +68,8 @@
<p> See the <a href="../modules/asset.html#Asset:__call">Asset:__call</a> method for more details on how assets are loaded. Hopefully this will allow you to use asset which are more game-specific than &ldquo;image&rdquo; or &ldquo;audio&rdquo;.</p>
<p> TODO: async loading</p>
<p> No dependencies.</p>
<h3>Usage:</h3>
<ul>
@ -334,7 +337,7 @@
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -44,6 +44,7 @@
<li><a href="../modules/ubiquitousse.html">ubiquitousse</a></li>
<li><a href="../modules/asset.html">asset</a></li>
<li><strong>ecs</strong></li>
<li><a href="../modules/input.html">input</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -279,6 +280,10 @@ end
<td class="summary">Returns an iterator that iterate through the entties in this system, in order.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:get">System:get (i)</a></td>
<td class="summary">Get the <code>i</code>th entity in the system.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:clear">System:clear ()</a></td>
<td class="summary">Remove every entity from the system and its subsystems.</td>
</tr>
@ -410,7 +415,15 @@ end
<strong>scene (name[, systems={}[, entities={}]])</strong>
</dt>
<dd>
If <code>uqt.scene</code> is available, returns a new scene that will consist of a ECS world with the specified systems and entities.
If <code>uqt.scene</code> is available, returns a new scene that will consist of a ECS world with the specified systems and entities. </p>
<p> When suspending and resuming the scene, the <code>onSuspend</code> and <code>onResume</code> events will be emitted on the ECS world.</p>
<p> Note that since <code>uqt.scene</code> use <a href="https://www.lua.org/manual/5.1/manual.html#pdf-require">require</a> to load the scenes, the scenes files will be cached &ndash; including variables defined in them.
So if you store the entity list directly in a variable in the scene file, it will be reused every time the scene is entered, and will thus
be shared among the different execution of the scene. This may be problematic if an entity is modified by one scene instance, as it will affect others
(this should not be a problem with systems due to system instanciation). To avoid this issue, instead you would typically define entities through a
function that will recreate the entities on every scene load.
<h3>Requires:</h3>
<ul>
@ -427,13 +440,13 @@ end
the name of the new scene
</li>
<li><span class="parameter">systems</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
list of systems to add to the world
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table/function</a></span>
list of systems to add to the world. If it is a function, it will be executed every time we enter the scene and returns the list of systems.
(<em>default</em> {})
</li>
<li><span class="parameter">entities</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
list of entities to add to the world
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table/function</a></span>
list of entities to add to the world. If it is a function, it will be executed every time we enter the scene and returns the list of entities.
(<em>default</em> {})
</li>
</ul>
@ -1506,6 +1519,39 @@ avoid repeating your filters or allow controlling several system from a single p
</dd>
<dt>
<a name = "System:get"></a>
<strong>System:get (i)</strong>
</dt>
<dd>
Get the <code>i</code>th entity in the system.
This is a simple wrapper around <a href="../modules/ecs.html#System:iter">iter</a>; it <em>will</em> iterate over all the entities in the system in order until we reach the desired one.
Complexity: O(i)
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">i</span>
<span class="types"><span class="type">number</span></span>
the index of the entity
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../modules/ecs.html#Entity_objects">Entity</a></span>
the entity; <code>nil</code> if there is no such entity in the system
</ol>
</dd>
<dt>
<a name = "System:clear"></a>
@ -1683,7 +1729,7 @@ its sibling systems (i.e. completely stop the propagation of the event).</li>
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

706
docs/modules/input.html Normal file
View file

@ -0,0 +1,706 @@
<!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="#Functions">Functions</a></li>
<li><a href="#Input_objects">Input 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><strong>input</strong></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></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>input</code></h1>
<p>Input management facilities.</p>
<p> The module returns a single function, <a href="../modules/input.html#">input</a>.</p>
<p> <strong>Requires</strong> ubiquitousse.signal.</p>
<h3>Usage:</h3>
<ul>
<pre class="example">TODO
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#input">input ()</a></td>
<td class="summary">Make a new input object.</td>
</tr>
</table>
<h2><a href="#Input_objects">Input objects </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Input.config">Input.config</a></td>
<td class="summary">Input configuration table.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input.children">Input.children</a></td>
<td class="summary">List and map of children inputs.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input.name">Input.name</a></td>
<td class="summary">Name of the input.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input.grabbed">Input.grabbed</a></td>
<td class="summary">False if the input is currently not grabbed, a subinput otherwise.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input.grabbing">Input.grabbing</a></td>
<td class="summary">False if the input is not a subinput, the input it grabbed otherwise.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input.event">Input.event</a></td>
<td class="summary">Input event registry.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:update">Input:update ()</a></td>
<td class="summary">Update the input and its children.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:clone">Input:clone ()</a></td>
<td class="summary">Create a new input object based on this input <a href="../modules/input.html#Input.config">config</a> data.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:reload">Input:reload ()</a></td>
<td class="summary">Relond the input <a href="../modules/input.html#Input.config">config</a>, and do the same for its children.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:disable">Input:disable ()</a></td>
<td class="summary">Disable the input and its children, preventing further updates and events.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:onNextActiveSource">Input:onNextActiveSource (fn[, filter])</a></td>
<td class="summary">Will call fn(source) on the next activated source (including sources not currently used by this input).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:grab">Input:grab ()</a></td>
<td class="summary">Grab the input and its children input and returns the new subinput.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:release">Input:release ()</a></td>
<td class="summary">Release a subinput and its children.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:neutralize">Input:neutralize ()</a></td>
<td class="summary">Set the state of this input to a neutral position (i.e.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:setJoystick">Input:setJoystick (joystick)</a></td>
<td class="summary">Set the joystick associated with this input.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:getJoystick">Input:getJoystick ()</a></td>
<td class="summary">Returns the currently selected joystick.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:down">Input:down ()</a></td>
<td class="summary">Returns true if the input is currently down.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:pressed">Input:pressed ()</a></td>
<td class="summary">Returns true if the input has just been pressed.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:released">Input:released ()</a></td>
<td class="summary">Returns true if the input has just been released.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:value">Input:value ()</a></td>
<td class="summary">Returns the current value of the input.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:delta">Input:delta ()</a></td>
<td class="summary">Returns the delta value of the input since the last call to <a href="../modules/input.html#Input:update">update</a>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:pointer">Input:pointer ()</a></td>
<td class="summary">If there is a horizontal and vertical children inputs, this returns the horizontal value and the vertical value.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Input:clamped">Input:clamped ()</a></td>
<td class="summary">Same as <a href="../modules/input.html#Input:pointer">pointer</a>, but normalize the returned vector, i.e.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "input"></a>
<strong>input ()</strong>
</dt>
<dd>
Make a new input object.
t: input configuration table (optional)
</ul>
</ul>
</ul>
</ul>
</dd>
</dl>
<h2 class="section-header has-description"><a name="Input_objects"></a>Input objects </h2>
<div class="section-description">
Input methods.
</div>
<dl class="function">
<dt>
<a name = "Input.config"></a>
<strong>Input.config</strong>
</dt>
<dd>
Input configuration table.
It can be used to recreate this input object later (by passing the table as an argument for the input constructor).
This table does not contain any userdata and should be easily serializable (e.g. to save custom input binding config).
This doesn&rsquo;t include input state, grab state, the event registry and the selected joystick since they may change often during runtime.
Can be changed anytime, but you may need to call <a href="../modules/input.html#Input:reload">reload</a> to apply changes.
</ul>
</ul>
</ul>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example">player.config = {
<span class="string">"key.a"</span>, <span class="string">"key.d - key.a"</span>, {<span class="string">"key.left + x"</span>, x=<span class="number">0.5</span>}, <span class="comment">-- list of input sources expressions
</span> jump = {...}, <span class="comment">-- children input
</span> deadzone = <span class="number">0.05</span>, <span class="comment">-- The deadzone for analog inputs (e.g. joystick axes): if the input absolute value is strictly below this, it will be considered as 0.
</span> threshold = <span class="number">0.05</span> <span class="comment">-- The pressed threshold: an input is considered down if above or equal to this value.
</span>}</pre>
</ul>
</dd>
<dt>
<a name = "Input.children"></a>
<strong>Input.children</strong>
</dt>
<dd>
List and map of children inputs.
{[child1.name]=child1, [child2.name]=child2, child1, child2&hellip;}
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input.name"></a>
<strong>Input.name</strong>
</dt>
<dd>
Name of the input.
Defined on children inputs only.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input.grabbed"></a>
<strong>Input.grabbed</strong>
</dt>
<dd>
False if the input is currently not grabbed, a subinput otherwise.
This may be different between each subinput.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input.grabbing"></a>
<strong>Input.grabbing</strong>
</dt>
<dd>
False if the input is not a subinput, the input it grabbed otherwise.
This may be different between each subinput.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input.event"></a>
<strong>Input.event</strong>
</dt>
<dd>
Input event registry.
The following events are available:</p>
<ul>
<li><code>&quot;moved&quot;</code>: called when the input value change, with arguments (new value, delta since last event)</li>
<li><code>&quot;pressed&quot;</code>: called when the input is pressed</li>
<li><code>&quot;released&quot;</code>: called when the input is released</li>
</ul>
<p> For pointer inputs (have a &ldquo;horizontal&rdquo; and &ldquo;vertical&rdquo; children inputs) is also avaible:</p>
<ul>
<li><code>&quot;pointer moved&quot;</code>: called when the pointer position change, with arguments (new pointer x, new pointer y, delta x since last event, delta y since last event)</li>
</ul>
<p> Each subinput has a different event registry.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:update"></a>
<strong>Input:update ()</strong>
</dt>
<dd>
Update the input and its children.
Should be called every frame, typically <em>after</em> you've done all your input handling
(otherwise <a href="../modules/input.html#Input:pressed">pressed</a> and <a href="../modules/input.html#Input:released">released</a> may never return true and <a href="../modules/input.html#Input:delta">delta</a> might be wrong).
(Note: this should not be called on subinputs)
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:clone"></a>
<strong>Input:clone ()</strong>
</dt>
<dd>
Create a new input object based on this input <a href="../modules/input.html#Input.config">config</a> data.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:reload"></a>
<strong>Input:reload ()</strong>
</dt>
<dd>
Relond the input <a href="../modules/input.html#Input.config">config</a>, and do the same for its children.
This will reenable the input if it was disabled using <a href="../modules/input.html#Input:disable">disable</a>.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:disable"></a>
<strong>Input:disable ()</strong>
</dt>
<dd>
Disable the input and its children, preventing further updates and events.
The input can be reenabled using <a href="../modules/input.html#Input:reload">reload</a>.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:onNextActiveSource"></a>
<strong>Input:onNextActiveSource (fn[, filter])</strong>
</dt>
<dd>
Will call fn(source) on the next activated source (including sources not currently used by this input).
Typically used to detect an input in your game input binding settings.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">fn</span>
function that will be called on the next activated source matching the filter
</li>
<li><span class="parameter">filter</span>
list of string patterns that sources must start with (example <code>{&quot;button&quot;, &quot;key&quot;}</code> to only get buttons and key sources)
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "Input:grab"></a>
<strong>Input:grab ()</strong>
</dt>
<dd>
Grab the input and its children input and returns the new subinput. </p>
<p> A grabbed input will no longer update and instead pass all new update to the subinput.
This is typically used for contextual action or pause menus: by grabbing the player input, all the direct use of
this input in the game will stop (can&rsquo;t move caracter, &hellip;) and instead you can use the subinput to handle input in the pause menu.
To stop grabbing an input, you will need to <code>:release</code> the subinput.</p>
<p> This will also reset the input to a neutral state. The subinput will share everything with this input, except
<a href="../modules/input.html#Input.grabbed">grabbed</a>, <a href="../modules/input.html#Input.grabbing">grabbing</a>, <a href="../modules/input.html#Input.event">event</a> (a new event registry is created), and of course its current state.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:release"></a>
<strong>Input:release ()</strong>
</dt>
<dd>
Release a subinput and its children.
The parent grabbed input will be updated again. This subinput will be reset to a neutral position and won&rsquo;t be updated further.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:neutralize"></a>
<strong>Input:neutralize ()</strong>
</dt>
<dd>
Set the state of this input to a neutral position (i.e. value = 0).
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:setJoystick"></a>
<strong>Input:setJoystick (joystick)</strong>
</dt>
<dd>
Set the joystick associated with this input.
The input will ignore every other joystick.
Set joystick to <code>nil</code> to disable and get input from every connected joystick.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">joystick</span>
LÖVE jostick object to associate
</li>
</ul>
</dd>
<dt>
<a name = "Input:getJoystick"></a>
<strong>Input:getJoystick ()</strong>
</dt>
<dd>
Returns the currently selected joystick.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:down"></a>
<strong>Input:down ()</strong>
</dt>
<dd>
Returns true if the input is currently down.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:pressed"></a>
<strong>Input:pressed ()</strong>
</dt>
<dd>
Returns true if the input has just been pressed.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:released"></a>
<strong>Input:released ()</strong>
</dt>
<dd>
Returns true if the input has just been released.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:value"></a>
<strong>Input:value ()</strong>
</dt>
<dd>
Returns the current value of the input.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:delta"></a>
<strong>Input:delta ()</strong>
</dt>
<dd>
Returns the delta value of the input since the last call to <a href="../modules/input.html#Input:update">update</a>.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:pointer"></a>
<strong>Input:pointer ()</strong>
</dt>
<dd>
If there is a horizontal and vertical children inputs, this returns the horizontal value and the vertical value.
Typically used for movement/axes pairs (e.g. to get x,y of a stick or directional pad).
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Input:clamped"></a>
<strong>Input:clamped ()</strong>
</dt>
<dd>
Same as <a href="../modules/input.html#Input:pointer">pointer</a>, but normalize the returned vector, i.e. &ldquo;clamp&rdquo; the returned x,y coordinates into a circle of radius 1.
Typically used to avoid faster movement on diagonals
(as if both horizontal and vertical values are 1, the pointer vector has √2 magnitude, higher than the 1 magnitude of a purely vertical or horizontal movement).
</ul>
</ul>
</ul>
</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 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View file

@ -50,6 +50,7 @@
<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/input.html">input</a></li>
<li><strong>ldtk</strong></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -68,15 +69,22 @@
<h1>Module <code>ldtk</code></h1>
<p><a href="https://ldtk.io/">LDtk</a> level importer for Lua and drawing using LÖVE.</p>
<p> Support most LDtk features, and allow easy usage in LÖVE projects.</p>
<p> Support most LDtk features, and allow easy usage in LÖVE projects.
In particular, this mainly focus only on features and values that are useful for showing the final level &ndash; this does not try, for example, to expose
every internal identfiers or intermediates values that are only relevant for editing.</p>
<p> Currently up-to-date with LDtk 1.1.3.</p>
<p> Every unit is in pixel in the API unless written otherwise.
Colors are reprsented as a table <code>{r,g,b}</code> where <code>r</code>,<code>b</code>,<code>g</code> in [0-1].</p>
<p> This modules returns a single function, <a href="../modules/ldtk.html#LDtk">LDtk</a>(path).</p>
<p> No mandatory dependency.
Optionally requires LÖVE <code>love.graphics</code> (drawing Image, SpriteBatch, Quad) for drawing only.</p>
<p> This modules requires <a href="https://github.com/rxi/json.lua">json.lua</a>; a copy of it is included with ubiquitousse in the <code>lib</code> directory for simplicity.
This module will first try to load a global module named <code>json</code> &ndash; so if you use the same json module in your project ubiquitousse will reuse it.
If it doesn&rsquo;t find it, it will then try to load the copy included with ubiquitousse.</p>
<p> Optionally requires LÖVE <code>love.graphics</code> (drawing Image, SpriteBatch, Quad), for drawing only.</p>
<h3>Usage:</h3>
<ul>
<pre class="example">local ldtk = require(&quot;ubiquitousse.ldtk&quot;)
@ -116,24 +124,28 @@ end
<td class="summary"><a href="../modules/ldtk.html#Layer_objects">Layer</a> this entity belongs to.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.iid">Entity.iid</a></td>
<td class="summary">Unique instance identifier for this entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.identifier">Entity.identifier</a></td>
<td class="summary">The entity name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.x">Entity.x</a></td>
<td class="summary">X position of the entity relative to the layer.</td>
<td class="summary">X position of the entity relative to the layer, in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.y">Entity.y</a></td>
<td class="summary">Y position of the entity relative to the layer.</td>
<td class="summary">Y position of the entity relative to the layer, in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.width">Entity.width</a></td>
<td class="summary">The entity width.</td>
<td class="summary">The entity width, in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.height">Entity.height</a></td>
<td class="summary">The entity height.</td>
<td class="summary">The entity height, in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.sx">Entity.sx</a></td>
@ -145,11 +157,11 @@ end
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.pivotX">Entity.pivotX</a></td>
<td class="summary">The entity pivot point x position relative to the entity.</td>
<td class="summary">The entity pivot point x position relative to the entity, in pixels..</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.pivotY">Entity.pivotY</a></td>
<td class="summary">The entity pivot point x position relative to the entity.</td>
<td class="summary">The entity pivot point x position relative to the entity, in pixels..</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.color">Entity.color</a></td>
@ -160,6 +172,10 @@ end
<td class="summary">Tile associated with the entity, if any.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.tags">Entity.tags</a></td>
<td class="summary">Tags associated with the entity: can be used either as a list of tags or a map of activated tags tags[name] == true.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity.fields">Entity.fields</a></td>
<td class="summary">Map of <a href="../modules/ldtk.html#CustomFields_objects">CustomFields</a> of the entity.</td>
</tr>
@ -174,6 +190,10 @@ end
<td class="name" nowrap><a href="#Tileset.image">Tileset.image</a></td>
<td class="summary">The tileset LÖVE image object.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Tileset.tags">Tileset.tags</a></td>
<td class="summary">Tags associated with the tileset: can be used either as a list of tags or a map of activated tags tags[name] == true.</td>
</tr>
</table>
<h2><a href="#Layer_objects">Layer objects </a></h2>
<table class="function_list">
@ -186,6 +206,10 @@ end
<td class="summary"><a href="../modules/ldtk.html#Level_objects">Level</a> this layer belongs to.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Layer.iid">Layer.iid</a></td>
<td class="summary">Unique instance identifier for this layer.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Layer.identifier">Layer.identifier</a></td>
<td class="summary">The layer name.</td>
</tr>
@ -226,6 +250,18 @@ end
<td class="summary">Height of the layer, in grid units.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Layer.parallaxFactorX">Layer.parallaxFactorX</a></td>
<td class="summary">Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Layer.parallaxFactorY">Layer.parallaxFactorY</a></td>
<td class="summary">Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Layer.parallaxScaling">Layer.parallaxScaling</a></td>
<td class="summary">If true, a layer with a parallax factor will also be scaled up/down accordingly.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Layer.entities">Layer.entities</a></td>
<td class="summary"><em>(Entities layer only)</em> List of <a href="../modules/ldtk.html#Entity_objects">Entity</a> in the layer.</td>
</tr>
@ -254,11 +290,11 @@ end
</tr>
<tr>
<td class="name" nowrap><a href="#Tile.x">Tile.x</a></td>
<td class="summary">X position of the tile relative to the layer.</td>
<td class="summary">X position of the tile relative to the layer, in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Tile.y">Tile.y</a></td>
<td class="summary">Y position of the tile relative to the layer.</td>
<td class="summary">Y position of the tile relative to the layer, in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Tile.flipX">Tile.flipX</a></td>
@ -289,11 +325,11 @@ end
</tr>
<tr>
<td class="name" nowrap><a href="#IntTile.x">IntTile.x</a></td>
<td class="summary">X position of the IntTile relative to the layer.</td>
<td class="summary">X position of the IntTile relative to the layer, in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#IntTile.y">IntTile.y</a></td>
<td class="summary">Y position of the IntTile relative to the layer.</td>
<td class="summary">Y position of the IntTile relative to the layer, in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#IntTile.identifier">IntTile.identifier</a></td>
@ -335,16 +371,24 @@ end
<td class="summary">Whether this level is currently loaded or not.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Level.iid">Level.iid</a></td>
<td class="summary">Unique instance identifier for this level.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Level.identifier">Level.identifier</a></td>
<td class="summary">The level name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Level.depth">Level.depth</a></td>
<td class="summary">Depth of the level in the world, to properly stack overlapping levels when drawing.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Level.x">Level.x</a></td>
<td class="summary">The level x position.</td>
<td class="summary">The level x position in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Level.y">Level.y</a></td>
<td class="summary">The level y position.</td>
<td class="summary">The level y position in pixels.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Level.width">Level.width</a></td>
@ -451,6 +495,27 @@ end
</dd>
<dt>
<a name = "Entity.iid"></a>
<strong>Entity.iid</strong>
</dt>
<dd>
Unique instance identifier for this entity.
</ul>
<h3>Type:</h3>
<ul>
<code>string</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Entity.identifier"></a>
@ -478,7 +543,7 @@ end
<strong>Entity.x</strong>
</dt>
<dd>
X position of the entity relative to the layer.
X position of the entity relative to the layer, in pixels.
</ul>
<h3>Type:</h3>
@ -499,7 +564,7 @@ end
<strong>Entity.y</strong>
</dt>
<dd>
Y position of the entity relative to the layer.
Y position of the entity relative to the layer, in pixels.
</ul>
<h3>Type:</h3>
@ -520,7 +585,7 @@ end
<strong>Entity.width</strong>
</dt>
<dd>
The entity width.
The entity width, in pixels.
</ul>
<h3>Type:</h3>
@ -541,7 +606,7 @@ end
<strong>Entity.height</strong>
</dt>
<dd>
The entity height.
The entity height, in pixels.
</ul>
<h3>Type:</h3>
@ -604,7 +669,7 @@ end
<strong>Entity.pivotX</strong>
</dt>
<dd>
The entity pivot point x position relative to the entity.
The entity pivot point x position relative to the entity, in pixels..
</ul>
<h3>Type:</h3>
@ -625,7 +690,7 @@ end
<strong>Entity.pivotY</strong>
</dt>
<dd>
The entity pivot point x position relative to the entity.
The entity pivot point x position relative to the entity, in pixels..
</ul>
<h3>Type:</h3>
@ -683,6 +748,27 @@ end
</dd>
<dt>
<a name = "Entity.tags"></a>
<strong>Entity.tags</strong>
</dt>
<dd>
Tags associated with the entity: can be used either as a list of tags or a map of activated tags tags[name] == true.
</ul>
<h3>Type:</h3>
<ul>
<code>{"tag",["tag"]=true,...}</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Entity.fields"></a>
@ -755,6 +841,27 @@ end
</dd>
<dt>
<a name = "Tileset.tags"></a>
<strong>Tileset.tags</strong>
</dt>
<dd>
Tags associated with the tileset: can be used either as a list of tags or a map of activated tags tags[name] == true.
</ul>
<h3>Type:</h3>
<ul>
<code>{"tag",["tag"]=true,...}</code>
</ul>
</ul>
</ul>
</dd>
</dl>
<h2 class="section-header has-description"><a name="Layer_objects"></a>Layer objects </h2>
@ -822,6 +929,27 @@ end
</dd>
<dt>
<a name = "Layer.iid"></a>
<strong>Layer.iid</strong>
</dt>
<dd>
Unique instance identifier for this layer.
</ul>
<h3>Type:</h3>
<ul>
<code>string</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Layer.identifier"></a>
@ -1032,6 +1160,69 @@ end
</dd>
<dt>
<a name = "Layer.parallaxFactorX"></a>
<strong>Layer.parallaxFactorX</strong>
</dt>
<dd>
Parallax horizontal factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect.
</ul>
<h3>Type:</h3>
<ul>
<code>number</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Layer.parallaxFactorY"></a>
<strong>Layer.parallaxFactorY</strong>
</dt>
<dd>
Parallax vertical factor (from -1 to 1, defaults to 0) which affects the scrolling speed of this layer, creating a fake 3D (parallax) effect.
</ul>
<h3>Type:</h3>
<ul>
<code>number</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Layer.parallaxScaling"></a>
<strong>Layer.parallaxScaling</strong>
</dt>
<dd>
If true, a layer with a parallax factor will also be scaled up/down accordingly.
</ul>
<h3>Type:</h3>
<ul>
<code>boolean</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Layer.entities"></a>
@ -1039,6 +1230,7 @@ end
</dt>
<dd>
<em>(Entities layer only)</em> List of <a href="../modules/ldtk.html#Entity_objects">Entity</a> in the layer.
Each entity in the list is also bound to its IID in this table, so if <code>ent = entities[1]</code>, you can also find it at <code>entities[ent.iid]</code>.
</ul>
<h3>Type:</h3>
@ -1182,7 +1374,7 @@ end
<strong>Tile.x</strong>
</dt>
<dd>
X position of the tile relative to the layer.
X position of the tile relative to the layer, in pixels.
</ul>
<h3>Type:</h3>
@ -1203,7 +1395,7 @@ end
<strong>Tile.y</strong>
</dt>
<dd>
Y position of the tile relative to the layer.
Y position of the tile relative to the layer, in pixels.
</ul>
<h3>Type:</h3>
@ -1362,7 +1554,7 @@ end
<strong>IntTile.x</strong>
</dt>
<dd>
X position of the IntTile relative to the layer.
X position of the IntTile relative to the layer, in pixels.
</ul>
<h3>Type:</h3>
@ -1383,7 +1575,7 @@ end
<strong>IntTile.y</strong>
</dt>
<dd>
Y position of the IntTile relative to the layer.
Y position of the IntTile relative to the layer, in pixels.
</ul>
<h3>Type:</h3>
@ -1673,6 +1865,27 @@ end
</dd>
<dt>
<a name = "Level.iid"></a>
<strong>Level.iid</strong>
</dt>
<dd>
Unique instance identifier for this level.
</ul>
<h3>Type:</h3>
<ul>
<code>string</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Level.identifier"></a>
@ -1694,13 +1907,35 @@ end
</dd>
<dt>
<a name = "Level.depth"></a>
<strong>Level.depth</strong>
</dt>
<dd>
Depth of the level in the world, to properly stack overlapping levels when drawing. Default is 0, greater means above, lower means below.
</ul>
<h3>Type:</h3>
<ul>
<code>number</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "Level.x"></a>
<strong>Level.x</strong>
</dt>
<dd>
The level x position.
The level x position in pixels.
For Horizontal and Vertical layouts, is always -1.
</ul>
<h3>Type:</h3>
@ -1721,7 +1956,8 @@ end
<strong>Level.y</strong>
</dt>
<dd>
The level y position.
The level y position in pixels.
For Horizontal and Vertical layouts, is always -1.
</ul>
<h3>Type:</h3>
@ -1806,6 +2042,7 @@ end
</dt>
<dd>
List of <a href="../modules/ldtk.html#Layer_objects">Layer</a>s in the level (table).
Each layer in the list is also bound to its IID in this table, so if <code>lay = layers[1]</code>, you can also find it at <code>layers[lay.iid]</code>.
</ul>
<h3>Type:</h3>
@ -1829,7 +2066,7 @@ end
Level background. </p>
<p> If there is a background image, <code>background.image</code> contains a table <code>{image=image, x=number, y=number, sx=number, sy=number}</code>
where <a href="../modules/ldtk.html#Tileset.image">image</a> is the LÖVE image (or image filepath if LÖVE not available) <a href="../modules/ldtk.html#Level.x">x</a> and <a href="../modules/ldtk.html#Level.y">y</a> are the top-left position,
where <a href="../modules/ldtk.html#Tileset.image">image</a> is the LÖVE image (or image filepath if LÖVE not available) <a href="../modules/ldtk.html#Entity.x">x</a> and <a href="../modules/ldtk.html#Tile.y">y</a> are the top-left position,
and <a href="../modules/ldtk.html#Entity.sx">sx</a> and <a href="../modules/ldtk.html#Entity.sy">sy</a> the horizontal and vertical scale factors.
</ul>
@ -1867,6 +2104,7 @@ end
</dt>
<dd>
List of <a href="../modules/ldtk.html#Level_objects">Level</a>s in this project.
Each level in the list is also bound to its IID in this table, so if <code>lvl = levels[1]</code>, you can also find it at <code>levels[lvl.iid]</code>.
</ul>
<h3>Type:</h3>
@ -1904,8 +2142,10 @@ end
<li>Enum are converted into a Lua string giving the currently selected enum value.</li>
<li>Filepath are converted into a Lua string giving the file path.</li>
<li>Arrays are converted into a Lua table with the elements in it as a list.</li>
<li>Points are converted into a Lua table with the fields <a href="../modules/ldtk.html#Level.x">x</a> and <a href="../modules/ldtk.html#Level.y">y</a>: <code>{ x=number, y=number }</code>.</li>
<li>Points are converted into a Lua table with the fields <a href="../modules/ldtk.html#Entity.x">x</a> and <a href="../modules/ldtk.html#Tile.y">y</a>, in pixels: <code>{ x=number, y=number }</code>.</li>
<li>Colors are converted into a Lua table with the red, green and blue components in [0-1] as a list: <code>{r,g,b}</code>.</li>
<li>Tiles are converted into a Lua table { tileset = associated tileset object, quad = associated quad } where <a href="../modules/ldtk.html#Tile.quad">quad</a> is a LÖVE Quad if LÖVE is available, otherwise a table <code>{ x, y, width, height }</code>.</li>
<li>EntityRef are converted into a Lua table { level = level, layerIid = layer IID, entityIid = entity IID, entity = see explanation }. If the entity being refernced belongs to another level and this level is not loaded, <code>entity</code> will be nil; otherwise (same level or the other level is also loaded), it will contain the entity.</li>
</ul>
@ -1930,7 +2170,7 @@ end
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -43,6 +43,7 @@
<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/input.html">input</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><strong>scene</strong></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -702,7 +703,7 @@
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -35,6 +35,7 @@
<ul>
<li><a href="#Module">Module </a></li>
<li><a href="#SignalRegistry_objects">SignalRegistry objects </a></li>
<li><a href="#SignalGroup_objects">SignalGroup objects </a></li>
</ul>
@ -43,6 +44,7 @@
<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/input.html">input</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>
@ -60,12 +62,31 @@
<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>
<p>Simple signal / observer pattern implementation for Lua.</p>
<p>No dependency.
Optional dependency: LÖVE to hook into LÖVE events.</p>
<p>The returned module also acts as a global <a href="../modules/signal.html#SignalRegistry_objects">SignalRegistry</a>, so you can call the <code>:bind</code>, <code>:emit</code>, etc. methods directly on the module
if you don&rsquo;t need to isolate your signals in separate registries.</p>
<h3>Usage:</h3>
<ul>
<pre class="example">TODO
<pre class="example">local signal = require(&quot;ubiquitousse.signal&quot;)
-- Bind a function to a &quot;hit&quot; signal
signal:bind(&quot;hit&quot;, function(enemy)
print(enemy..&quot; was hit!&quot;)
end)
-- Somewhere else in your code: will call every function bound to &quot;hit&quot; signal with &quot;invader&quot; argument
signal:emit(&quot;hit&quot;, &quot;invader&quot;)
-- We also provides a predefined SignalRegistry (signal.event) which emit signals on LÖVE callbacks
-- You can initialize it with:
signal.registerEvents()
signal.event:bind(&quot;update&quot;, function(dt) print(&quot;called every update&quot;) end)
signal.event:bind(&quot;keypressed&quot;, function(key, scancode) print(&quot;pressed key &quot;..key) end)
-- etc., for every LÖVE callback
</pre>
</ul>
@ -77,8 +98,12 @@
<td class="summary">Creates and return a new SignalRegistry.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#group">group ()</a></td>
<td class="summary">Creates and return a new SignalGroup.</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
<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 LÖVE events; other ubiquitousse modules may bind to this registry
if avaible.</td>
</tr>
<tr>
@ -93,29 +118,76 @@
<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>
<td class="name" nowrap><a href="#SignalRegistry.chained">SignalRegistry.chained</a></td>
<td class="summary">List of registries chained to this registry.</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>
<td class="name" nowrap><a href="#SignalRegistry:bind">SignalRegistry:bind (name, fn)</a></td>
<td class="summary">Bind a function to a signal name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:unbindAll">SignalRegistry:unbindAll (name)</a></td>
<td class="name" nowrap><a href="#SignalRegistry:has">SignalRegistry:has (name, fn)</a></td>
<td class="summary">Returns true if fn is bound to the signal.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:unbind">SignalRegistry:unbind (name, fn)</a></td>
<td class="summary">Unbind a function from a signal name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:unbindPattern">SignalRegistry:unbindPattern (pat, fn)</a></td>
<td class="summary">Unbind a function from every signal whose name match the pattern.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:clear">SignalRegistry:clear (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>
<td class="name" nowrap><a href="#SignalRegistry:clearPattern">SignalRegistry:clearPattern (pat)</a></td>
<td class="summary">Remove every bound function to every signal whose name match the pattern.</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>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:emitPattern">SignalRegistry:emitPattern (pat, ...)</a></td>
<td class="summary">Emit to every signal whose name match the pattern.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:chain">SignalRegistry:chain (registry)</a></td>
<td class="summary">Chain another regsitry to this registry.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalRegistry:unchain">SignalRegistry:unchain (registry)</a></td>
<td class="summary">Unchain a specific registry from the registry chaining list.</td>
</tr>
</table>
<h2><a href="#SignalGroup_objects">SignalGroup objects </a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#SignalGroup.paused">SignalGroup.paused</a></td>
<td class="summary">Indicate if the signal group if currently paused or not.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalGroup.binds">SignalGroup.binds</a></td>
<td class="summary">List of triplets in the group.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalGroup:bind">SignalGroup:bind (registry, name, fn)</a></td>
<td class="summary">Bind a function to a signal name in the given registry.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalGroup:clear">SignalGroup:clear ()</a></td>
<td class="summary">Remove every bound triplet in the group.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalGroup:pause">SignalGroup:pause ()</a></td>
<td class="summary">Pause the group.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#SignalGroup:resume">SignalGroup:resume ()</a></td>
<td class="summary">Resume the group.</td>
</tr>
</table>
<br/>
@ -149,27 +221,53 @@
</dd>
<dt>
<a name = "group"></a>
<strong>group ()</strong>
</dt>
<dd>
Creates and return a new SignalGroup.
</ul>
</ul>
</ul>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="../modules/signal.html#SignalGroup_objects">SignalGroup</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
<a href="../modules/signal.html#SignalRegistry_objects">SignalRegistry</a> which will be used to bind signals that need to be called on LÖVE events; 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>
<p> You will need to call <a href="../modules/signal.html#registerEvents">registerEvents</a> for the signal to be called on LÖVE callbacks automatically (otherwise you will have to emit the events
from the LÖVE callbacks manually).</p>
<p> List of signals available: &ldquo;displayrotated&rdquo;, &ldquo;draw&rdquo;, &ldquo;load&rdquo;, &ldquo;lowmemory&rdquo;, &ldquo;quit&rdquo;, &ldquo;update&rdquo;,
&ldquo;directorydropped&rdquo;, &ldquo;filedropped&rdquo;, &ldquo;focus&rdquo;, &ldquo;mousefocus&rdquo;, &ldquo;resize&rdquo;, &ldquo;visible&rdquo;,
&ldquo;keypressed&rdquo;, &ldquo;keyreleased&rdquo;, &ldquo;textedited&rdquo;, &ldquo;textinput&rdquo;,
&ldquo;mousemoved&rdquo;, &ldquo;mousepressed&rdquo;, &ldquo;mousereleased&rdquo;, &ldquo;wheelmoved&rdquo;,
&ldquo;gamepadaxis&rdquo;, &ldquo;gamepadpressed&rdquo;, &ldquo;gamepadreleased&rdquo;,
&ldquo;joystickadded&rdquo;, &ldquo;joystickaxis&rdquo;, &ldquo;joystickhat&rdquo;, &ldquo;joystickpressed&rdquo;, &ldquo;joystickreleased&rdquo;, &ldquo;joystickremoved&rdquo;,
&ldquo;touchmoved&rdquo;, &ldquo;touchpressed&rdquo;, &ldquo;touchreleased&rdquo;.
</ul>
<h3>Type:</h3>
@ -226,7 +324,28 @@
</ul>
<h3>Type:</h3>
<ul>
<code>{["name"]={fn,...}}</code>
<code>{["name"]={fn,[fn]=1,...}}</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "SignalRegistry.chained"></a>
<strong>SignalRegistry.chained</strong>
</dt>
<dd>
List of registries chained to this registry.
</ul>
<h3>Type:</h3>
<ul>
<code>{</code> registry, ... }
</ul>
</ul>
</ul>
@ -239,10 +358,10 @@
</dd>
<dt>
<a name = "SignalRegistry:bind"></a>
<strong>SignalRegistry:bind (name, fn, ...)</strong>
<strong>SignalRegistry:bind (name, fn)</strong>
</dt>
<dd>
Bind one or several functions to a signal name.
Bind a function to a signal name.
</ul>
</ul>
@ -259,9 +378,34 @@
<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
</ul>
</dd>
<dt>
<a name = "SignalRegistry:has"></a>
<strong>SignalRegistry:has (name, fn)</strong>
</dt>
<dd>
Returns true if fn is bound to the signal.
</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
</li>
</ul>
@ -272,10 +416,10 @@
</dd>
<dt>
<a name = "SignalRegistry:unbind"></a>
<strong>SignalRegistry:unbind (name, fn, ...)</strong>
<strong>SignalRegistry:unbind (name, fn)</strong>
</dt>
<dd>
Unbind one or several functions to a signal name.
Unbind a function from a signal name.
</ul>
</ul>
@ -292,9 +436,34 @@
<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
</ul>
</dd>
<dt>
<a name = "SignalRegistry:unbindPattern"></a>
<strong>SignalRegistry:unbindPattern (pat, fn)</strong>
</dt>
<dd>
Unbind a function from every signal whose name match the pattern.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">pat</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Lua pattern string
</li>
<li><span class="parameter">fn</span>
<span class="types"><span class="type">function</span></span>
the function to unbind to the signals
</li>
</ul>
@ -304,8 +473,8 @@
</dd>
<dt>
<a name = "SignalRegistry:unbindAll"></a>
<strong>SignalRegistry:unbindAll (name)</strong>
<a name = "SignalRegistry:clear"></a>
<strong>SignalRegistry:clear (name)</strong>
</dt>
<dd>
Remove every bound function to a signal name.
@ -329,11 +498,11 @@
</dd>
<dt>
<a name = "SignalRegistry:replace"></a>
<strong>SignalRegistry:replace (name, sourceFn, destFn)</strong>
<a name = "SignalRegistry:clearPattern"></a>
<strong>SignalRegistry:clearPattern (pat)</strong>
</dt>
<dd>
Replace a bound function with another function.
Remove every bound function to every signal whose name match the pattern.
</ul>
</ul>
@ -342,17 +511,9 @@
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<li><span class="parameter">pat</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
Lua string pattern
</li>
</ul>
@ -360,24 +521,6 @@
</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>
@ -406,6 +549,237 @@
</dd>
<dt>
<a name = "SignalRegistry:emitPattern"></a>
<strong>SignalRegistry:emitPattern (pat, ...)</strong>
</dt>
<dd>
Emit to every signal whose name match the pattern.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">pat</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Lua pattern string
</li>
<li><span class="parameter">...</span>
arguments to pass to the functions bound to each signal
</li>
</ul>
</dd>
<dt>
<a name = "SignalRegistry:chain"></a>
<strong>SignalRegistry:chain (registry)</strong>
</dt>
<dd>
Chain another regsitry to this registry.
I.e., after an event is emitted in this registry it will be automatically emitted in the other registry.
Several registries can be chained to a single registry.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">registry</span>
<span class="types"><a class="type" href="../modules/signal.html#SignalRegistry_objects">SignalRegistry</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "SignalRegistry:unchain"></a>
<strong>SignalRegistry:unchain (registry)</strong>
</dt>
<dd>
Unchain a specific registry from the registry chaining list.
Will error if the regsitry is not in the chaining list.
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">registry</span>
<span class="types"><a class="type" href="../modules/signal.html#SignalRegistry_objects">SignalRegistry</a></span>
</li>
</ul>
</dd>
</dl>
<h2 class="section-header has-description"><a name="SignalGroup_objects"></a>SignalGroup objects </h2>
<div class="section-description">
Signal group. </p>
<p> A SignalGroup is a list of (registry, signal name, function) triplets.
When the group is active, all of these triplets will bind the specified signal name to the specified function in the specified registry.
When the group is paused, all of these triplets are unbound.</p>
<p> This can be used to maintain a list of signal bindings where every one should be either disabled or enabled at the same time.
For example you may maintain a signal group of signals you want to be emitted when your game is running, and disabled when the game is paused
(like inputs, update, simulation step, etc. signals).
</div>
<dl class="function">
<dt>
<a name = "SignalGroup.paused"></a>
<strong>SignalGroup.paused</strong>
</dt>
<dd>
Indicate if the signal group if currently paused or not.
</ul>
<h3>Type:</h3>
<ul>
<code>boolean</code>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "SignalGroup.binds"></a>
<strong>SignalGroup.binds</strong>
</dt>
<dd>
List of triplets in the group.
</ul>
<h3>Type:</h3>
<ul>
<code>{</code> {registry, "signal name", function}, ... }
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "SignalGroup:bind"></a>
<strong>SignalGroup:bind (registry, name, fn)</strong>
</dt>
<dd>
Bind a function to a signal name in the given registry.
This handles binding the function on its own; you do not need to call <a href="../modules/signal.html#SignalRegistry:bind">SignalRegistry:bind</a> manually.
If the group is paused, this will not bind the function immediately but only on the next time this group is resumed (as expected).
</ul>
</ul>
</ul>
</ul>
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">registry</span>
<span class="types"><a class="type" href="../modules/signal.html#SignalRegistry_objects">SignalRegistry</a></span>
to bind the signal in
</li>
<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>
</ul>
</dd>
<dt>
<a name = "SignalGroup:clear"></a>
<strong>SignalGroup:clear ()</strong>
</dt>
<dd>
Remove every bound triplet in the group.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "SignalGroup:pause"></a>
<strong>SignalGroup:pause ()</strong>
</dt>
<dd>
Pause the group.
The signals bound to this group will be disabled in their given registries.
</ul>
</ul>
</ul>
</ul>
</dd>
<dt>
<a name = "SignalGroup:resume"></a>
<strong>SignalGroup:resume ()</strong>
</dt>
<dd>
Resume the group.
The signals bound to this group will be enabled in their given registries.
</ul>
</ul>
</ul>
</ul>
</dd>
</dl>
@ -414,7 +788,7 @@
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -45,6 +45,7 @@
<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/input.html">input</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -1153,7 +1154,7 @@
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -42,6 +42,7 @@
<li><strong>ubiquitousse</strong></li>
<li><a href="../modules/asset.html">asset</a></li>
<li><a href="../modules/ecs.html">ecs</a></li>
<li><a href="../modules/input.html">input</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -141,6 +142,10 @@ the repository to save you a few seconds.</p>
<td class="summary">LDtk level import, if available.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#gltf">gltf</a></td>
<td class="summary">glTF model import, if available.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scene">scene</a></td>
<td class="summary">Scene management, if available.</td>
</tr>
@ -233,7 +238,7 @@ the repository to save you a few seconds.</p>
</dt>
<dd>
Input management, if available.
TODO: not currently generated with LDoc.
TODO: documentation not currently generated with LDoc.
</ul>
</ul>
@ -245,7 +250,7 @@ the repository to save you a few seconds.</p>
<h3>See also:</h3>
<ul>
<a href="../modules/ubiquitousse.html#input">input</a>
<a href="../modules/input.html#">input</a>
</ul>
@ -271,6 +276,29 @@ the repository to save you a few seconds.</p>
</ul>
</dd>
<dt>
<a name = "gltf"></a>
<strong>gltf</strong>
</dt>
<dd>
glTF model import, if available.
TODO: documentation not currently generated with LDoc.
</ul>
</ul>
</ul>
</ul>
<h3>See also:</h3>
<ul>
<a href="../modules/ubiquitousse.html#gltf">gltf</a>
</ul>
</dd>
<dt>
<a name = "scene"></a>
@ -367,7 +395,7 @@ the repository to save you a few seconds.</p>
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -42,6 +42,7 @@
<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/input.html">input</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -784,7 +785,7 @@
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -43,6 +43,7 @@
<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/input.html">input</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -54,7 +55,7 @@
<div id="content">
Copyright 2021 Étienne &ldquo;Reuh&rdquo; Fildadut</p>
Copyright 2016-2022 Étienne &ldquo;Reuh&rdquo; Fildadut</p>
<p>Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.</p>
@ -64,7 +65,7 @@
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -43,6 +43,7 @@
<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/input.html">input</a></li>
<li><a href="../modules/ldtk.html">ldtk</a></li>
<li><a href="../modules/scene.html">scene</a></li>
<li><a href="../modules/signal.html">signal</a></li>
@ -56,7 +57,22 @@
<h1>ubiquitousse</h1>
<p>Set of various libraries I use for game development, mainly with LÖVE. Nothing that hasn&rsquo;t been done before, but these are tailored to what I need. They can be used independently too.</p>
<p>Set of various libraries I use for game development, mainly with LÖVE. Most of which has already been done before, but these are tailored to what I need. They can be used independently too (you should be able to only pick the directories of the libraries you need; some modules depends on each other though, see documentation for details).</p>
<p>This provides, sorting the one with the fewest existing alterative as far as I know first:</p>
<ul>
<li><a href="../modules/ldtk.html#">ldtk</a> provides a <a href="https://ldtk.io/">LDtk</a> level importer</li>
<li><code>gltf</code> provides a <a href="https://www.khronos.org/gltf/">glTF</a> model loader</li>
<li><a href="../modules/ecs.html#">ecs</a> provides <a href="https://en.wikipedia.org/wiki/Entity_component_system">ECS</a> facilities</li>
<li><a href="../modules/input.html#">input</a> provides input management facilities</li>
<li><a href="../modules/timer.html#">timer</a> provides time management facilities</li>
<li><a href="../modules/signal.html#">signal</a> provides a simple signal / observer pattern implementation</li>
<li><a href="../modules/asset.html#">asset</a> provides barebones asset loading facilities</li>
<li><a href="../modules/scene.html#">scene</a> provides some scene management facilities</li>
<li><a href="../modules/util.html#">util</a> provides some random, occasionally useful functions</li>
</ul>
<p>You can find the documentation <a href="https://reuh.github.io/ubiquitousse/index.html">here</a> or in the <code>docs/</code> directory.</p>
@ -64,14 +80,14 @@
<p>Whatever is currently on the master branch should be working and usable. Changelog, including breaking changes, are documented in commit messages.</p>
<p>Licensed under ISC (equivalent to MIT/Expat/Simplified BSD).</p>
<p>Licensed under ISC (equivalent to MIT/Expat/Simplified BSD). Have fun.</p>
</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 17:22:39 </i>
<i style="float:right;">Last updated 2022-09-16 20:07:07 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>