Skip to content

Commit

Permalink
fix: docs from not building
Browse files Browse the repository at this point in the history
  • Loading branch information
doubleactii committed Nov 14, 2024
1 parent 90a2f71 commit 4addbdc
Show file tree
Hide file tree
Showing 13 changed files with 57,808 additions and 27,918 deletions.
23,228 changes: 23,228 additions & 0 deletions docs/ast/source/layer.mjs.json

Large diffs are not rendered by default.

60,365 changes: 32,688 additions & 27,677 deletions docs/ast/source/parallax.mjs.json

Large diffs are not rendered by default.

752 changes: 752 additions & 0 deletions docs/class/src/layer.mjs~Layer.html

Large diffs are not rendered by default.

264 changes: 218 additions & 46 deletions docs/class/src/parallax.mjs~ParallaxSingleton.html

Large diffs are not rendered by default.

214 changes: 214 additions & 0 deletions docs/file/src/layer.mjs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../">
<title data-ice="title">src/layer.mjs | Parallax</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="A parallax module that will enable effortless integration of depth effects into your game."><meta property="twitter:card" content="summary"><meta property="twitter:title" content="Parallax"><meta property="twitter:description" content="A parallax module that will enable effortless integration of depth effects into your game."><meta property="twitter:image" content="./evitcastudio_round_branding.png"></head>
<body class="layout-container" data-ice="rootContainer">

<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.png" style="width:34px;"></a>

<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>

<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/EvitcaStudio/Parallax"><img width="20px" src="./image/github.png"></a></header>

<nav class="navigation" data-ice="nav"><div>
<ul>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/layer.mjs~Layer.html">Layer</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/parallax.mjs~ParallaxSingleton.html">ParallaxSingleton</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-Parallax">Parallax</a></span></span></li>
</ul>
</div>
</nav>

<div class="content" data-ice="content"><h1 data-ice="title">src/layer.mjs</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import { Parallax } from &apos;./parallax.mjs&apos;;

