littlejsengine 1.18.29 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FAQ.md +841 -815
- package/README.md +211 -199
- package/dist/littlejs.d.ts +4383 -812
- package/dist/littlejs.esm.js +31848 -16680
- package/dist/littlejs.esm.min.js +14 -1
- package/dist/littlejs.js +31230 -16166
- package/dist/littlejs.min.js +13 -1
- package/dist/littlejs.release.js +27419 -15457
- package/package.json +10 -5
- package/plugins/audioEffects.js +375 -0
- package/plugins/box2d.js +2516 -2073
- package/plugins/drawUtilities.js +206 -31
- package/plugins/gltf.js +740 -0
- package/plugins/jsconfig.json +19 -0
- package/plugins/lightSystem.js +719 -330
- package/plugins/math3d.js +911 -0
- package/plugins/medalSystem.js +118 -72
- package/plugins/newgrounds.js +400 -199
- package/plugins/pathFinder.js +208 -175
- package/plugins/pluginExport.js +196 -115
- package/plugins/postProcess.js +284 -166
- package/plugins/render3d.js +4072 -0
- package/plugins/render3dDebug.js +109 -0
- package/plugins/render3dExtras.js +1754 -0
- package/plugins/render3dVoxels.js +502 -0
- package/plugins/textureSheet.js +86 -48
- package/plugins/threejs.js +183 -158
- package/plugins/tweakables.js +411 -0
- package/plugins/tweenSystem.js +646 -526
- package/plugins/uiSystem.js +2024 -1687
- package/plugins/zzfxm.js +8 -15
- package/src/engine.js +345 -194
- package/src/engineAudio.js +1022 -777
- package/src/engineBuild.mjs +289 -253
- package/src/engineDebug.js +912 -735
- package/src/engineDraw.js +1774 -1510
- package/src/engineEditor.js +2431 -0
- package/src/engineExport.js +419 -396
- package/src/engineInput.js +1462 -1293
- package/src/engineLogo.js +4 -3
- package/src/engineMath.js +1274 -1183
- package/src/engineObject.js +674 -551
- package/src/engineParticles.js +583 -532
- package/src/engineRelease.js +67 -45
- package/src/engineSettings.js +808 -726
- package/src/engineTileLayer.js +995 -741
- package/src/engineUtilities.js +32 -13
- package/src/engineWebGL.js +1162 -941
- package/src/jsconfig.json +17 -13
- package/plugins/box2d.wasm.js +0 -630
- package/plugins/box2d.wasm.wasm +0 -0
package/plugins/zzfxm.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @memberof ZzFXM
|
|
14
14
|
* @example
|
|
15
15
|
* // create some music
|
|
16
|
-
* const music_example = new
|
|
16
|
+
* const music_example = new ZzFXMusic(
|
|
17
17
|
* [
|
|
18
18
|
* [ // instruments
|
|
19
19
|
* [,0,400] // simple note
|
|
@@ -34,31 +34,24 @@
|
|
|
34
34
|
* 90 // BPM
|
|
35
35
|
* ]);
|
|
36
36
|
*
|
|
37
|
-
* // play the music
|
|
38
|
-
* music_example.
|
|
37
|
+
* // play the music on a loop
|
|
38
|
+
* music_example.playMusic();
|
|
39
39
|
*/
|
|
40
40
|
class ZzFXMusic extends Sound
|
|
41
41
|
{
|
|
42
42
|
/** Create a music object and cache the zzfx music samples for later use
|
|
43
|
-
* @param {[Array, Array, Array, number]} zzfxMusic - Array of zzfx music parameters
|
|
43
|
+
* @param {[Array, Array, Array, number?, ...any[]]} zzfxMusic - Array of zzfx music parameters: instruments, patterns, sequence, and an optional BPM; anything after it, like the tracker's metadata, is ignored
|
|
44
44
|
*/
|
|
45
45
|
constructor(zzfxMusic)
|
|
46
46
|
{
|
|
47
47
|
super(undefined);
|
|
48
48
|
|
|
49
49
|
if (!soundEnable || headlessMode) return;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.
|
|
50
|
+
const [instruments, patterns, sequence, BPM] = zzfxMusic;
|
|
51
|
+
super.sampleChannels = zzfxM(instruments, patterns, sequence, BPM); // the setter, without declaring a field that hides it in the typings
|
|
52
|
+
this.buildSampleBuffer(); // hand the samples to an audio buffer now, like a zzfx sound, so the arrays are released
|
|
53
|
+
this.loadedPercent = 1; // generated in place, so it is loaded like a zzfx sound
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
/** Play the music that loops by default
|
|
56
|
-
* @param {number} [volume] - Volume to play the music at
|
|
57
|
-
* @param {boolean} [loop] - Should the music loop?
|
|
58
|
-
* @return {SoundInstance} - The sound instance
|
|
59
|
-
*/
|
|
60
|
-
playMusic(volume=1, loop=true)
|
|
61
|
-
{ return super.play(undefined, volume, 1, 0, loop); }
|
|
62
55
|
}
|
|
63
56
|
|
|
64
57
|
///////////////////////////////////////////////////////////////////////////////
|