littlejsengine 1.18.24 β†’ 1.18.26

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/README.md CHANGED
@@ -23,6 +23,8 @@ The code is very clean and well documented with many examples to get you started
23
23
 
24
24
  *The Third Annual LittleJS Game Jam will take place From Oct 2 to Nov 2! Unleash your creativity and develop amazing games using the LittleJS game engine.*
25
25
 
26
+ ### πŸ˜ΌπŸ‘ [LittleJS + JS13k](https://github.com/KilledByAPixel/LittleJS/tree/js13k) - We made a special branch designed for size coding events like JS13k.
27
+
26
28
  <div align='center' markdown='1'>
27
29
 
28
30
  ## [Demos](https://killedbyapixel.github.io/LittleJS/examples) | [Arcade](https://killedbyapixel.github.io/LittleJSArcade) | [Docs](https://killedbyapixel.github.io/LittleJS/docs) | [FAQ](https://github.com/KilledByAPixel/LittleJS/blob/main/FAQ.md) | [Trailer](https://youtu.be/chuBzGjv7Ms) | [Discord](https://discord.gg/zb7hcGkyZe)
@@ -38,6 +40,7 @@ The code is very clean and well documented with many examples to get you started
38
40
  - Blazing fast WebGL2 + Canvas2D hybrid rendering system
39
41
  - Apply [Shadertoy](https://www.shadertoy.com) style shaders for post-processing effects
40
42
  - Robust particle effect system and [effect design tool](https://killedbyapixel.github.io/LittleJS/examples/particles/)
43
+ - Load sprites and animations into texture sheets at runtime, or import [TexturePacker](https://www.codeandweb.com/texturepacker) and [Aseprite](https://www.aseprite.org) atlases
41
44
  - Optional 3D rendering with the [Three.js](https://threejs.org) plugin
42
45
 
43
46
  ### πŸ”Š Audio
@@ -146,6 +146,17 @@ declare module "littlejsengine" {
146
146
  * );
147
147
  * @memberof Engine */
148
148
  export function engineInit(gameInit: GameInitCallback, gameUpdate: GameCallback, gameUpdatePost: GameCallback, gameRender: GameCallback, gameRenderPost: GameCallback, imageSources?: Array<string>, rootElement?: HTMLElement): Promise<void>;
149
+ /** Advance the engine by a number of frames
150
+ * Requires setEngineManualStep(true) before engineInit
151
+ * Respects paused exactly as the normal update loop does
152
+ * @param {number} [frames] - number of engine update ticks, max 36000, each running one fixed update at timeScale 1
153
+ * @example
154
+ * setHeadlessMode(true);
155
+ * setEngineManualStep(true);
156
+ * await engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost);
157
+ * engineStep(600); // advance 10 seconds of game time
158
+ * @memberof Engine */
159
+ export function engineStep(frames?: number): void;
149
160
  /** Update each engine object, remove destroyed objects, and update time
150
161
  * can be called manually if objects need to be updated outside of main loop
151
162
  * @memberof Engine */
@@ -417,6 +428,12 @@ declare module "littlejsengine" {
417
428
  * @default
418
429
  * @memberof Settings */
419
430
  export let headlessMode: boolean;
431
+ /** Disables the automatic requestAnimationFrame loop so the engine only
432
+ * advances when engineStep is called, for tests and frame-stepping tools
433
+ * @type {boolean}
434
+ * @default
435
+ * @memberof Settings */
436
+ export let engineManualStep: boolean;
420
437
  /** Default size of tiles in pixels
421
438
  * @type {Vector2}
422
439
  * @default Vector2(16,16)
@@ -690,6 +707,11 @@ declare module "littlejsengine" {
690
707
  * @param {boolean} headless
691
708
  * @memberof Settings */
692
709
  export function setHeadlessMode(headless: boolean): void;
710
+ /** Set if the engine only advances when engineStep is called
711
+ * Must be set before engineInit
712
+ * @param {boolean} [enable]
713
+ * @memberof Settings */
714
+ export function setEngineManualStep(enable?: boolean): void;
693
715
  /** Set if WebGL rendering is enabled
694
716
  * @param {boolean} enable
695
717
  * @memberof Settings */
@@ -1087,7 +1109,7 @@ declare module "littlejsengine" {
1087
1109
  export function shareURL(title: string, url: string, callback?: Function): void;
1088
1110
  /** Read save data from local storage
1089
1111
  * @param {string} saveName - unique name for the game/save
1090
- * @param {Object} [defaultSaveData] - default values for save
1112
+ * @param {Object} [defaultSaveData] - default values, result is {...default, ...loaded} so this must be an object
1091
1113
  * @return {Object}
1092
1114
  * @memberof Utilities */
1093
1115
  export function readSaveData(saveName: string, defaultSaveData?: any): any;