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.
Files changed (51) hide show
  1. package/FAQ.md +841 -815
  2. package/README.md +211 -199
  3. package/dist/littlejs.d.ts +4383 -812
  4. package/dist/littlejs.esm.js +31848 -16680
  5. package/dist/littlejs.esm.min.js +14 -1
  6. package/dist/littlejs.js +31230 -16166
  7. package/dist/littlejs.min.js +13 -1
  8. package/dist/littlejs.release.js +27419 -15457
  9. package/package.json +10 -5
  10. package/plugins/audioEffects.js +375 -0
  11. package/plugins/box2d.js +2516 -2073
  12. package/plugins/drawUtilities.js +206 -31
  13. package/plugins/gltf.js +740 -0
  14. package/plugins/jsconfig.json +19 -0
  15. package/plugins/lightSystem.js +719 -330
  16. package/plugins/math3d.js +911 -0
  17. package/plugins/medalSystem.js +118 -72
  18. package/plugins/newgrounds.js +400 -199
  19. package/plugins/pathFinder.js +208 -175
  20. package/plugins/pluginExport.js +196 -115
  21. package/plugins/postProcess.js +284 -166
  22. package/plugins/render3d.js +4072 -0
  23. package/plugins/render3dDebug.js +109 -0
  24. package/plugins/render3dExtras.js +1754 -0
  25. package/plugins/render3dVoxels.js +502 -0
  26. package/plugins/textureSheet.js +86 -48
  27. package/plugins/threejs.js +183 -158
  28. package/plugins/tweakables.js +411 -0
  29. package/plugins/tweenSystem.js +646 -526
  30. package/plugins/uiSystem.js +2024 -1687
  31. package/plugins/zzfxm.js +8 -15
  32. package/src/engine.js +345 -194
  33. package/src/engineAudio.js +1022 -777
  34. package/src/engineBuild.mjs +289 -253
  35. package/src/engineDebug.js +912 -735
  36. package/src/engineDraw.js +1774 -1510
  37. package/src/engineEditor.js +2431 -0
  38. package/src/engineExport.js +419 -396
  39. package/src/engineInput.js +1462 -1293
  40. package/src/engineLogo.js +4 -3
  41. package/src/engineMath.js +1274 -1183
  42. package/src/engineObject.js +674 -551
  43. package/src/engineParticles.js +583 -532
  44. package/src/engineRelease.js +67 -45
  45. package/src/engineSettings.js +808 -726
  46. package/src/engineTileLayer.js +995 -741
  47. package/src/engineUtilities.js +32 -13
  48. package/src/engineWebGL.js +1162 -941
  49. package/src/jsconfig.json +17 -13
  50. package/plugins/box2d.wasm.js +0 -630
  51. 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 Music(
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.play();
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
- this.randomness = 0;
51
- this.sampleChannels = zzfxM(...zzfxMusic);
52
- this.sampleRate = audioDefaultSampleRate;
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
  ///////////////////////////////////////////////////////////////////////////////