export class Layer {
/**
* The configuration object of this layer.
* @private
* @type {Object}
* @param {number} horizontalSpeed - The horizontal speed of the layer.
* @param {number} verticalSpeed - The vertical speed of the layer.
* @param {number} plane - The plane this parallax layer will occupy.
* @param {Diob[] | MapObject[]} backgrounds - An array of instances that will serve as the background. These are automatically toggled to repeat.
* @param {Set} instances - A set of instances currently on the layer.
*/
config = {
// Move the instance with the camera if the parallax is set to 0
horizontalSpeed: 0,
verticalSpeed: 0,
plane: 1,
backgrounds: new Set(),
instances: new Set()
}
/**
* Creates a new Parallax layer with the supplied configuration.
* When creating a layer, all instances and backgrounds should already be on the map.
* @param {Object} pConfig - The configuration of the parallax layer.
* @prop {number} pConfig.horizontalSpeed - The horizontal speed of the layer.
* @prop {number} pConfig.verticalSpeed - The vertical speed of the layer.
* @prop {number} pConfig.plane - The plane this layer will occupy.
* @param {Diob[] | MapObject[]} pConfig.backgrounds - An array of instances that will serve as the background. These are automatically toggled to repeat.
* @prop {Diob[] | MapObject[]} pConfig.instances - The instances that will be added to the layer.
*/
constructor(pConfig) {
this.updateConfigSpeed(pConfig, true);

if (!typeof pConfig.plane === &apos;number&apos;) {
Parallax.logger.prefix(&apos;Parallax-Module&apos;).warn(&apos;Expected a number for &quot;pConfig.plane&quot;, but received:&apos;, typeof pConfig.plane, &apos;\n Default plane of &quot;1&quot; used.&apos;);
} else {
this.config.plane = pConfig.plane;
}

const instanceConfig = {
x: this.config.horizontalSpeed,
y: this.config.verticalSpeed
}

if (Array.isArray(pConfig.instances)) {
pConfig.instances.forEach(pInstance =&gt; {
pInstance.plane = this.config.plane;
this.add(pInstance, instanceConfig)
});
}

if (Array.isArray(pConfig.backgrounds)) {
// Backgrounds automatically loop
instanceConfig.loop = true;
pConfig.backgrounds.forEach(pInstance =&gt; {
pInstance.plane = this.config.plane;
this.add(pInstance, instanceConfig)
});
}
}
/**
* Updates the configuration speed of the layer.
* @param {Object} pConfig - The speed configuration of the parallax layer.
* @prop {number} pConfig.horizontalSpeed - The horizontal speed of the layer.
* @prop {number} pConfig.verticalSpeed - The vertical speed of the layer.
* @param {boolean} pUpdateLayerConfigOnly - If only to update the layer config and not the instance config.
*/
updateConfigSpeed(pConfig, pUpdateLayerConfigOnly) {
this.updateHorizontalSpeed(pConfig.horizontalSpeed, pUpdateLayerConfigOnly);
this.updateVerticalSpeed(pConfig.verticalSpeed, pUpdateLayerConfigOnly);
}
/**
* Updates the horizontal speed of this layer.
* @param {number} pHorizontalSpeed - The new horizontal speed.
* @param {boolean} pUpdateLayerConfigOnly - If only to update the layer config and not the instance config.
*/
updateHorizontalSpeed(pHorizontalSpeed, pUpdateLayerConfigOnly) {
const inValidHorizontal = pHorizontalSpeed &amp;&amp; typeof pHorizontalSpeed !== &apos;number&apos;;

if (inValidHorizontal) {
Parallax.logger.prefix(&apos;Parallax-Module&apos;).warn(&apos;Expected a number for &quot;pHorizontalSpeed&quot;, but received:&apos;, typeof pHorizontalSpeed);
return
}

this.config.horizontalSpeed = pHorizontalSpeed;

if (!pUpdateLayerConfigOnly) {
const update = (pInstance) =&gt; {
const parallaxInfo = Parallax.instanceWeakMap.get(pInstance);
parallaxInfo.x = pVerticalSpeed;
}

this.instances.forEach(pInstance =&gt; {
update(pInstance);
});
this.backgrounds.forEach(pInstance =&gt; {
update(pInstance);
});
}
}
/**
* Updates the vertical speed of the layer.
* @param {number} pVerticalSpeed - The new vertical speed.
* @param {boolean} pUpdateLayerConfigOnly - If only to update the layer config and not the instance config.
*/
updateVerticalSpeed(pVerticalSpeed, pUpdateLayerConfigOnly) {
const inValidVertical = pVerticalSpeed &amp;&amp; typeof pVerticalSpeed !== &apos;number&apos;;

if (inValidVertical) {
Parallax.logger.prefix(&apos;Parallax-Module&apos;).warn(&apos;Expected a number for &quot;pVerticalSpeed&quot;, but received:&apos;, typeof pVerticalSpeed);
return
}

this.config.verticalSpeed = pVerticalSpeed;

if (!pUpdateLayerConfigOnly) {
const update = (pInstance) =&gt; {
const parallaxInfo = Parallax.instanceWeakMap.get(pInstance);
parallaxInfo.y = pVerticalSpeed;
}

this.instances.forEach(pInstance =&gt; {
update(pInstance);
});
this.backgrounds.forEach(pInstance =&gt; {
update(pInstance);
});
}
}
/**
* Adds the instance to the parallax layer.
* When using this API the instance should already be on the map.
* @param {Diob} pInstance - The instance to add to the layer.
* @param {Object} pConfig - The personal config of this instance. Akin to the parallax info passed via the `Parallax.add` API.
* @prop {number} pConfig.x - The horizontal speed of this instance. (This will be ignored and the layer&apos;s speed will be used.)
* @prop {number} pConfig.y - The vertical speed of this instance. (This will be ignored and the layer&apos;s speed will be used.)
* @prop {boolean} pConfig.loop - Whether this instance will be treated as a background and loop seamlessly.
*/
add(pInstance, pConfig) {
if (this.config.instances.has(pInstance)) return;
this.config.instances.add(pInstance);
const config = pConfig
? pConfig
: {
x: this.config.horizontalSpeed,
y: this.config.verticalSpeed
}
Parallax.add(pInstance, config);
}
/**
* Removes the instance from the parallax layer.
* @param {Diob} pInstance - The instance to remove from the layer.
*/
remove(pInstance) {
this.config.instances.delete(pInstance);
Parallax.remove(pInstance);
}
}</code></pre>

</div>

<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>

<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
Loading

0 comments on commit 4addbdc

Please sign in to comment.