p5.raycaster
Version:
a simple p5js library for semi 3d rendering with ray casting
1,023 lines (243 loc) • 12.1 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: KeyboardControl</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: KeyboardControl</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>KeyboardControl<span class="signature">(keyMap<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="KeyboardControl"><span class="type-signature"></span>new KeyboardControl<span class="signature">(keyMap<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>keyMap</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
KeyboardControl.defaultKeyMap
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="KeyboardControl.js.html">KeyboardControl.js</a>, <a href="KeyboardControl.js.html#line36">line 36</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="addItem"><span class="type-signature"></span>addItem<span class="signature">(name, keyList, toggle<span class="signature-attributes">opt</span>, initValue<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
add a new keyboard control item
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>keyList</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>toggle</code></td>
<td class="type">
<span class="param-type">undefined</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">when the value should be toggled, "down" or "up", undefined means it is not a toggle value</td>
</tr>
<tr>
<td class="name"><code>initValue</code></td>
<td class="type">
<span class="param-type">undefined</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">the default value when no keyboard input</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="KeyboardControl.js.html">KeyboardControl.js</a>, <a href="KeyboardControl.js.html#line119">line 119</a>
</li></ul></dd>
</dl>
<h4 class="name" id="keyDown"><span class="type-signature"></span>keyDown<span class="signature">(ev)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ev</code></td>
<td class="type">
<span class="param-type">KeyboardEvent</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="KeyboardControl.js.html">KeyboardControl.js</a>, <a href="KeyboardControl.js.html#line64">line 64</a>
</li></ul></dd>
</dl>
<h4 class="name" id="keyUp"><span class="type-signature"></span>keyUp<span class="signature">(ev)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ev</code></td>
<td class="type">
<span class="param-type">KeyboardEvent</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="KeyboardControl.js.html">KeyboardControl.js</a>, <a href="KeyboardControl.js.html#line86">line 86</a>
</li></ul></dd>
</dl>
<h4 class="name" id="loadKeyMap"><span class="type-signature"></span>loadKeyMap<span class="signature">(keyMap)</span><span class="type-signature"></span></h4>
<div class="description">
this function will not copy the object
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>keyMap</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="KeyboardControl.js.html">KeyboardControl.js</a>, <a href="KeyboardControl.js.html#line108">line 108</a>
</li></ul></dd>
</dl>
<h4 class="name" id="removeItem"><span class="type-signature"></span>removeItem<span class="signature">(name)</span><span class="type-signature"></span></h4>
<div class="description">
delete a keyboard control item
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="KeyboardControl.js.html">KeyboardControl.js</a>, <a href="KeyboardControl.js.html#line132">line 132</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Camera.html">Camera</a></li><li><a href="KeyboardControl.html">KeyboardControl</a></li><li><a href="MouseControl.html">MouseControl</a></li><li><a href="PointerLockControl.html">PointerLockControl</a></li><li><a href="Sprite.html">Sprite</a></li><li><a href="TransparentWall.html">TransparentWall</a></li><li><a href="Util.html">Util</a></li><li><a href="World.html">World</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createCamera">createCamera</a></li><li><a href="global.html#createSkyBox">createSkyBox</a></li><li><a href="global.html#createSprite">createSprite</a></li><li><a href="global.html#createTextureMap">createTextureMap</a></li><li><a href="global.html#createWorld">createWorld</a></li><li><a href="global.html#initKeyboardControl">initKeyboardControl</a></li><li><a href="global.html#initMouseControl">initMouseControl</a></li><li><a href="global.html#initPointerLockControl">initPointerLockControl</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Thu Feb 01 2024 12:26:09 GMT+0000 (Greenwich Mean Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>