angry-pixel 2.1.2 → 2.1.4

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/lib/index.d.ts CHANGED
@@ -27,7 +27,9 @@ declare class Container {
27
27
  has(name: DependencyName): boolean;
28
28
  }
29
29
  /**
30
- * Decorator to identify a class as an injectable dependency
30
+ * Decorator to mark a class as an injectable dependency that can be managed by the IoC container.\
31
+ * Injectable classes can be automatically instantiated and have their dependencies resolved when requested through the container.\
32
+ * This enables dependency injection and inversion of control.
31
33
  * @param name the name to identify the dependency
32
34
  * @public
33
35
  * @category Decorators
@@ -39,7 +41,8 @@ declare class Container {
39
41
  */
40
42
  declare function injectable(name: DependencyName): (target: DependencyType) => void;
41
43
  /**
42
- * Decorator to identify a property, or constructor argument, as a dependency to be injected
44
+ * Decorator to mark a property or constructor parameter as a dependency that should be automatically injected by the IoC container.\
45
+ * When applied to a property or constructor parameter, the container will resolve and inject the specified dependency at runtime.
43
46
  * @param name the name to identify the dependency
44
47
  * @public
45
48
  * @category Decorators
@@ -63,7 +66,10 @@ declare function injectable(name: DependencyName): (target: DependencyType) => v
63
66
  declare function inject(name: DependencyName): (target: any, propertyKey?: PropertyKey, parameterIndex?: number) => void;
64
67
 
65
68
  /**
66
- * Represents a 2D vector and provides static methods for vector calculations.
69
+ * Represents a two-dimensional vector with x and y components.\
70
+ * Provides static methods for common vector operations
71
+ * like addition, subtraction, scaling, dot product, cross product, normalization and more.\
72
+ * Used throughout the engine for storing 2D positions, directions, velocities and other vector quantities.
67
73
  * @category Math
68
74
  * @public
69
75
  * @example
@@ -305,9 +311,33 @@ declare class Vector2 {
305
311
  }
306
312
 
307
313
  /**
308
- * Represents an axis aligned rectangle
314
+ * Represents an axis-aligned bounding rectangle (AABR) defined by position, width and height.
315
+ * The position represents the bottom-left corner of the rectangle.\
316
+ * Provides methods and properties for manipulating and querying the rectangle's geometry.
309
317
  * @category Math
310
318
  * @public
319
+ * @example
320
+ * ```js
321
+ * const rect = new Rectangle(0, 0, 100, 100);
322
+ * rect.width // 100
323
+ * rect.height // 100
324
+ *
325
+ * rect.x // 0
326
+ * rect.y // 0
327
+ *
328
+ * rect.x1 // 100
329
+ * rect.y1 // 100
330
+ *
331
+ * rect.center // { x: 50, y: 50 }
332
+ *
333
+ * rect.intersects(new Rectangle(50, 50, 100, 100)) // true
334
+ *
335
+ * rect.contains(new Vector2(50, 50)) // true
336
+ *
337
+ * rect.contains(new Rectangle(100, 100, 100, 100)) // false
338
+ *
339
+ * rect.toString() // "(0, 0, 100, 100)"
340
+ * ```
311
341
  */
312
342
  declare class Rectangle {
313
343
  width: number;
@@ -371,7 +401,9 @@ declare class Rectangle {
371
401
  }
372
402
 
373
403
  /**
374
- * Clamps the given value between the given minimum and maximum values.
404
+ * Constrains a number to be within a specified range by clamping it between a minimum and maximum value.\
405
+ * If the value is less than the minimum, returns the minimum. If greater than the maximum, returns the maximum.\
406
+ * Otherwise returns the original value unchanged.
375
407
  * @category Math
376
408
  * @public
377
409
  * @param value number to clamp
@@ -386,7 +418,8 @@ declare class Rectangle {
386
418
  */
387
419
  declare const clamp: (value: number, min: number, max: number) => number;
388
420
  /**
389
- * Returns a random integer number between the given minimum and maximum values.
421
+ * Returns a random integer number between the given minimum (inclusive) and maximum (inclusive) values.\
422
+ * Uses Math.random() internally to generate the random number, then rounds and scales it to fit the desired range.
390
423
  * @category Math
391
424
  * @public
392
425
  * @param min min value
@@ -399,7 +432,8 @@ declare const clamp: (value: number, min: number, max: number) => number;
399
432
  */
400
433
  declare const randomInt: (min: number, max: number) => number;
401
434
  /**
402
- * Returns a random float number between the given minimum and maximum values.
435
+ * Returns a random floating point number between the given minimum (inclusive) and maximum (inclusive) values.\
436
+ * Uses Math.random() internally to generate the random number and can be rounded to a specified number of decimal places.
403
437
  * @category Math
404
438
  * @public
405
439
  * @param min min value
@@ -413,7 +447,9 @@ declare const randomInt: (min: number, max: number) => number;
413
447
  */
414
448
  declare const randomFloat: (min: number, max: number, decimals?: number) => number;
415
449
  /**
416
- * Corrects a floating number to a given number of decimal places.
450
+ * Rounds a floating point number to a specified number of decimal places.\
451
+ * Uses Math.round() internally to avoid floating point precision errors that can occur with direct decimal arithmetic.\
452
+ * For example, 5.2345 rounded to 2 decimal places becomes 5.23.
417
453
  * @category Math
418
454
  * @public
419
455
  * @param value the value to round
@@ -426,7 +462,9 @@ declare const randomFloat: (min: number, max: number, decimals?: number) => numb
426
462
  */
427
463
  declare const fixedRound: (value: number, decimals: number) => number;
428
464
  /**
429
- * Generate an array with a range of numbers.
465
+ * Generates an array containing a sequence of numbers from start to end (inclusive) with optional step size.\
466
+ * For example, range(0,5) produces [0,1,2,3,4,5] and range(0,10,2) produces [0,2,4,6,8,10].\
467
+ * Useful for creating numeric sequences and iteration ranges.
430
468
  * @category Math
431
469
  * @public
432
470
  * @param start the starting value
@@ -441,7 +479,9 @@ declare const fixedRound: (value: number, decimals: number) => number;
441
479
  */
442
480
  declare const range: (start: number, end: number, steps?: number) => number[];
443
481
  /**
444
- * Evaluates whether the given value is between the minimum and the maximum (both inclusive).
482
+ * Checks if a number falls within a specified range (inclusive of both minimum and maximum bounds).\
483
+ * Returns true if the value is greater than or equal to the minimum and less than or equal to the maximum.\
484
+ * Useful for range checking, input validation, and boundary testing.
445
485
  * @category Math
446
486
  * @public
447
487
  * @param value number to compare
@@ -456,7 +496,8 @@ declare const range: (start: number, end: number, steps?: number) => number[];
456
496
  */
457
497
  declare const between: (value: number, min: number, max: number) => boolean;
458
498
  /**
459
- * Converts the given radians to degrees.
499
+ * Converts an angle from radians to degrees by multiplying by (180/π).\
500
+ * Useful for converting between angular measurement systems and displaying angles in a more human-readable format.
460
501
  * @param radians
461
502
  * @returns degrees
462
503
  * @category Math
@@ -468,7 +509,8 @@ declare const between: (value: number, min: number, max: number) => boolean;
468
509
  */
469
510
  declare const radiansToDegrees: (radians: number) => number;
470
511
  /**
471
- * Converts the given degrees to radians.
512
+ * Converts an angle from degrees to radians by multiplying by (π/180).\
513
+ * Useful for converting between angular measurement systems and performing trigonometric calculations.
472
514
  * @param degrees
473
515
  * @returns radians
474
516
  * @category Math
@@ -480,7 +522,9 @@ declare const radiansToDegrees: (radians: number) => number;
480
522
  */
481
523
  declare const degreesToRadians: (degrees: number) => number;
482
524
  /**
483
- * Convert RGB to HEX as string
525
+ * Converts RGB color values to a hexadecimal color string.\
526
+ * Takes red, green and blue color components (0-255) and returns a hex color code.\
527
+ * Useful for converting between color formats and generating color strings for CSS/HTML.
484
528
  * @param rgb
485
529
  * @param prefix default is "#"
486
530
  * @returns string
@@ -569,7 +613,16 @@ declare enum BroadPhaseMethods {
569
613
  }
570
614
 
571
615
  /**
572
- * Contains information about the collision
616
+ * Contains detailed information about a collision between two shapes, including the penetration depth
617
+ * and direction vector. Used to determine how to resolve and separate colliding objects.
618
+ * @example
619
+ * ```typescript
620
+ * // Example collision resolution between two shapes
621
+ * const resolution: CollisionResolution = {
622
+ * penetration: 5, // Shapes overlap by 5 pixels
623
+ * direction: new Vector2(1, 0) // Collision along X axis
624
+ * };
625
+ * ```
573
626
  * @public
574
627
  * @category Collisions
575
628
  */
@@ -599,7 +652,8 @@ declare enum CollisionMethods {
599
652
  }
600
653
 
601
654
  /**
602
- * Interface implemented by the collider components
655
+ * Interface defining a collider component that handles collision detection and physics interactions.
656
+ * Colliders define shapes, layers, and physics properties for game objects that can collide.
603
657
  * @public
604
658
  * @category Collisions
605
659
  */
@@ -617,29 +671,48 @@ interface Collider {
617
671
  }
618
672
 
619
673
  /**
620
- * This type an unique identifier of an Entity
674
+ * This type represents a unique numeric identifier for an Entity in the ECS system
621
675
  * @public
622
676
  * @category Entity-Component-System
623
677
  */
624
678
  type Entity = number;
625
679
  /**
626
- * This type represents an instance of a component
680
+ * This type represents an instance of a component in the ECS system.\
681
+ * Components are data containers that can be attached to entities\
682
+ * to define their properties and state.\
683
+ * They are implemented as plain objects with key-value pairs.
627
684
  * @public
628
685
  * @category Entity-Component-System
686
+ * @example
687
+ * ```typescript
688
+ * class PlayerComponent {
689
+ * health: number;
690
+ * speed: number;
691
+ * }
692
+ * ```
629
693
  */
630
- type Component = {
631
- [key: string]: any;
632
- };
694
+ type Component = Record<string, any>;
633
695
  /**
634
- * This type represents a component class
696
+ * This type represents a constructor function for creating component instances.\
697
+ * Component classes define the structure and behavior of components that can be attached to entities.\
698
+ * They serve as templates/factories for creating component instances with consistent properties and methods.
635
699
  * @public
636
700
  * @category Entity-Component-System
701
+ * @example
702
+ * ```typescript
703
+ * class PlayerComponent {
704
+ * health: number;
705
+ * speed: number;
706
+ * }
707
+ * ```
637
708
  */
638
709
  type ComponentType<T extends Component = Component> = {
639
710
  new (...args: any[]): T;
640
711
  };
641
712
  /**
642
- * This type represents a search result object
713
+ * This type represents a search result object containing an entity and its matching component.\
714
+ * Used when searching for entities with specific components and criteria.\
715
+ * The generic type T extends Component to provide type safety for the returned component.
643
716
  * @public
644
717
  * @category Entity-Component-System
645
718
  */
@@ -648,35 +721,57 @@ type SearchResult<T extends Component> = {
648
721
  component: T;
649
722
  };
650
723
  /**
651
- * This type represents a search criteria object
652
- * @public
653
- * @category Entity-Component-System
654
- */
655
- type SearchCriteria = {
656
- [key: string]: any;
657
- };
658
- /**
659
- * This type represents an Entity Archetype
724
+ * This type represents an Entity Archetype, which defines a template for creating entities with a specific set of components.\
725
+ * It specifies which components should be attached to the entity, whether the entity should be enabled/disabled,\
726
+ * and can include child archetypes to create hierarchical entity structures.
660
727
  * @public
661
728
  * @category Entity-Component-System
729
+ * @example
730
+ * ```typescript
731
+ * // Define an archetype for a player entity with multiple components
732
+ * const playerArchetype: Archetype = {
733
+ * components: [
734
+ * new Transform({position: new Vector2(0, 0)}),
735
+ * new Player({health: 100}),
736
+ * new SpriteRenderer({sprite: 'player.png'})
737
+ * ],
738
+ * };
739
+ *
740
+ * // Define an archetype with disabled components and child entities
741
+ * const enemyArchetype: Archetype = {
742
+ * components: [
743
+ * new Transform(),
744
+ * new Enemy(),
745
+ * disableComponent(new BoxCollider()) // This component starts disabled
746
+ * ],
747
+ * children: [
748
+ * {
749
+ * components: [new WeaponMount()],
750
+ * enabled: false // This child entity starts disabled
751
+ * }
752
+ * ],
753
+ * };
754
+ * ```
662
755
  */
663
756
  type Archetype = {
664
- components: (ArchetypeComponent | Component)[];
757
+ components: (Component | ComponentType | DisabledComponent)[];
665
758
  children?: Archetype[];
666
759
  enabled?: boolean;
667
760
  };
668
761
  /**
669
- * This type represents an Entity Archetype Component
762
+ * This type represents a disabled component
670
763
  * @public
671
764
  * @category Entity-Component-System
672
765
  */
673
- type ArchetypeComponent<T extends Component = Component> = {
674
- type: ComponentType<T>;
675
- data?: Partial<T>;
676
- enabled?: boolean;
766
+ type DisabledComponent = {
767
+ enabled: false;
768
+ component: Component | ComponentType;
677
769
  };
678
770
  /**
679
- * This interface is used for the creation of system classes. You will have to inject the dependencies you need manully.
771
+ * This interface defines the core structure for system classes in the ECS architecture.\
772
+ * Systems contain the game logic that operates on entities and their components.\
773
+ * Dependencies like EntityManager can be injected using dependency injection decorators.\
774
+ * Systems must implement onUpdate() and can optionally implement lifecycle hooks like onCreate(), onDestroy(), onEnabled() and onDisabled().
680
775
  * @public
681
776
  * @category Entity-Component-System
682
777
  * @example
@@ -720,7 +815,9 @@ interface System {
720
815
  onUpdate(): void;
721
816
  }
722
817
  /**
723
- * This type represents a system class
818
+ * This type represents a constructor type for System classes.\
819
+ * It defines the shape of a class that can be instantiated to create System objects.\
820
+ * Used for type-safe system registration and retrieval in the SystemManager.
724
821
  * @public
725
822
  * @category Entity-Component-System
726
823
  */
@@ -731,10 +828,58 @@ type SystemType<T extends System = System> = {
731
828
  type SystemGroup = string | number | symbol;
732
829
 
733
830
  /**
734
- * The EntityManager manages the entities and components.\
735
- * It provides the necessary methods for reading and writing entities and components.
831
+ * The EntityManager is responsible for managing the lifecycle and relationships of entities and components.\
832
+ * It provides methods for creating, reading, updating and deleting entities and their associated components.\
833
+ * Handles parent-child relationships between entities and enables/disables entities and components.\
834
+ * Acts as the central registry for all game objects and their behaviors.
736
835
  * @public
737
836
  * @category Entity-Component-System
837
+ * @example
838
+ * ```js
839
+ * // Create an entity with components
840
+ * const entity = entityManager.createEntity([
841
+ * new Transform({position: new Vector2(100, 100)}),
842
+ * new SpriteRenderer({sprite: "player.png"})
843
+ * ]);
844
+ *
845
+ * // Get a component from an entity
846
+ * const transform = entityManager.getComponent(entity, Transform);
847
+ *
848
+ * // Get all components from an entity
849
+ * const components = entityManager.getComponents(entity);
850
+ *
851
+ * // Find entity by component
852
+ * const entityWithSprite = entityManager.getEntityForComponent(spriteRenderer);
853
+ *
854
+ * // Update component data
855
+ * entityManager.updateComponentData(entity, Transform, (component) => {
856
+ * component.position = new Vector2(200, 200);
857
+ * });
858
+ *
859
+ * // Create parent-child relationship
860
+ * const child = entityManager.createEntity([Transform], parent);
861
+ * // or if you already have the child entity
862
+ * entityManager.setParent(child, parent);
863
+ *
864
+ * // Enable/disable entities
865
+ * entityManager.disableEntity(entity);
866
+ * entityManager.enableEntity(entity);
867
+ *
868
+ * // Remove components
869
+ * entityManager.removeComponent(entity, SpriteRenderer);
870
+ * entityManager.removeComponent(spriteRenderer);
871
+ *
872
+ * // Search for entities with specific components
873
+ * const searchResult = entityManager.search(SpriteRenderer);
874
+ * searchResult.forEach(({component, entity}) => {
875
+ * // do something with the component and entity
876
+ * })
877
+ *
878
+ * const searchResult = entityManager.search(Enemy, (component) => component.status === "alive");
879
+ * searchResult.forEach(({component, entity}) => {
880
+ * // do something with the component and entity
881
+ * })
882
+ * ```
738
883
  */
739
884
  declare class EntityManager {
740
885
  private lastEntityId;
@@ -757,85 +902,10 @@ declare class EntityManager {
757
902
  */
758
903
  createEntity(): Entity;
759
904
  /**
760
- * Creates an Entity based on an Archetype
761
- * @param archetype The Archetype to create the Entity
762
- * @return The created Entity
763
- * @public
764
- * @example
765
- * ```js
766
- * // Using ArchetypeComponent to define components
767
- * const entity = entityManager.createEntity({
768
- * components: [
769
- * {type: Transform, data: {position: new Vector2(100, 100)}},
770
- * {type: SpriteRenderer, data: {image: "images/player.png"}},
771
- * {type: Player},
772
- * ],
773
- * children: [
774
- * {
775
- * components: [
776
- * {type: Transform, data: {position: new Vector2(8, 0)}},
777
- * {type: SpriteRenderer, data: {image: "images/sword.png"}},
778
- * {type: Weapon, data: {damage: 10}},
779
- * ],
780
- * },
781
- * {
782
- * components: [
783
- * {type: Transform, data: {position: new Vector2(-8, 0)}},
784
- * {type: SpriteRenderer, data: {image: "images/shield.png"}},
785
- * {type: Shield, data: {defense: 5}, enabled: false},
786
- * ],
787
- * },
788
- * {
789
- * components: [
790
- * {type: Transform, data: {position: new Vector2(8, 0)}},
791
- * {type: SpriteRenderer, data: {image: "images/staf.png"}},
792
- * {type: Staff, data: {mana: 5}},
793
- * ],
794
- * enabled: false,
795
- * }
796
- * ]
797
- * });
798
- * ```
799
- * @example
800
- * ```js
801
- * // Using Component instances as templates
802
- * const entity = entityManager.createEntity({
803
- * components: [
804
- * new Transform({position: new Vector2(100, 100)}),
805
- * new SpriteRenderer({image: "images/player.png"}),
806
- * new Player(),
807
- * ],
808
- * children: [
809
- * {
810
- * components: [
811
- * new Transform({position: new Vector2(8, 0)}),
812
- * new SpriteRenderer({image: "images/sword.png"}),
813
- * new Weapon({damage: 10}),
814
- * ],
815
- * },
816
- * {
817
- * components: [
818
- * new Transform({position: new Vector2(-8, 0)}),
819
- * new SpriteRenderer({image: "images/shield.png"}),
820
- * new Shield({defense: 5}),
821
- * ],
822
- * },
823
- * {
824
- * components: [
825
- * new Transform({position: new Vector2(8, 0)}),
826
- * new SpriteRenderer({image: "images/staf.png"}),
827
- * new Staff({mana: 5}),
828
- * ],
829
- * enabled: false,
830
- * }
831
- * ]
832
- * });
833
- * ```
834
- */
835
- createEntity(archetype: Archetype): Entity;
836
- /**
837
- * Creates an Entity based on a collection of Component instances and ComponentTypes
905
+ * Creates an Entity with the given components.\
906
+ * Since the components are not cloned, the collection of components must not be reused.
838
907
  * @param components A collection of component instances and component classes
908
+ * @param parent The parent entity (optional)
839
909
  * @return The created Entity
840
910
  * @public
841
911
  * @example
@@ -846,32 +916,35 @@ declare class EntityManager {
846
916
  * ]);
847
917
  * ```
848
918
  */
849
- createEntity(components: Array<ComponentType | Component>, parent?: Entity): Entity;
850
- private createEntityFromComponents;
851
- private createEntityFromArchetype;
919
+ createEntity(components: (ComponentType | Component)[], parent?: Entity): Entity;
852
920
  /**
853
- * Creates multiple entities based on an array of component collections
854
- * @param componentsList An array of collections of component instances and component classes
855
- * @return An array with the created entities, in the same order of the collections of components
921
+ * Creates an Entity based on an Archetype.\
922
+ * Since the components are cloned, the archetype can be reused to create multiple entities.
923
+ * @param archetype The archetype to create the entity from
924
+ * @param parent The parent entity (optional)
925
+ * @returns The created Entity
856
926
  * @public
857
927
  * @example
858
928
  * ```js
859
- * const player = [
860
- * new Transform({position: new Vector2(100, 100)}),
861
- * SpriteRenderer,
862
- * Player
863
- * ];
864
- *
865
- * const enemy = [
866
- * new Transform({position: new Vector2(-100, 100)}),
867
- * SpriteRenderer,
868
- * Enemy
869
- * ];
870
- *
871
- * const entities = entityManager.createEntities([player, enemy]);
929
+ * const archetype = {
930
+ * components: [
931
+ * new Transform({position: new Vector2(100, 100)}),
932
+ * SpriteRenderer
933
+ * ],
934
+ * children: [childArchetype],
935
+ * enabled: true
936
+ * }
937
+ * const entity = entityManager.createEntityFromArchetype(archetype);
872
938
  * ```
873
939
  */
874
- createEntities(componentsList: Array<ComponentType | Component>[]): Entity[];
940
+ createEntityFromArchetype({ components, children, enabled }: Archetype, parent?: Entity): Entity;
941
+ /**
942
+ * Creates components from an archetype
943
+ * @param components The components to create
944
+ * @param entity The entity to create the components for
945
+ * @private
946
+ */
947
+ private createComponentsFromArchetype;
875
948
  /**
876
949
  * Removes an Entity and all its Components
877
950
  * @param entity The entity to remove
@@ -1074,6 +1147,20 @@ declare class EntityManager {
1074
1147
  * ```
1075
1148
  */
1076
1149
  getComponents(entity: Entity): Component[];
1150
+ /**
1151
+ * Updates the data of a component instance
1152
+ * @param entity The entity
1153
+ * @param componentType The component type
1154
+ * @param updateCallback The callback to update the component
1155
+ * @public
1156
+ * @example
1157
+ * ```js
1158
+ * entityManager.updateComponentData(entity, Transform, (component) => {
1159
+ * component.position = new Vector2(100, 100);
1160
+ * });
1161
+ * ```
1162
+ */
1163
+ updateComponentData<T extends Component = Component>(entity: Entity, componentType: ComponentType<T>, updateCallback: (component: T) => void): void;
1077
1164
  /**
1078
1165
  * Searches for and returns an entity for the component instance
1079
1166
  * @param component The component instance
@@ -1186,10 +1273,10 @@ declare class EntityManager {
1186
1273
  /**
1187
1274
  * Performs a search for entities given a component type.\
1188
1275
  * This method returns a collection of objects of type SearchResult, which has the entity found, and the instance of the component.\
1189
- * This search can be filtered by passing as a second argument an instance of SearchCriteria, which performs a match between the attributes of the component and the given value.\
1276
+ * This search can be filtered by passing as a second argument a filter function.\
1190
1277
  * The third argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
1191
1278
  * @param componentType The component class
1192
- * @param criteria The search criteria
1279
+ * @param filter The filter function
1193
1280
  * @param includeDisabled TRUE to incluide disabled entities and components, FALSE otherwise
1194
1281
  * @returns SearchResult
1195
1282
  * @public
@@ -1202,20 +1289,21 @@ declare class EntityManager {
1202
1289
  * ```
1203
1290
  * @example
1204
1291
  * ```js
1205
- * const searchResult = entityManager.search(Enemy, {status: "alive"});
1292
+ * const searchResult = entityManager.search(Enemy, (component) => component.status === "alive");
1206
1293
  * searchResult.forEach(({component, entity}) => {
1207
1294
  * // do something with the component and entity
1208
1295
  * })
1209
1296
  * ```
1210
1297
  * @example
1211
1298
  * ```js
1212
- * const searchResult = entityManager.search(Enemy, {status: "dead"}, true);
1299
+ * // include disabled entities and components
1300
+ * const searchResult = entityManager.search(Enemy, (component) => component.status === "dead", true);
1213
1301
  * searchResult.forEach(({component, entity}) => {
1214
1302
  * // do something with the component and entity
1215
1303
  * })
1216
1304
  * ```
1217
1305
  */
1218
- search<T extends Component>(componentType: ComponentType<T>, criteria?: SearchCriteria, includeDisabled?: boolean): SearchResult<T>[];
1306
+ search<T extends Component>(componentType: ComponentType<T>, filter?: (component: T, entity?: Entity) => boolean, includeDisabled?: boolean): SearchResult<T>[];
1219
1307
  /**
1220
1308
  * Performs a search for entities given a component type.\
1221
1309
  * This method returns a collection of objects of type SearchResult, which has the entity found, and the instance of the component.\
@@ -1233,6 +1321,7 @@ declare class EntityManager {
1233
1321
  * ```
1234
1322
  * @example
1235
1323
  * ```js
1324
+ * // include disabled entities and components
1236
1325
  * const searchResult = entityManager.search(Enemy, true);
1237
1326
  * searchResult.forEach(({component, entity}) => {
1238
1327
  * // do something with the component and entity
@@ -1282,8 +1371,10 @@ declare class EntityManager {
1282
1371
  }
1283
1372
 
1284
1373
  /**
1285
- * The SystemManager manages the systems.\
1286
- * It provides the necessary methods for reading and writing systems.
1374
+ * The SystemManager is responsible for managing the lifecycle and execution of game systems.\
1375
+ * It provides methods for adding, enabling, disabling and retrieving systems that operate on entities and components.\
1376
+ * Systems are organized into groups to control their execution order and update frequency.\
1377
+ * Acts as the central orchestrator for all game logic and behavior processing.
1287
1378
  * @public
1288
1379
  * @category Entity-Component-System
1289
1380
  */
@@ -1376,7 +1467,35 @@ declare class SystemManager {
1376
1467
  }
1377
1468
 
1378
1469
  /**
1379
- * Represent a collision. It contains the colliders involved, the entities, and the resolution data.
1470
+ * Creates a disabled component
1471
+ * @param component The component to disable
1472
+ * @returns The disabled component
1473
+ * @category Entity-Component-System
1474
+ * @public
1475
+ * @example
1476
+ * ```js
1477
+ * const disabledTransform = disableComponent(Transform);
1478
+ * ```
1479
+ */
1480
+ declare const disableComponent: (component: Component | ComponentType) => DisabledComponent;
1481
+
1482
+ /**
1483
+ * Represents a collision between two entities in the game world. It contains information about the colliding entities,
1484
+ * their collider components, and resolution data for handling the collision response.
1485
+ * @example
1486
+ * ```typescript
1487
+ * // Example collision between player and enemy
1488
+ * const collision: Collision = {
1489
+ * localEntity: playerEntity,
1490
+ * localCollider: playerCollider,
1491
+ * remoteEntity: enemyEntity,
1492
+ * remoteCollider: enemyCollider,
1493
+ * resolution: {
1494
+ * normal: new Vector2(1, 0),
1495
+ * depth: 5
1496
+ * }
1497
+ * };
1498
+ * ```
1380
1499
  * @category Collisions
1381
1500
  * @public
1382
1501
  */
@@ -1409,9 +1528,25 @@ interface Collision {
1409
1528
  }
1410
1529
 
1411
1530
  /**
1412
- * The CollisionRepository has the necessary methods to perform queries on the current collisions
1531
+ * The CollisionRepository stores and manages collision data between colliders.
1532
+ * It provides methods for querying collisions by collider and layer,
1533
+ * and handles persisting/removing collision records.
1413
1534
  * @public
1414
1535
  * @category Collisions
1536
+ * @example
1537
+ * ```typescript
1538
+ * // Get all collisions for a collider
1539
+ * const collisions = collisionRepository.findCollisionsForCollider(playerCollider);
1540
+ *
1541
+ * // Get collisions between player and enemies
1542
+ * const enemyCollisions = collisionRepository.findCollisionsForColliderAndLayer(
1543
+ * playerCollider,
1544
+ * "enemy"
1545
+ * );
1546
+ *
1547
+ * // Get all current collisions
1548
+ * const allCollisions = collisionRepository.findAll();
1549
+ * ```
1415
1550
  */
1416
1551
  declare class CollisionRepository {
1417
1552
  private collisions;
@@ -1448,7 +1583,10 @@ declare class CollisionRepository {
1448
1583
  type CollisionMatrix = [string, string][];
1449
1584
 
1450
1585
  /**
1451
- * Game configuration options
1586
+ * Configuration options for initializing and customizing game behavior.
1587
+ * Includes settings for canvas dimensions, debug visualization, physics simulation,
1588
+ * collision detection, and dependency injection.\
1589
+ * Required for creating a new Game instance.
1452
1590
  * @public
1453
1591
  * @category Config
1454
1592
  * @example
@@ -1524,7 +1662,9 @@ declare class CreateSystemService {
1524
1662
  }
1525
1663
 
1526
1664
  /**
1527
- * Manages the asset loading (images, fonts, audios, videos).
1665
+ * Manages loading and retrieval of game assets including images, fonts, audio files, videos and JSON data.\
1666
+ * Provides methods to load assets asynchronously and check their loading status.\
1667
+ * Assets can be referenced by URL or optional name identifiers.
1528
1668
  * @public
1529
1669
  * @category Managers
1530
1670
  * @example
@@ -1533,12 +1673,14 @@ declare class CreateSystemService {
1533
1673
  * this.assetManager.loadAudio("audio.ogg");
1534
1674
  * this.assetManager.loadVideo("video.mp4");
1535
1675
  * this.assetManager.loadFont("custom-font", "custom-font.ttf");
1676
+ * this.assetManager.loadJson("data.json");
1536
1677
  *
1537
1678
  * const imageElement = this.assetManager.getImage("image.png");
1538
1679
  * const audioElement = this.assetManager.getAudio("audio.ogg");
1539
1680
  * const videoElement = this.assetManager.getVideo("video.mp4");
1540
1681
  * const fontFace = this.assetManager.getFont("custom-font");
1541
- *
1682
+ * const jsonData = this.assetManager.getJson("data.json");
1683
+
1542
1684
  * if (this.assetManager.getAssetsLoaded()) {
1543
1685
  * // do something when assets are loaded
1544
1686
  * }
@@ -1645,18 +1787,37 @@ declare class AssetManager {
1645
1787
  }
1646
1788
 
1647
1789
  /**
1648
- * Options for setting an interval.
1790
+ * Options for configuring an interval timer.
1791
+ * @property {Function} callback - The function to execute at each interval
1792
+ * @property {number} delay - The time in milliseconds between each execution
1793
+ * @property {number} [times] - Optional number of times to execute before auto-clearing. Omit for infinite execution.
1794
+ * @property {boolean} [executeImmediately] - Whether to execute the callback immediately before starting the interval timer
1649
1795
  * @public
1650
1796
  * @category Managers
1797
+ * @example
1798
+ * ```ts
1799
+ * const intervalId = timeManager.setInterval({
1800
+ * callback: () => console.log("Will be called 5 times!"),
1801
+ * delay: 1000,
1802
+ * times: 5,
1803
+ * });
1804
+ * ```
1651
1805
  */
1652
1806
  type IntervalOptions = {
1807
+ /** The function to execute at each interval */
1653
1808
  callback: () => void;
1809
+ /** The time in milliseconds between each execution */
1654
1810
  delay: number;
1811
+ /** Optional number of times to execute before auto-clearing. Omit for infinite execution. */
1655
1812
  times?: number;
1813
+ /** Whether to execute the callback immediately before starting the interval timer */
1656
1814
  executeImmediately?: boolean;
1657
1815
  };
1658
1816
  /**
1659
- * Manages the properties associated with time.
1817
+ * Manages the properties associated with time.\
1818
+ * Provides methods to set intervals, clear intervals, and manage time scaling.\
1819
+ * Manages the fixed game framerate and physics framerate.\
1820
+ * Manages the fixed game delta time and physics delta time.
1660
1821
  * @public
1661
1822
  * @category Managers
1662
1823
  * @example
@@ -1784,13 +1945,17 @@ declare class TimeManager {
1784
1945
  /**
1785
1946
  * This type represents a scene class
1786
1947
  * @public
1787
- * @category Core
1948
+ * @category Managers
1788
1949
  */
1789
1950
  type SceneType<T extends Scene = Scene> = {
1790
1951
  new (entityManager: EntityManager, assetManager: AssetManager): T;
1791
1952
  };
1792
1953
  /**
1793
- * Base class for all game scenes
1954
+ * Base class for all game scenes.\
1955
+ * Provides core functionality for loading assets, registering systems, and setting up entities.\
1956
+ * Scenes are the main organizational unit for game states and levels.\
1957
+ * Each scene has access to the EntityManager for creating/managing entities and the AssetManager
1958
+ * for loading and accessing game resources.
1794
1959
  * @public
1795
1960
  * @category Core
1796
1961
  * @example
@@ -1826,7 +1991,9 @@ declare abstract class Scene {
1826
1991
  setup(): void;
1827
1992
  }
1828
1993
  /**
1829
- * Manges the loading of the scenes.
1994
+ * Manages scene loading, transitions and lifecycle.\
1995
+ * Provides methods to register scenes, load scenes by name, and handles the opening scene.\
1996
+ * Ensures proper cleanup between scene transitions and maintains scene state.
1830
1997
  * @public
1831
1998
  * @category Managers
1832
1999
  * @example
@@ -1859,11 +2026,17 @@ declare class SceneManager {
1859
2026
  }
1860
2027
 
1861
2028
  /**
1862
- * Game is the main class that contains all the managers, scenes, entities and components. It allows to start and stop the execution of the game.
2029
+ * The Game class is the core entry point for creating and managing a game instance.\
2030
+ * It serves as a central hub that coordinates all game systems including scenes, entities,
2031
+ * components, and various managers (rendering, physics, input, etc.).\
2032
+ * The class provides methods to initialize the game with custom configuration, add scenes
2033
+ * and dependencies, and control the game loop execution.\
2034
+ * Through dependency injection, it ensures proper initialization and communication between all game systems.
1863
2035
  * @public
1864
2036
  * @category Core
1865
2037
  * @example
1866
2038
  * ```js
2039
+ * // Basic game setup with minimal configuration
1867
2040
  * const game = new Game({
1868
2041
  * containerNode: document.getElementById("app"),
1869
2042
  * width: 1920,
@@ -1874,6 +2047,7 @@ declare class SceneManager {
1874
2047
  * ```
1875
2048
  * @example
1876
2049
  * ```js
2050
+ * // Advanced game setup with custom physics and collision settings
1877
2051
  * const game = new Game({
1878
2052
  * containerNode: document.getElementById("app"),
1879
2053
  * width: 1920,
@@ -1934,8 +2108,35 @@ declare class Game {
1934
2108
  }
1935
2109
 
1936
2110
  /**
2111
+ * Animator component configuration
1937
2112
  * @public
1938
- * @category Components
2113
+ * @category Components Configuration
2114
+ * @example
2115
+ * ```js
2116
+ * const walkAnimation = new Animation({
2117
+ * image: "walk.png",
2118
+ * slice: { size: new Vector2(32, 32) },
2119
+ * fps: 12,
2120
+ * loop: true
2121
+ * });
2122
+ *
2123
+ * const idleAnimation = new Animation({
2124
+ * image: "idle.png",
2125
+ * slice: { size: new Vector2(32, 32) },
2126
+ * fps: 8,
2127
+ * loop: true
2128
+ * });
2129
+ *
2130
+ * const animator = new Animator({
2131
+ * animations: new Map([
2132
+ * ["walk", walkAnimation],
2133
+ * ["idle", idleAnimation]
2134
+ * ]),
2135
+ * animation: "idle",
2136
+ * speed: 1,
2137
+ * playing: true
2138
+ * });
2139
+ * ```
1939
2140
  */
1940
2141
  interface AnimatorOptions {
1941
2142
  animations: Map<string, Animation>;
@@ -1944,8 +2145,36 @@ interface AnimatorOptions {
1944
2145
  playing: boolean;
1945
2146
  }
1946
2147
  /**
2148
+ * The Animator component manages sprite animations. It holds a map of named animations
2149
+ * and controls which animation is currently playing, its speed, and playback state.
1947
2150
  * @public
1948
2151
  * @category Components
2152
+ * @example
2153
+ * ```js
2154
+ * const walkAnimation = new Animation({
2155
+ * image: "walk.png",
2156
+ * slice: { size: new Vector2(32, 32) },
2157
+ * fps: 12,
2158
+ * loop: true
2159
+ * });
2160
+ *
2161
+ * const idleAnimation = new Animation({
2162
+ * image: "idle.png",
2163
+ * slice: { size: new Vector2(32, 32) },
2164
+ * fps: 8,
2165
+ * loop: true
2166
+ * });
2167
+ *
2168
+ * const animator = new Animator({
2169
+ * animations: new Map([
2170
+ * ["walk", walkAnimation],
2171
+ * ["idle", idleAnimation]
2172
+ * ]),
2173
+ * animation: "idle",
2174
+ * speed: 1,
2175
+ * playing: true
2176
+ * });
2177
+ * ```
1949
2178
  */
1950
2179
  declare class Animator {
1951
2180
  animations: Map<string, Animation>;
@@ -1957,23 +2186,95 @@ declare class Animator {
1957
2186
  currentTime: number;
1958
2187
  /** @internal */
1959
2188
  _currentAnimation: string;
2189
+ /** @internal */
2190
+ _assetsReady: boolean;
1960
2191
  constructor(options?: Partial<AnimatorOptions>);
1961
2192
  }
1962
2193
  /**
2194
+ * Animation configuration
1963
2195
  * @public
1964
- * @category Components
2196
+ * @category Components Configuration
2197
+ * @example
2198
+ * ```js
2199
+ * const walkAnimation = new Animation({
2200
+ * image: "walk.png",
2201
+ * slice: { size: new Vector2(32, 32) },
2202
+ * fps: 12,
2203
+ * loop: true
2204
+ * });
2205
+ *
2206
+ * const idleAnimation = new Animation({
2207
+ * image: "idle.png",
2208
+ * slice: { size: new Vector2(32, 32) },
2209
+ * fps: 8,
2210
+ * loop: true
2211
+ * });
2212
+ *
2213
+ * const animator = new Animator({
2214
+ * animations: new Map([
2215
+ * ["walk", walkAnimation],
2216
+ * ["idle", idleAnimation]
2217
+ * ]),
2218
+ * animation: "idle",
2219
+ * speed: 1,
2220
+ * playing: true
2221
+ * });
2222
+ * ```
2223
+ */
2224
+ interface AnimationOptions {
2225
+ image: HTMLImageElement | HTMLImageElement[] | string | string[];
2226
+ slice?: {
2227
+ size: Vector2;
2228
+ offset?: Vector2;
2229
+ padding?: Vector2;
2230
+ };
2231
+ frames?: number[];
2232
+ fps?: number;
2233
+ loop?: boolean;
2234
+ }
2235
+ /**
2236
+ * Animation class used to configure sprite animations. It defines properties like the source image(s),
2237
+ * slice dimensions for sprite sheets, frame sequence, playback speed and looping behavior.
2238
+ * @public
2239
+ * @category Components Configuration
2240
+ * @example
2241
+ * ```js
2242
+ * const walkAnimation = new Animation({
2243
+ * image: "walk.png",
2244
+ * slice: { size: new Vector2(32, 32) },
2245
+ * fps: 12,
2246
+ * loop: true
2247
+ * });
2248
+ *
2249
+ * const idleAnimation = new Animation({
2250
+ * image: "idle.png",
2251
+ * slice: { size: new Vector2(32, 32) },
2252
+ * fps: 8,
2253
+ * loop: true
2254
+ * });
2255
+ *
2256
+ * const animator = new Animator({
2257
+ * animations: new Map([
2258
+ * ["walk", walkAnimation],
2259
+ * ["idle", idleAnimation]
2260
+ * ]),
2261
+ * animation: "idle",
2262
+ * speed: 1,
2263
+ * playing: true
2264
+ * });
2265
+ * ```
1965
2266
  */
1966
2267
  declare class Animation {
1967
- image: HTMLImageElement | HTMLImageElement[];
2268
+ image: HTMLImageElement | HTMLImageElement[] | string | string[];
1968
2269
  slice: AnimationSlice;
1969
2270
  frames: number[];
1970
2271
  fps: number;
1971
2272
  loop: boolean;
1972
- constructor(options?: Partial<Animation>);
2273
+ constructor(options?: AnimationOptions);
1973
2274
  }
1974
2275
  /**
1975
2276
  * @public
1976
- * @category Components
2277
+ * @category Components Configuration
1977
2278
  */
1978
2279
  type AnimationSlice = {
1979
2280
  size: Vector2;
@@ -1982,14 +2283,24 @@ type AnimationSlice = {
1982
2283
  };
1983
2284
 
1984
2285
  /**
2286
+ * AudioPlayer component configuration
1985
2287
  * @public
1986
- * @category Components
2288
+ * @category Components Configuration
2289
+ * @example
2290
+ * ```js
2291
+ * const audioPlayer = new AudioPlayer({
2292
+ * audioSource: "sound.mp3",
2293
+ * volume: 0.5,
2294
+ * loop: true,
2295
+ * fixedToTimeScale: false
2296
+ * });
2297
+ * ```
1987
2298
  */
1988
2299
  interface AudioPlayerOptions {
1989
2300
  /** The action to perform with the audio source. */
1990
2301
  action: AudioPlayerAction;
1991
2302
  /** The audio source to play. */
1992
- audioSource: HTMLAudioElement;
2303
+ audioSource: HTMLAudioElement | string;
1993
2304
  /** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
1994
2305
  fixedToTimeScale: boolean;
1995
2306
  /** TRUE If the audio source should loop. */
@@ -1998,14 +2309,25 @@ interface AudioPlayerOptions {
1998
2309
  volume: number;
1999
2310
  }
2000
2311
  /**
2312
+ * The AudioPlayer component handles audio playback in the game. It manages playing, pausing and stopping audio sources,
2313
+ * controls volume and looping behavior, and can optionally sync playback speed with the game's time scale.
2001
2314
  * @public
2002
2315
  * @category Components
2316
+ * @example
2317
+ * ```js
2318
+ * const audioPlayer = new AudioPlayer({
2319
+ * audioSource: "sound.mp3",
2320
+ * volume: 0.5,
2321
+ * loop: true,
2322
+ * fixedToTimeScale: false
2323
+ * });
2324
+ * ```
2003
2325
  */
2004
2326
  declare class AudioPlayer {
2005
2327
  /** The action to perform with the audio source. This action will be erased at the end of the frame */
2006
2328
  action: AudioPlayerAction;
2007
2329
  /** The audio source to play. */
2008
- audioSource: HTMLAudioElement;
2330
+ audioSource: HTMLAudioElement | string;
2009
2331
  /** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
2010
2332
  fixedToTimeScale: boolean;
2011
2333
  /** TRUE If the audio source should loop. */
@@ -2040,18 +2362,31 @@ declare class AudioPlayer {
2040
2362
  }
2041
2363
  /**
2042
2364
  * @public
2043
- * @category Components
2365
+ * @category Components Configuration
2044
2366
  */
2045
2367
  type AudioPlayerAction = "stop" | "play" | "pause";
2046
2368
  /**
2047
2369
  * @public
2048
- * @category Components
2370
+ * @category Components Configuration
2049
2371
  */
2050
2372
  type AudioPlayerState = "stopped" | "playing" | "paused";
2051
2373
 
2052
2374
  /**
2375
+ * Button component configuration
2053
2376
  * @public
2054
- * @category Components
2377
+ * @category Components Configuration
2378
+ * @example
2379
+ * ```js
2380
+ * const button = new Button({
2381
+ * shape: ButtonShape.Rectangle,
2382
+ * width: 100,
2383
+ * height: 50,
2384
+ * offset: new Vector2(0, 0),
2385
+ * touchEnabled: true,
2386
+ * onClick: () => console.log("Button clicked!"),
2387
+ * onPressed: () => console.log("Button pressed!")
2388
+ * });
2389
+ * ```
2055
2390
  */
2056
2391
  interface ButtonOptions {
2057
2392
  shape: ButtonShape;
@@ -2064,8 +2399,23 @@ interface ButtonOptions {
2064
2399
  onPressed: () => void;
2065
2400
  }
2066
2401
  /**
2402
+ * The Button component creates an interactive button that can be clicked or pressed.\
2403
+ * It supports rectangular or circular shapes and can be configured with dimensions,
2404
+ * position offset, touch input, and click/press event handlers.
2067
2405
  * @public
2068
2406
  * @category Components
2407
+ * @example
2408
+ * ```js
2409
+ * const button = new Button({
2410
+ * shape: ButtonShape.Rectangle,
2411
+ * width: 100,
2412
+ * height: 50,
2413
+ * offset: new Vector2(0, 0),
2414
+ * touchEnabled: true,
2415
+ * onClick: () => console.log("Button clicked!"),
2416
+ * onPressed: () => console.log("Button pressed!")
2417
+ * });
2418
+ * ```
2069
2419
  */
2070
2420
  declare class Button {
2071
2421
  /** The shape of the button */
@@ -2092,7 +2442,7 @@ declare class Button {
2092
2442
  }
2093
2443
  /**
2094
2444
  * @public
2095
- * @category Components
2445
+ * @category Components Configuration
2096
2446
  */
2097
2447
  declare enum ButtonShape {
2098
2448
  Rectangle = 0,
@@ -2100,25 +2450,56 @@ declare enum ButtonShape {
2100
2450
  }
2101
2451
 
2102
2452
  /**
2453
+ * TiledWrapper component configuration
2103
2454
  * @public
2104
- * @category Components
2455
+ * @category Components Configuration
2456
+ * @example
2457
+ * ```js
2458
+ * const tiledWrapper = new TiledWrapper({
2459
+ * tilemap: "tilemap.json",
2460
+ * layerToRender: "Ground"
2461
+ * });
2462
+ *
2463
+ * const tiledWrapper = new TiledWrapper({
2464
+ * tilemap: assetManager.getJson("tilemap.json"),
2465
+ * layerToRender: "Ground"
2466
+ * });
2467
+ * ```
2105
2468
  */
2106
2469
  interface TiledWrapperOptions {
2107
- tilemap: TiledTilemap;
2470
+ tilemap: TiledTilemap | string;
2108
2471
  layerToRender: string;
2109
2472
  }
2110
2473
  /**
2474
+ * The TiledWrapper component wraps a Tiled map editor tilemap and handles rendering a specific layer.\
2475
+ * It provides an interface between Tiled's map format and the engine's tilemap rendering system.
2111
2476
  * @public
2112
2477
  * @category Components
2478
+ * @example
2479
+ * ```js
2480
+ * const tiledWrapper = new TiledWrapper({
2481
+ * tilemap: {
2482
+ * width: 10,
2483
+ * height: 10,
2484
+ * infinite: false,
2485
+ * layers: [],
2486
+ * renderorder: "right-down",
2487
+ * tilesets: [{ firstgid: 1 }],
2488
+ * tilewidth: 32,
2489
+ * tileheight: 32
2490
+ * },
2491
+ * layerToRender: "Ground"
2492
+ * });
2493
+ * ```
2113
2494
  */
2114
2495
  declare class TiledWrapper {
2115
- tilemap: TiledTilemap;
2496
+ tilemap: TiledTilemap | string;
2116
2497
  layerToRender: string;
2117
2498
  constructor(options?: Partial<TiledWrapperOptions>);
2118
2499
  }
2119
2500
  /**
2120
2501
  * @public
2121
- * @category Components
2502
+ * @category Components Configuration
2122
2503
  */
2123
2504
  interface TiledTilemap {
2124
2505
  width: number;
@@ -2135,7 +2516,7 @@ interface TiledTilemap {
2135
2516
  }
2136
2517
  /**
2137
2518
  * @public
2138
- * @category Components
2519
+ * @category Components Configuration
2139
2520
  */
2140
2521
  interface TiledChunk {
2141
2522
  data: number[];
@@ -2147,7 +2528,7 @@ interface TiledChunk {
2147
2528
  }
2148
2529
  /**
2149
2530
  * @public
2150
- * @category Components
2531
+ * @category Components Configuration
2151
2532
  */
2152
2533
  interface TiledLayer {
2153
2534
  name: string;
@@ -2170,7 +2551,7 @@ interface TiledLayer {
2170
2551
  }
2171
2552
  /**
2172
2553
  * @public
2173
- * @category Components
2554
+ * @category Components Configuration
2174
2555
  */
2175
2556
  interface TiledObjectLayer {
2176
2557
  draworder: string;
@@ -2186,7 +2567,7 @@ interface TiledObjectLayer {
2186
2567
  }
2187
2568
  /**
2188
2569
  * @public
2189
- * @category Components
2570
+ * @category Components Configuration
2190
2571
  */
2191
2572
  interface TiledObject {
2192
2573
  gid: number;
@@ -2211,7 +2592,7 @@ interface TiledObject {
2211
2592
  }
2212
2593
  /**
2213
2594
  * @public
2214
- * @category Components
2595
+ * @category Components Configuration
2215
2596
  */
2216
2597
  interface TiledProperty {
2217
2598
  name: string;
@@ -2220,8 +2601,17 @@ interface TiledProperty {
2220
2601
  }
2221
2602
 
2222
2603
  /**
2604
+ * Transform component configuration
2223
2605
  * @public
2224
- * @category Components
2606
+ * @category Components Configuration
2607
+ * @example
2608
+ * ```js
2609
+ * const transform = new Transform({
2610
+ * position: new Vector2(100, 100),
2611
+ * scale: new Vector2(2, 2),
2612
+ * rotation: Math.PI / 4
2613
+ * });
2614
+ * ```
2225
2615
  */
2226
2616
  interface TransformOptions {
2227
2617
  position: Vector2;
@@ -2229,8 +2619,20 @@ interface TransformOptions {
2229
2619
  rotation: number;
2230
2620
  }
2231
2621
  /**
2622
+ * The Transform component defines an entity's position, scale and rotation in the game world.\
2623
+ * It can be nested under a parent transform to create hierarchical relationships, where child
2624
+ * transforms inherit and combine with their parent's transformations.\
2625
+ * The component provides both local and world-space values, and allows selectively ignoring parent transformations.
2232
2626
  * @public
2233
2627
  * @category Components
2628
+ * @example
2629
+ * ```js
2630
+ * const transform = new Transform({
2631
+ * position: new Vector2(100, 100),
2632
+ * scale: new Vector2(2, 2),
2633
+ * rotation: Math.PI / 4
2634
+ * });
2635
+ * ```
2234
2636
  */
2235
2637
  declare class Transform {
2236
2638
  /** Position relative to the zero point of the simulated world, or relative to the parent if it has one */
@@ -2239,11 +2641,17 @@ declare class Transform {
2239
2641
  scale: Vector2;
2240
2642
  /** Rotation expressed in radians */
2241
2643
  rotation: number;
2242
- /** The real position in the simulated world. It has the same value as `position` property if there is no parent */
2644
+ /** If TRUE, the parent position will be ignored */
2645
+ ignoreParentPosition: boolean;
2646
+ /** If TRUE, the parent scale will be ignored */
2647
+ ignoreParentScale: boolean;
2648
+ /** If TRUE, the parent rotation will be ignored */
2649
+ ignoreParentRotation: boolean;
2650
+ /** READONLY: The real position in the simulated world. It has the same value as `position` property if there is no parent */
2243
2651
  localPosition: Vector2;
2244
- /** The real scale in the simulated world. It has the same value as `scale` property if there is no parent */
2652
+ /** READONLY: The real scale in the simulated world. It has the same value as `scale` property if there is no parent */
2245
2653
  localScale: Vector2;
2246
- /** The real rotation in the simulated world. It has the same value as `rotation` property if there is no parent */
2654
+ /** READONLY: The real rotation in the simulated world. It has the same value as `rotation` property if there is no parent */
2247
2655
  localRotation: number;
2248
2656
  /** @internal */
2249
2657
  _awake: boolean;
@@ -2253,9 +2661,9 @@ declare class Transform {
2253
2661
  }
2254
2662
 
2255
2663
  /**
2256
- * Configuration object for BallCollider creation
2664
+ * BallCollider component configuration
2257
2665
  * @public
2258
- * @category Components
2666
+ * @category Components Configuration
2259
2667
  * @example
2260
2668
  * ```js
2261
2669
  * const ballCollider = new BallCollider({
@@ -2280,7 +2688,10 @@ interface BallColliderOptions {
2280
2688
  ignoreCollisionsWithLayers: string[];
2281
2689
  }
2282
2690
  /**
2283
- * Circumference shaped collider for 2d collisions.
2691
+ * The BallCollider component defines a circular collision shape for an entity.\
2692
+ * It can be used for both physics interactions and collision detection.\
2693
+ * The collider's size is determined by its radius, and it can be offset from the entity's position.\
2694
+ * Collision layers allow controlling which objects can collide with each other.
2284
2695
  * @public
2285
2696
  * @category Components
2286
2697
  * @example
@@ -2311,9 +2722,9 @@ declare class BallCollider implements Collider {
2311
2722
  }
2312
2723
 
2313
2724
  /**
2314
- * Configuration object for BoxCollider creation
2725
+ * BoxCollider component configuration
2315
2726
  * @public
2316
- * @category Components
2727
+ * @category Components Configuration
2317
2728
  * @example
2318
2729
  * ```js
2319
2730
  * const boxCollider = new BoxCollider({
@@ -2344,7 +2755,10 @@ interface BoxColliderOptions {
2344
2755
  ignoreCollisionsWithLayers: string[];
2345
2756
  }
2346
2757
  /**
2347
- * Rectangle shaped collider for 2d collisions.
2758
+ * The BoxCollider component defines a rectangular collision shape for an entity.\
2759
+ * It can be used for both physics interactions and collision detection.\
2760
+ * The collider's size is determined by its width and height, and it can be offset and rotated.\
2761
+ * Collision layers allow controlling which objects can collide with each other.
2348
2762
  * @public
2349
2763
  * @category Components
2350
2764
  * @example
@@ -2381,9 +2795,9 @@ declare class BoxCollider implements Collider {
2381
2795
  }
2382
2796
 
2383
2797
  /**
2384
- * Configuration object for EdgeCollider creation
2798
+ * EdgeCollider component configuration
2385
2799
  * @public
2386
- * @category Components
2800
+ * @category Components Configuration
2387
2801
  * @example
2388
2802
  * ```js
2389
2803
  * const edgeCollider = new EdgeCollider({
@@ -2411,7 +2825,10 @@ interface EdgeColliderOptions {
2411
2825
  ignoreCollisionsWithLayers: string[];
2412
2826
  }
2413
2827
  /**
2414
- * Collider composed of lines defined by its vertices, for 2d collisions.
2828
+ * The EdgeCollider component defines a collision shape made up of connected line segments.\
2829
+ * It can be used for both physics interactions and collision detection.\
2830
+ * The collider's shape is determined by a series of vertices that form edges between them.\
2831
+ * The shape can be offset and rotated, and collision layers allow controlling which objects can collide with each other.
2415
2832
  * @public
2416
2833
  * @category Components
2417
2834
  * @example
@@ -2444,9 +2861,9 @@ declare class EdgeCollider implements Collider {
2444
2861
  }
2445
2862
 
2446
2863
  /**
2447
- * Configuration object for PolygonCollider creation
2864
+ * PolygonCollider component configuration
2448
2865
  * @public
2449
- * @category Components
2866
+ * @category Components Configuration
2450
2867
  * @example
2451
2868
  * ```js
2452
2869
  * const polygonCollider = new PolygonCollider({
@@ -2474,7 +2891,11 @@ interface PolygonColliderOptions {
2474
2891
  ignoreCollisionsWithLayers: string[];
2475
2892
  }
2476
2893
  /**
2477
- * Polygon shaped Collider for 2d collisions. Only convex polygons are allowed.
2894
+ * The PolygonCollider component defines a convex polygon-shaped collision area for an entity.\
2895
+ * It can be used for both physics interactions and collision detection.\
2896
+ * The collider's shape is determined by a series of vertices that form a closed convex polygon.\
2897
+ * Note that only convex polygons are supported - concave shapes must be broken into multiple convex polygons.\
2898
+ * The shape can be offset and rotated, and collision layers allow controlling which objects can collide with each other.
2478
2899
  * @public
2479
2900
  * @category Components
2480
2901
  * @example
@@ -2512,7 +2933,7 @@ declare class PolygonCollider implements Collider {
2512
2933
  * - **Dynamic:** This type of body is affected by gravity and velocity and can be moved by other rigid bodies.
2513
2934
  * - **Kinematic:** This type of body is not affected by gravity and cannot be moved by other rigid bodies, but can be velocity applied.
2514
2935
  * - **Static:** This type of body is immobile, is not affected by velocity or gravity and cannot be moved by other rigid bodies.
2515
- * @category Components
2936
+ * @category Components Configuration
2516
2937
  * @public
2517
2938
  */
2518
2939
  declare enum RigidBodyType {
@@ -2523,7 +2944,7 @@ declare enum RigidBodyType {
2523
2944
  /**
2524
2945
  * RigidBody configuration options
2525
2946
  * @public
2526
- * @category Components
2947
+ * @category Components Configuration
2527
2948
  * @example
2528
2949
  * ```js
2529
2950
  const rigidBody = new RigidBody({
@@ -2574,13 +2995,19 @@ interface RigidBodyOptions {
2574
2995
  acceleration: Vector2;
2575
2996
  }
2576
2997
  /**
2577
- * The RigidBody component puts the entity under simulation of the physics engine, where it will interact with other objects that have a RigidBody.\
2578
- * There are three types of bodies:
2579
- * - **Dynamic:** This type of body is affected by gravity and velocity and can be moved by other rigid bodies.
2580
- * - **Kinematic:** This type of body is not affected by gravity and cannot be moved by other rigid bodies, but can be velocity applied.\
2581
- * This type of body consumes less processing resources than the Dynamic.
2582
- * - **Static:** This type of body is immobile, is not affected by velocity or gravity and cannot be moved by other rigid bodies.\
2583
- * This is the body type that consumes the least processing resources.
2998
+ * The RigidBody component enables physics simulation for an entity, allowing it to interact with other physics-enabled objects in the game world.\
2999
+ * It defines how the entity behaves under forces like gravity, collisions, and applied velocities. The component supports three types of bodies:
3000
+ *
3001
+ * - **Dynamic:** Fully physics-simulated bodies that respond to forces, collisions, gravity, and can be moved by other rigid bodies.
3002
+ * Best for objects that need realistic physical behavior like players, projectiles, or items.
3003
+ *
3004
+ * - **Kinematic:** Bodies that can move with applied velocities but are not affected by gravity or collisions from other bodies.
3005
+ * Ideal for moving platforms, enemies with predefined paths, or objects that need controlled movement without full physics simulation.
3006
+ * More performance efficient than Dynamic bodies.
3007
+ *
3008
+ * - **Static:** Immobile bodies that act as solid, unmovable obstacles. They don't respond to any forces or collisions.
3009
+ * Perfect for level geometry, walls, or any unchanging collision objects.
3010
+ * The most performance efficient option as they require minimal physics calculations.
2584
3011
  * @public
2585
3012
  * @category Components
2586
3013
  * @example
@@ -2611,6 +3038,7 @@ declare class RigidBody {
2611
3038
  /**
2612
3039
  * The type of the rigid body to create:
2613
3040
  * - Dynamic: This type of body is affected by gravity and velocity.
3041
+ * - Kinematic: This type of body is not affected by gravity and cannot be moved by other rigid bodies, but can be velocity applied.
2614
3042
  * - Static: This type of body is immovable, is unaffected by velocity and gravity.
2615
3043
  * @public
2616
3044
  */
@@ -2634,9 +3062,9 @@ declare class RigidBody {
2634
3062
  }
2635
3063
 
2636
3064
  /**
2637
- * Configuration object for TilemapCollider creation
3065
+ * TilemapCollider component configuration
2638
3066
  * @public
2639
- * @category Components
3067
+ * @category Components Configuration
2640
3068
  * @example
2641
3069
  * ```js
2642
3070
  * const tilemapCollider = new TilemapCollider({
@@ -2661,8 +3089,12 @@ interface TilemapColliderOptions {
2661
3089
  physics: boolean;
2662
3090
  }
2663
3091
  /**
2664
- * Generates rectangle colliders for the map edge tiles (or lines if composite is TRUE).\
2665
- * **Limitations:** At the moment, it is not possible to modify the shape of the collider once it has been generated.
3092
+ * The TilemapCollider component automatically generates collision shapes for tilemap edges.\
3093
+ * When composite is FALSE, it creates individual rectangle colliders for each edge tile.\
3094
+ * When composite is TRUE, it optimizes by generating connected line segments that follow the tilemap's outer edges.\
3095
+ * This is useful for efficiently handling collision detection with tilemap boundaries.\
3096
+ * **Limitations:** The collider shapes are generated once and cannot be modified after creation.
3097
+ * To update the collision shapes, you must create a new TilemapCollider instance.
2666
3098
  * @public
2667
3099
  * @category Components
2668
3100
  * @example
@@ -2699,7 +3131,7 @@ declare enum RenderDataType {
2699
3131
  Mask = 3,
2700
3132
  Geometric = 4,
2701
3133
  Video = 5,
2702
- Shadow = 6
3134
+ Darkness = 6
2703
3135
  }
2704
3136
  interface CameraData {
2705
3137
  depth: number;
@@ -2715,7 +3147,7 @@ interface RenderData {
2715
3147
 
2716
3148
  /**
2717
3149
  * Mask shape: Rectangle or Circumference.
2718
- * @category Components
3150
+ * @category Components Configuration
2719
3151
  * @public
2720
3152
  */
2721
3153
  declare enum MaskShape {
@@ -2734,7 +3166,7 @@ interface MaskRenderData extends RenderData {
2734
3166
  opacity: number;
2735
3167
  }
2736
3168
 
2737
- interface ShadowRenderData extends RenderData {
3169
+ interface DarknessRenderData extends RenderData {
2738
3170
  color: string;
2739
3171
  height: number;
2740
3172
  opacity: number;
@@ -2783,7 +3215,7 @@ interface SpriteRenderData extends RenderData {
2783
3215
  }
2784
3216
  /**
2785
3217
  * Cut the image based on straight coordinates starting from the top left downward.
2786
- * @category Components
3218
+ * @category Components Configuration
2787
3219
  * @public
2788
3220
  */
2789
3221
  interface Slice {
@@ -2799,7 +3231,7 @@ interface Slice {
2799
3231
 
2800
3232
  /**
2801
3233
  * Direction in which the text will be rendered.
2802
- * @category Components
3234
+ * @category Components Configuration
2803
3235
  * @public
2804
3236
  */
2805
3237
  declare enum TextOrientation {
@@ -2835,8 +3267,7 @@ interface TextRenderData extends RenderData {
2835
3267
 
2836
3268
  /**
2837
3269
  * Direction in which the tilemap will be rendered.
2838
- * @category Components
2839
- * @public
3270
+ * @internal
2840
3271
  */
2841
3272
  declare enum TilemapOrientation {
2842
3273
  Center = 0,
@@ -2846,23 +3277,8 @@ declare enum TilemapOrientation {
2846
3277
  }
2847
3278
  interface TilemapRenderData extends RenderData {
2848
3279
  tiles: number[];
2849
- tilemap: {
2850
- width: number;
2851
- tileWidth: number;
2852
- tileHeight: number;
2853
- height: number;
2854
- realWidth: number;
2855
- realHeight: number;
2856
- };
2857
- tileset: {
2858
- image: HTMLImageElement;
2859
- width: number;
2860
- tileWidth: number;
2861
- tileHeight: number;
2862
- margin?: Vector2;
2863
- spacing?: Vector2;
2864
- correction?: Vector2;
2865
- };
3280
+ tilemap: Tilemap;
3281
+ tileset: Tileset$1;
2866
3282
  smooth?: boolean;
2867
3283
  flipHorizontal?: boolean;
2868
3284
  flipVertical?: boolean;
@@ -2873,6 +3289,23 @@ interface TilemapRenderData extends RenderData {
2873
3289
  tintColor?: string;
2874
3290
  orientation?: TilemapOrientation;
2875
3291
  }
3292
+ type Tileset$1 = {
3293
+ image: HTMLImageElement;
3294
+ width: number;
3295
+ tileWidth: number;
3296
+ tileHeight: number;
3297
+ margin?: Vector2;
3298
+ spacing?: Vector2;
3299
+ correction?: Vector2;
3300
+ };
3301
+ type Tilemap = {
3302
+ width: number;
3303
+ tileWidth: number;
3304
+ tileHeight: number;
3305
+ height: number;
3306
+ realWidth: number;
3307
+ realHeight: number;
3308
+ };
2876
3309
 
2877
3310
  interface VideoRenderData extends RenderData {
2878
3311
  video: HTMLVideoElement;
@@ -2890,8 +3323,7 @@ interface VideoRenderData extends RenderData {
2890
3323
 
2891
3324
  /**
2892
3325
  * Default render layer
2893
- * @public
2894
- * @category Components
3326
+ * @internal
2895
3327
  */
2896
3328
  declare const defaultRenderLayer = "Default";
2897
3329
  /**
@@ -2900,8 +3332,18 @@ declare const defaultRenderLayer = "Default";
2900
3332
  */
2901
3333
  declare const debugRenderLayer = "Debug";
2902
3334
  /**
3335
+ * Camera component configuration
2903
3336
  * @public
2904
- * @category Components
3337
+ * @category Components Configuration
3338
+ * @example
3339
+ * ```js
3340
+ * const camera = new Camera({
3341
+ * layers: ["Default", "UI", "Background"],
3342
+ * zoom: 1.5,
3343
+ * depth: 0,
3344
+ * debug: true
3345
+ * });
3346
+ * ```
2905
3347
  */
2906
3348
  interface CameraOptions {
2907
3349
  layers: string[];
@@ -2910,8 +3352,20 @@ interface CameraOptions {
2910
3352
  debug: boolean;
2911
3353
  }
2912
3354
  /**
3355
+ * The Camera component controls what layers and objects are rendered to the screen.\
3356
+ * It supports multiple render layers, zoom level control, and depth ordering when using multiple cameras.\
3357
+ * Each camera can also optionally render debug information for development purposes.\
2913
3358
  * @public
2914
3359
  * @category Components
3360
+ * @example
3361
+ * ```js
3362
+ * const camera = new Camera({
3363
+ * layers: ["Default", "UI", "Background"],
3364
+ * zoom: 1.5,
3365
+ * depth: 0,
3366
+ * debug: true
3367
+ * });
3368
+ * ```
2915
3369
  */
2916
3370
  declare class Camera {
2917
3371
  /** Layers to be rendered by this camera. Layers are rendered in ascending order */
@@ -2928,8 +3382,18 @@ declare class Camera {
2928
3382
  }
2929
3383
 
2930
3384
  /**
3385
+ * LightRenderer component configuration
2931
3386
  * @public
2932
- * @category Components
3387
+ * @category Components Configuration
3388
+ * @example
3389
+ * ```js
3390
+ * const lightRenderer = new LightRenderer({
3391
+ * radius: 100,
3392
+ * smooth: true,
3393
+ * layer: "Default",
3394
+ * intensity: 0.8
3395
+ * });
3396
+ * ```
2933
3397
  */
2934
3398
  interface LightRendererOptions {
2935
3399
  radius: number;
@@ -2938,15 +3402,29 @@ interface LightRendererOptions {
2938
3402
  intensity: number;
2939
3403
  }
2940
3404
  /**
3405
+ * The LightRenderer component is used to render a light effect on the screen.\
3406
+ * It supports a circular light source with a specified radius and intensity.\
3407
+ * The light can be optionally smoothed for a softer edge effect.\
3408
+ * This component requires a DarknessRenderer component to be present in the scene to function properly,
3409
+ * as it works by illuminating areas within the darkness mask.\
2941
3410
  * @public
2942
3411
  * @category Components
3412
+ * @example
3413
+ * ```js
3414
+ * const lightRenderer = new LightRenderer({
3415
+ * radius: 100,
3416
+ * smooth: true,
3417
+ * layer: "Default",
3418
+ * intensity: 0.8
3419
+ * });
3420
+ * ```
2943
3421
  */
2944
3422
  declare class LightRenderer {
2945
3423
  /** Light radius */
2946
3424
  radius: number;
2947
3425
  /** Smooth */
2948
3426
  smooth: boolean;
2949
- /** Shadow render layer */
3427
+ /** Darkness render layer */
2950
3428
  layer: string;
2951
3429
  /** Light intensitry between 0 and 1 */
2952
3430
  intensity: number;
@@ -2956,8 +3434,44 @@ declare class LightRenderer {
2956
3434
  }
2957
3435
 
2958
3436
  /**
3437
+ * MaskRenderer component configuration
2959
3438
  * @public
2960
- * @category Components
3439
+ * @category Components Configuration
3440
+ * @example
3441
+ * ```js
3442
+ * const maskRenderer = new MaskRenderer({
3443
+ * shape: MaskShape.Rectangle,
3444
+ * width: 32,
3445
+ * height: 32,
3446
+ * color: "#000000",
3447
+ * offset: new Vector2(0, 0),
3448
+ * rotation: 0,
3449
+ * opacity: 1,
3450
+ * layer: "Default"
3451
+ * });
3452
+ * ```
3453
+ * @example
3454
+ * ```js
3455
+ * const maskRenderer = new MaskRenderer({
3456
+ * shape: MaskShape.Circumference,
3457
+ * radius: 16,
3458
+ * color: "#000000",
3459
+ * offset: new Vector2(0, 0),
3460
+ * opacity: 1,
3461
+ * layer: "Default"
3462
+ * });
3463
+ * ```
3464
+ * @example
3465
+ * ```js
3466
+ * const maskRenderer = new MaskRenderer({
3467
+ * shape: MaskShape.Polygon,
3468
+ * vertexModel: [new Vector2(0, 0), new Vector2(32, 0), new Vector2(32, 32), new Vector2(0, 32)],
3469
+ * color: "#000000",
3470
+ * offset: new Vector2(0, 0),
3471
+ * opacity: 1,
3472
+ * layer: "Default"
3473
+ * });
3474
+ * ```
2961
3475
  */
2962
3476
  interface MaskRendererOptions {
2963
3477
  shape: MaskShape;
@@ -2972,37 +3486,46 @@ interface MaskRendererOptions {
2972
3486
  layer: string;
2973
3487
  }
2974
3488
  /**
2975
- * Renders a filled shape (rectangle, circumference or polygon)
3489
+ * The MaskRenderer component renders filled shapes like rectangles, circles, or polygons.\
3490
+ * It supports different shape types with configurable dimensions, colors, positioning and rotation.\
3491
+ * Shapes can be rendered with variable opacity and assigned to specific render layers.\
3492
+ * This component is useful for creating UI elements, visual effects, or masking other rendered content.
2976
3493
  * @public
2977
3494
  * @category Components
2978
3495
  * @example
2979
3496
  * ```js
2980
- * maskRenderer.shape = MaskShape.Rectangle;
2981
- * maskRenderer.width = 32;
2982
- * maskRenderer.height = 32;
2983
- * maskRenderer.color = "#000000";
2984
- * maskRenderer.offset = new Vector2(0, 0);
2985
- * maskRenderer.rotation = 0;
2986
- * maskRenderer.opacity = 1;
2987
- * maskRenderer.layer = "Default";
3497
+ * const maskRenderer = new MaskRenderer({
3498
+ * shape: MaskShape.Rectangle,
3499
+ * width: 32,
3500
+ * height: 32,
3501
+ * color: "#000000",
3502
+ * offset: new Vector2(0, 0),
3503
+ * rotation: 0,
3504
+ * opacity: 1,
3505
+ * layer: "Default"
3506
+ * });
2988
3507
  * ```
2989
3508
  * @example
2990
3509
  * ```js
2991
- * maskRenderer.shape = MaskShape.Circumference;
2992
- * maskRenderer.radius = 16;
2993
- * maskRenderer.color = "#000000";
2994
- * maskRenderer.offset = new Vector2(0, 0);
2995
- * maskRenderer.opacity = 1;
2996
- * maskRenderer.layer = "Default";
3510
+ * const maskRenderer = new MaskRenderer({
3511
+ * shape: MaskShape.Circumference,
3512
+ * radius: 16,
3513
+ * color: "#000000",
3514
+ * offset: new Vector2(0, 0),
3515
+ * opacity: 1,
3516
+ * layer: "Default"
3517
+ * });
2997
3518
  * ```
2998
3519
  * @example
2999
3520
  * ```js
3000
- * maskRenderer.shape = MaskShape.Polygon;
3001
- * maskRenderer.vertexModel = [new Vector2(0, 0), new Vector2(32, 0), new Vector2(32, 32), new Vector2(0, 32)];
3002
- * maskRenderer.color = "#000000";
3003
- * maskRenderer.offset = new Vector2(0, 0);
3004
- * maskRenderer.opacity = 1;
3005
- * maskRenderer.layer = "Default";
3521
+ * const maskRenderer = new MaskRenderer({
3522
+ * shape: MaskShape.Polygon,
3523
+ * vertexModel: [new Vector2(0, 0), new Vector2(32, 0), new Vector2(32, 32), new Vector2(0, 32)],
3524
+ * color: "#000000",
3525
+ * offset: new Vector2(0, 0),
3526
+ * opacity: 1,
3527
+ * layer: "Default"
3528
+ * });
3006
3529
  * ```
3007
3530
  */
3008
3531
  declare class MaskRenderer {
@@ -3032,10 +3555,21 @@ declare class MaskRenderer {
3032
3555
  }
3033
3556
 
3034
3557
  /**
3558
+ * DarknessRenderer component configuration
3035
3559
  * @public
3036
- * @category Components
3560
+ * @category Components Configuration
3561
+ * @example
3562
+ * ```js
3563
+ * const darknessRenderer = new DarknessRenderer({
3564
+ * width: 100,
3565
+ * height: 50,
3566
+ * color: "#000000",
3567
+ * opacity: 0.5,
3568
+ * layer: "Default"
3569
+ * });
3570
+ * ```
3037
3571
  */
3038
- interface ShadowRendererOptions {
3572
+ interface DarknessRendererOptions {
3039
3573
  width: number;
3040
3574
  height: number;
3041
3575
  color: string;
@@ -3043,33 +3577,69 @@ interface ShadowRendererOptions {
3043
3577
  layer: string;
3044
3578
  }
3045
3579
  /**
3580
+ * The DarknessRenderer component is used to render a darkness effect on the screen.\
3581
+ * It supports a rectangular darkness mask with configurable width, height, color, opacity, and render layer.\
3582
+ * This component works in conjunction with LightRenderer components in the scene - the darkness will
3583
+ * block and be affected by any lights that intersect with it.
3046
3584
  * @public
3047
3585
  * @category Components
3586
+ * @example
3587
+ * ```js
3588
+ * const darknessRenderer = new DarknessRenderer({
3589
+ * width: 100,
3590
+ * height: 50,
3591
+ * color: "#000000",
3592
+ * opacity: 0.5,
3593
+ * layer: "Default"
3594
+ * });
3595
+ * ```
3048
3596
  */
3049
- declare class ShadowRenderer {
3050
- /** Shadow width */
3597
+ declare class DarknessRenderer {
3598
+ /** Darkness rectangle width */
3051
3599
  width: number;
3052
- /** Shadow height */
3600
+ /** Darkness height */
3053
3601
  height: number;
3054
- /** Shadow color */
3602
+ /** Darkness color */
3055
3603
  color: string;
3056
- /** Shadow opacity between 0 and 1 */
3604
+ /** Darkness opacity between 0 and 1 */
3057
3605
  opacity: number;
3058
3606
  /** The render layer */
3059
3607
  layer: string;
3060
3608
  /** @internal */
3061
3609
  _boundingBox: Rectangle;
3062
3610
  /** @internal */
3063
- _renderData: ShadowRenderData;
3064
- constructor(options?: Partial<ShadowRendererOptions>);
3611
+ _renderData: DarknessRenderData;
3612
+ constructor(options?: Partial<DarknessRendererOptions>);
3065
3613
  }
3066
3614
 
3067
3615
  /**
3616
+ * SpriteRenderer component configuration
3068
3617
  * @public
3069
- * @category Components
3618
+ * @category Components Configuration
3619
+ * @example
3620
+ * ```js
3621
+ * const spriteRenderer = new SpriteRenderer({
3622
+ * image: this.assetManager.getImage("image.png"),
3623
+ * width: 1920,
3624
+ * height: 1080,
3625
+ * offset: new Vector2(0, 0),
3626
+ * flipHorizontally: false,
3627
+ * flipVertically: false,
3628
+ * rotation: 0,
3629
+ * opacity: 1,
3630
+ * maskColor: "#FF0000",
3631
+ * maskColorMix: 0,
3632
+ * tintColor: "#00FF00",
3633
+ * layer: "Default",
3634
+ * slice: {x: 0, y: 0, width: 1920, height: 1080},
3635
+ * scale: new Vector2(1, 1),
3636
+ * tiled: new Vector2(1, 1),
3637
+ * smooth: false
3638
+ * });
3639
+ * ```
3070
3640
  */
3071
3641
  interface SpriteRendererOptions {
3072
- image: HTMLImageElement;
3642
+ image: HTMLImageElement | string;
3073
3643
  layer: string;
3074
3644
  slice: Slice;
3075
3645
  smooth: boolean;
@@ -3087,33 +3657,39 @@ interface SpriteRendererOptions {
3087
3657
  tiled: Vector2;
3088
3658
  }
3089
3659
  /**
3660
+ * The SpriteRenderer component renders 2D images (sprites) to the screen.\
3661
+ * It supports features like image slicing, scaling, rotation, flipping, opacity, color masking and tinting.\
3662
+ * Images can be rendered with custom dimensions, positioned with offsets, and even tiled across an area.\
3663
+ * The component allows control over pixel smoothing and can be assigned to specific render layers.
3090
3664
  * @public
3091
3665
  * @category Components
3092
3666
  * @example
3093
3667
  * ```js
3094
- * spriteRenderer.image = this.assetManager.getImage("image.png");
3095
- * spriteRenderer.width = 1920;
3096
- * spriteRenderer.height = 1080;
3097
- * spriteRenderer.offset = new Vector2(0, 0);
3098
- * spriteRenderer.flipHorizontally = false;
3099
- * spriteRenderer.flipVertically = false;
3100
- * spriteRenderer.rotation = 0;
3101
- * spriteRenderer.opacity = 1;
3102
- * spriteRenderer.maskColor = "#FF0000";
3103
- * spriteRenderer.maskColorMix = 0;
3104
- * spriteRenderer.tintColor = "#00FF00";
3105
- * spriteRenderer.layer = "Default";
3106
- * spriteRenderer.slice = {x: 0, y:0, width: 1920, height: 1080};
3107
- * spriteRenderer.scale = new Vector2(1, 1);
3108
- * spriteRenderer.tiled = new Vector2(1, 1);
3109
- * spriteRenderer.smooth = false;
3668
+ * const spriteRenderer = new SpriteRenderer({
3669
+ * image: this.assetManager.getImage("image.png"),
3670
+ * width: 1920,
3671
+ * height: 1080,
3672
+ * offset: new Vector2(0, 0),
3673
+ * flipHorizontally: false,
3674
+ * flipVertically: false,
3675
+ * rotation: 0,
3676
+ * opacity: 1,
3677
+ * maskColor: "#FF0000",
3678
+ * maskColorMix: 0,
3679
+ * tintColor: "#00FF00",
3680
+ * layer: "Default",
3681
+ * slice: {x: 0, y: 0, width: 1920, height: 1080},
3682
+ * scale: new Vector2(1, 1),
3683
+ * tiled: new Vector2(1, 1),
3684
+ * smooth: false
3685
+ * });
3110
3686
  * ```
3111
3687
  */
3112
3688
  declare class SpriteRenderer {
3113
3689
  /** The render layer */
3114
3690
  layer: string;
3115
3691
  /** The image to render */
3116
- image: HTMLImageElement;
3692
+ image: HTMLImageElement | string;
3117
3693
  /** Cut the image based on straight coordinates starting from the top left downward */
3118
3694
  slice?: Slice;
3119
3695
  /** TRUE for smooth pixels (not recommended for pixel art) */
@@ -3156,8 +3732,40 @@ declare const defaultTextureAtlasOptions: {
3156
3732
  spacing: number;
3157
3733
  };
3158
3734
  /**
3735
+ * TextRenderer component configuration
3159
3736
  * @public
3160
- * @category Components
3737
+ * @category Components Configuration
3738
+ * @example
3739
+ * ```js
3740
+ * const textRenderer = new TextRenderer({
3741
+ * text: "Hello World!",
3742
+ * color: "#FFFFFF",
3743
+ * fontSize: 24,
3744
+ * width: 1920,
3745
+ * height: 32,
3746
+ * opacity: 1,
3747
+ * layer: "TextLayer",
3748
+ * orientation: TextOrientation.RightCenter,
3749
+ * shadow: {
3750
+ * color: "#00FF00",
3751
+ * offset: new Vector2(3, -3),
3752
+ * opacity: 0.5,
3753
+ * },
3754
+ * textureAtlas: {
3755
+ * charRanges: [32, 126, 161, 255, 0x3040, 0x309f],
3756
+ * fontSize: 64,
3757
+ * spacing: 4,
3758
+ * },
3759
+ * font: "Arial",
3760
+ * flipHorizontally: false,
3761
+ * flipVertically: false,
3762
+ * letterSpacing: 0,
3763
+ * lineHeight: 24,
3764
+ * offset: new Vector2(0, 0),
3765
+ * rotation: 0,
3766
+ * smooth: false,
3767
+ * });
3768
+ * ```
3161
3769
  */
3162
3770
  interface TextRendererOptions {
3163
3771
  /** The text color */
@@ -3214,7 +3822,13 @@ interface TextRendererOptions {
3214
3822
  width: number;
3215
3823
  }
3216
3824
  /**
3217
- * The TextRenderer component allows to render text using font families, colors, and other configuration options.
3825
+ * The TextRenderer component renders text to the screen with extensive customization options.\
3826
+ * It supports both web-safe and imported fonts, but works optimally with bitmap fonts.\
3827
+ * Under the hood, it generates a texture atlas containing all the characters needed for rendering.\
3828
+ * The atlas generation can be configured with custom character ranges, font sizes, and spacing.\
3829
+ * Text can be customized with font families, colors, sizing, orientation, shadows, letter spacing,\
3830
+ * line height, opacity, smoothing, and positioning. The component allows text to be rotated,\
3831
+ * flipped, and assigned to specific render layers.
3218
3832
  * @public
3219
3833
  * @category Components
3220
3834
  * @example
@@ -3320,8 +3934,34 @@ declare class TextRenderer {
3320
3934
  }
3321
3935
 
3322
3936
  /**
3937
+ * TilemapRenderer component configuration
3323
3938
  * @public
3324
- * @category Components
3939
+ * @category Components Configuration
3940
+ * @example
3941
+ * ```js
3942
+ * const tilemapRenderer = new TilemapRenderer({
3943
+ * layer: "Default",
3944
+ * tileset: {
3945
+ * image: this.assetManager.getImage("tileset.png"),
3946
+ * width: 10,
3947
+ * tileWidth: 32,
3948
+ * tileHeight: 32,
3949
+ * margin: new Vector2(0, 0),
3950
+ * spacing: new Vector2(0, 0)
3951
+ * },
3952
+ * data: [1, 2, 3, 4],
3953
+ * chunks: [],
3954
+ * width: 2,
3955
+ * height: 2,
3956
+ * tileWidth: 32,
3957
+ * tileHeight: 32,
3958
+ * tintColor: "#FFFFFF",
3959
+ * maskColor: "#FF0000",
3960
+ * maskColorMix: 0,
3961
+ * opacity: 1,
3962
+ * smooth: false
3963
+ * });
3964
+ * ```
3325
3965
  */
3326
3966
  interface TilemapRendererOptions {
3327
3967
  layer: string;
@@ -3339,9 +3979,38 @@ interface TilemapRendererOptions {
3339
3979
  smooth: boolean;
3340
3980
  }
3341
3981
  /**
3342
- * The TilemapRenderer component allows you to render a tile map defined by an array of tile ids, using an instance of the TileSet object.
3982
+ * The TilemapRenderer component renders 2D tile-based maps to the screen.\
3983
+ * It uses a tileset image as a source for individual tiles, which are arranged according to a provided array of tile IDs.\
3984
+ * The component supports features like tinting, masking, opacity control, and custom tile dimensions.\
3985
+ * Maps can be rendered in chunks for improved performance with large tilemaps, and tiles can be assigned to specific render layers.\
3986
+ * Each tile is referenced by an ID, with 0 representing empty space.
3343
3987
  * @public
3344
3988
  * @category Components
3989
+ * @example
3990
+ * ```js
3991
+ * const tilemapRenderer = new TilemapRenderer({
3992
+ * layer: "Default",
3993
+ * tileset: {
3994
+ * image: this.assetManager.getImage("tileset.png"),
3995
+ * width: 10,
3996
+ * tileWidth: 32,
3997
+ * tileHeight: 32,
3998
+ * margin: new Vector2(0, 0),
3999
+ * spacing: new Vector2(0, 0)
4000
+ * },
4001
+ * data: [1, 2, 3, 4],
4002
+ * chunks: [],
4003
+ * width: 2,
4004
+ * height: 2,
4005
+ * tileWidth: 32,
4006
+ * tileHeight: 32,
4007
+ * tintColor: "#FFFFFF",
4008
+ * maskColor: "#FF0000",
4009
+ * maskColorMix: 0,
4010
+ * opacity: 1,
4011
+ * smooth: false
4012
+ * });
4013
+ * ```
3345
4014
  */
3346
4015
  declare class TilemapRenderer {
3347
4016
  /** The render layer */
@@ -3377,13 +4046,16 @@ declare class TilemapRenderer {
3377
4046
  constructor(options?: Partial<TilemapRendererOptions>);
3378
4047
  }
3379
4048
  /**
3380
- * Tileset configuration to be used with the TilemapRenderer
4049
+ * The Tileset configuration defines the properties of a tileset used by the TilemapRenderer.\
4050
+ * It specifies the source image containing the tiles, the dimensions of the tileset and individual tiles,\
4051
+ * and optional margin and spacing between tiles. This configuration is essential for properly\
4052
+ * slicing and rendering tiles from the tileset image.
3381
4053
  * @public
3382
- * @category Components
4054
+ * @category Components Configuration
3383
4055
  */
3384
4056
  type Tileset = {
3385
4057
  /** The tileset image element */
3386
- image: HTMLImageElement;
4058
+ image: HTMLImageElement | string;
3387
4059
  width: number;
3388
4060
  tileWidth: number;
3389
4061
  tileHeight: number;
@@ -3395,7 +4067,7 @@ type Tileset = {
3395
4067
  /**
3396
4068
  * Chunk of tile data
3397
4069
  * @public
3398
- * @category Components
4070
+ * @category Components Configuration
3399
4071
  */
3400
4072
  type Chunk = {
3401
4073
  /** Array of tiles. ID 0 (zero) represents empty space.*/
@@ -3409,8 +4081,30 @@ type Chunk = {
3409
4081
  };
3410
4082
 
3411
4083
  /**
4084
+ * VideoRenderer component configuration
3412
4085
  * @public
3413
- * @category Components
4086
+ * @category Components Configuration
4087
+ * @example
4088
+ * ```js
4089
+ * const videoRenderer = new VideoRenderer({
4090
+ * video: this.assetManager.getVideo("video.mp4"),
4091
+ * width: 1920,
4092
+ * height: 1080,
4093
+ * offset: new Vector2(0, 0),
4094
+ * flipHorizontally: false,
4095
+ * flipVertically: false,
4096
+ * rotation: 0,
4097
+ * opacity: 1,
4098
+ * maskColor: "#FF0000",
4099
+ * maskColorMix: 0,
4100
+ * tintColor: "#00FF00",
4101
+ * layer: "Default",
4102
+ * slice: {x: 0, y: 0, width: 1920, height: 1080},
4103
+ * volume: 1,
4104
+ * loop: false,
4105
+ * fixedToTimeScale: false
4106
+ * });
4107
+ * ```
3414
4108
  */
3415
4109
  interface VideoRendererOptions {
3416
4110
  action: "play" | "pause" | "stop";
@@ -3427,32 +4121,38 @@ interface VideoRendererOptions {
3427
4121
  rotation: number;
3428
4122
  slice: Slice;
3429
4123
  tintColor: string;
3430
- video: HTMLVideoElement;
4124
+ video: HTMLVideoElement | string;
3431
4125
  volume: number;
3432
4126
  width: number;
3433
4127
  }
3434
4128
  /**
3435
- * The VideoRenderer component plays and renders a video element,
3436
- * and allows configuring options such as its dimensions, coloring, etc.
4129
+ * The VideoRenderer component renders video content to the screen.\
4130
+ * It supports features like video playback control, scaling, rotation, flipping, opacity, color masking and tinting.\
4131
+ * Videos can be rendered with custom dimensions, positioned with offsets, and sliced to show specific regions.\
4132
+ * The component provides control over looping, volume, time scaling, and can be assigned to specific render layers.\
4133
+ * Videos can be paused, played, and stopped programmatically.
3437
4134
  * @public
3438
4135
  * @category Components
3439
4136
  * @example
3440
4137
  * ```js
3441
- * videoRenderer.video = this.assetManager.getVideo("video.mp4");
3442
- * videoRenderer.width = 1920;
3443
- * videoRenderer.height = 1080;
3444
- * videoRenderer.offset = new Vector2(0, 0);
3445
- * videoRenderer.flipHorizontally = false;
3446
- * videoRenderer.flipVertically = false;
3447
- * videoRenderer.rotation = 0;
3448
- * videoRenderer.opacity = 1;
3449
- * videoRenderer.maskColor = "#FF0000";
3450
- * videoRenderer.maskColorMix = 0;
3451
- * videoRenderer.tintColor = "#00FF00";
3452
- * videoRenderer.layer = "Default";
3453
- * videoRenderer.slice = {x: 0, y:0, width: 1920, height: 1080};
3454
- * videoRenderer.volume = 1;
3455
- * videoRenderer.loop = false;
4138
+ * const videoRenderer = new VideoRenderer({
4139
+ * video: this.assetManager.getVideo("video.mp4"),
4140
+ * width: 1920,
4141
+ * height: 1080,
4142
+ * offset: new Vector2(0, 0),
4143
+ * flipHorizontally: false,
4144
+ * flipVertically: false,
4145
+ * rotation: 0,
4146
+ * opacity: 1,
4147
+ * maskColor: "#FF0000",
4148
+ * maskColorMix: 0,
4149
+ * tintColor: "#00FF00",
4150
+ * layer: "Default",
4151
+ * slice: {x: 0, y: 0, width: 1920, height: 1080},
4152
+ * volume: 1,
4153
+ * loop: false,
4154
+ * fixedToTimeScale: false
4155
+ * });
3456
4156
  * videoRenderer.play();
3457
4157
  * ```
3458
4158
  */
@@ -3488,7 +4188,7 @@ declare class VideoRenderer {
3488
4188
  /** Define a color for tinting the video */
3489
4189
  tintColor: string;
3490
4190
  /**The video element to render */
3491
- video: HTMLVideoElement;
4191
+ video: HTMLVideoElement | string;
3492
4192
  /** The volume of the video (between 1 and 0) */
3493
4193
  volume: number;
3494
4194
  /** Overwrite the original video width */
@@ -3513,7 +4213,8 @@ declare class VideoRenderer {
3513
4213
  }
3514
4214
 
3515
4215
  /**
3516
- * It represents a connected gamepad and has the information of all its buttons and axes..
4216
+ * Represents a connected gamepad controller and provides access to its button states and analog axes values.
4217
+ * Tracks digital button presses, analog stick positions, and d-pad inputs in a normalized format.
3517
4218
  * @public
3518
4219
  * @category Input
3519
4220
  * @example
@@ -3521,11 +4222,11 @@ declare class VideoRenderer {
3521
4222
  * const gamepad = this.inputManager.gamepads[0];
3522
4223
  *
3523
4224
  * if (gamepad.dpadAxes.x > 1) {
3524
- * // if the depad x-axis is pressed to the right, do some action
4225
+ * // if the d-pad x-axis is pressed to the right, do some action
3525
4226
  * }
3526
4227
  *
3527
4228
  * if (gamepad.rightFace) {
3528
- * // if the right face button is pressed, do some action
4229
+ * // if the right face button is pressed (Dual Shock: Square. Xbox: X. Nintendo: Y), do some action
3529
4230
  * }
3530
4231
  * ```
3531
4232
  */
@@ -3671,8 +4372,9 @@ type VibrationInput = {
3671
4372
  };
3672
4373
 
3673
4374
  /**
3674
- * Contains the keyboard information in the last frame.
3675
- * It uses the **code** property of the **js keyboard event**.
4375
+ * Tracks and provides access to keyboard input state from the previous frame.
4376
+ * Uses the standardized `code` property from JavaScript KeyboardEvents to identify keys.
4377
+ * Provides methods to check if individual keys or combinations of keys are pressed.
3676
4378
  * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
3677
4379
  * @public
3678
4380
  * @category Input
@@ -3749,7 +4451,8 @@ declare class Keyboard {
3749
4451
  }
3750
4452
 
3751
4453
  /**
3752
- * Contains the mouse information in the last frame
4454
+ * Stores the mouse state from the previous frame, including button states, cursor position,
4455
+ * movement status, and scroll wheel information
3753
4456
  * @public
3754
4457
  * @category Input
3755
4458
  * @example
@@ -3789,7 +4492,7 @@ declare class Mouse {
3789
4492
  }
3790
4493
 
3791
4494
  /**
3792
- * The information about one interaction with the screen
4495
+ * Represents a single touch or pointer interaction with the screen, including position and size information
3793
4496
  * @public
3794
4497
  * @category Input
3795
4498
  */
@@ -3800,7 +4503,8 @@ interface TouchInteraction {
3800
4503
  radius: Vector2;
3801
4504
  }
3802
4505
  /**
3803
- * Contains the information about the touch screen interaction
4506
+ * Tracks and provides access to touch screen input state from the previous frame. Supports multi-touch
4507
+ * by storing an array of active touch interactions, each containing position and size information.
3804
4508
  * @public
3805
4509
  * @category Input
3806
4510
  * @example
@@ -3824,7 +4528,52 @@ declare class TouchScreen {
3824
4528
  }
3825
4529
 
3826
4530
  /**
3827
- * Manages the input sources: Keyboard, Mouse, Gamepad, TouchScreen.
4531
+ * Manages input sources including keyboard, mouse, gamepad and touch screen interactions.\
4532
+ * Provides methods to check key states, mouse position/buttons, gamepad inputs and touch events.
4533
+ * @example
4534
+ * ```typescript
4535
+ * // Keyboard input
4536
+ * if (inputManager.keyboard.isPressed("Space")) {
4537
+ * // Jump action
4538
+ * }
4539
+ *
4540
+ * // Multiple key checks
4541
+ * if (inputManager.keyboard.orPressed(["Enter", "Space"])) {
4542
+ * // Action for either key pressed
4543
+ * }
4544
+ *
4545
+ * if (inputManager.keyboard.andPressed(["ControlLeft", "KeyC"])) {
4546
+ * // Action for both keys pressed together
4547
+ * }
4548
+ *
4549
+ * // Mouse input
4550
+ * const mousePos = inputManager.mouse.positionInViewport;
4551
+ * if (inputManager.mouse.leftButtonPressed) {
4552
+ * // Shoot action
4553
+ * }
4554
+ *
4555
+ * // Mouse wheel scrolling
4556
+ * const scrollAmount = inputManager.mouse.wheelScroll;
4557
+ *
4558
+ * // Gamepad input
4559
+ * const gamepad = inputManager.gamepads[0];
4560
+ * if (gamepad?.bottomFace) {
4561
+ * // Bottom face button pressed (A on Xbox, B on Nintendo, X on PlayStation)
4562
+ * }
4563
+ *
4564
+ * // Gamepad stick movement
4565
+ * const leftStickPos = gamepad?.leftStickAxes;
4566
+ * const rightStickPos = gamepad?.rightStickAxes;
4567
+ *
4568
+ * // Gamepad vibration
4569
+ * gamepad?.vibrate(200, 0.5, 0.5);
4570
+ *
4571
+ * // Touch input
4572
+ * if (inputManager.touchScreen.touching) {
4573
+ * const touch = inputManager.touchScreen.interactions[0];
4574
+ * // Handle touch at touch.positionInViewport
4575
+ * }
4576
+ * ```
3828
4577
  * @public
3829
4578
  * @category Managers
3830
4579
  */
@@ -3841,8 +4590,15 @@ declare class InputManager {
3841
4590
  }
3842
4591
 
3843
4592
  /**
3844
- * Abstract class which can be used to create Systems.\
3845
- * It includes the following dependencies: EntityManager, AssetManager, SceneManager, TimeManager, InputManager, CollisionRepository.
4593
+ * Abstract base class for creating game systems with commonly needed dependencies injected.\
4594
+ * Provides access to the following core managers and services:\
4595
+ * - EntityManager: For managing game entities and components\
4596
+ * - AssetManager: For loading and managing game resources\
4597
+ * - SceneManager: For controlling scene transitions and state\
4598
+ * - TimeManager: For handling game timing and delta time\
4599
+ * - InputManager: For processing keyboard, mouse and touch input\
4600
+ * - CollisionRepository: For physics and collision detection\
4601
+ * - GameConfig: For accessing game configuration settings
3846
4602
  * @public
3847
4603
  * @category Core
3848
4604
  * @example
@@ -3870,7 +4626,9 @@ declare abstract class GameSystem implements System {
3870
4626
  }
3871
4627
 
3872
4628
  /**
3873
- * Decorator to indicate that the target system will run in the game logic loop.
4629
+ * Decorator to indicate that the target system will run in the game logic loop.\
4630
+ * Game logic systems handle core gameplay mechanics, AI behavior, input processing,\
4631
+ * and other non-physics, non-rendering game state updates that occur each frame.
3874
4632
  * @public
3875
4633
  * @category Decorators
3876
4634
  * @example
@@ -3882,7 +4640,9 @@ declare abstract class GameSystem implements System {
3882
4640
  */
3883
4641
  declare function gameLogicSystem(): (target: SystemType) => void;
3884
4642
  /**
3885
- * Decorator to indicate that the target system will run in the physics loop.
4643
+ * Decorator to indicate that the target system will run in the physics loop.\
4644
+ * Physics systems handle physics calculations, collisions, and other physics-related updates.\
4645
+ * They typically run at a lower frequency than game logic systems to ensure accurate physics simulations.
3886
4646
  * @public
3887
4647
  * @category Decorators
3888
4648
  * @example
@@ -3894,7 +4654,10 @@ declare function gameLogicSystem(): (target: SystemType) => void;
3894
4654
  */
3895
4655
  declare function gamePhysicsSystem(): (target: SystemType) => void;
3896
4656
  /**
3897
- * Decorator to indicate that the target system will be executed at the begining of the render loop.
4657
+ * Decorator to indicate that the target system will be executed at the begining of the render loop.\
4658
+ * Pre-render systems handle tasks that need to be completed before the final rendering step.\
4659
+ * They are useful for tasks like sorting sprites, updating UI elements, and positioning the camera before rendering,
4660
+ * along with other preparatory operations.
3898
4661
  * @public
3899
4662
  * @category Decorators
3900
4663
  * @example
@@ -3907,7 +4670,9 @@ declare function gamePhysicsSystem(): (target: SystemType) => void;
3907
4670
  declare function gamePreRenderSystem(): (target: SystemType) => void;
3908
4671
 
3909
4672
  /**
3910
- * Applies a decorator manually.
4673
+ * Applies a decorator manually to a target (class, property, or constructor parameter).\
4674
+ * This utility function simplifies the process of programmatically applying decorators without using the @ syntax.\
4675
+ * This is primarily useful in JavaScript where decorator syntax is not yet standardized.
3911
4676
  * @param decorator The decorator function to be applied.
3912
4677
  * @param target The target to which the decorator is applied (class, prototype, or constructor argument).
3913
4678
  * @param propertyKey The property name or constructor argument index (optional).
@@ -3937,9 +4702,26 @@ declare function gamePreRenderSystem(): (target: SystemType) => void;
3937
4702
  declare function decorate(decorator: (...args: any[]) => any, target: any, propertyKey?: string | symbol | number): void;
3938
4703
 
3939
4704
  /**
3940
- * Options for playSfx function.
4705
+ * Configuration options for playing sound effects with the playSfx function.
4706
+ * Allows specifying the audio source to play, optional volume level (0-1),
4707
+ * and whether the sound should loop continuously.
3941
4708
  * @public
3942
4709
  * @category Audio
4710
+ * @example
4711
+ * ```javascript
4712
+ * const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
4713
+ * playSfx({ audioSource });
4714
+ * ```
4715
+ * @example
4716
+ * ```javascript
4717
+ * const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
4718
+ * playSfx({ audioSource, volume: 0.5 });
4719
+ * ```
4720
+ * @example
4721
+ * ```javascript
4722
+ * const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
4723
+ * playSfx({ audioSource, loop: true });
4724
+ * ```
3943
4725
  */
3944
4726
  interface PlaySfxOptions {
3945
4727
  audioSource: HTMLAudioElement;
@@ -3947,8 +4729,9 @@ interface PlaySfxOptions {
3947
4729
  loop?: boolean;
3948
4730
  }
3949
4731
  /**
3950
- * This funciton is ideal to play one-shot sound effects. It will play the sound effect from the beginning, even if it's already playing.\
3951
- * You can also use this function to play audio tracks, but it is recommended to use the AudioPlayer component for this. The AudioPlayer component can handle the browser's autoplay policy and other audio-related functions.
4732
+ * Plays a sound effect from the beginning, even if it's currently playing. Ideal for one-shot sound effects like explosions, impacts, or UI feedback.\
4733
+ * While this function can play any audio, it's recommended to use the AudioPlayer component for background music or longer tracks.\
4734
+ * The AudioPlayer component provides additional features like handling browser autoplay policies, fading, and advanced playback control.
3952
4735
  * @param playSfxOptions - The options for playing the sound effect.
3953
4736
  * @public
3954
4737
  * @category Audio
@@ -3970,7 +4753,9 @@ interface PlaySfxOptions {
3970
4753
  */
3971
4754
  declare const playSfx: ({ audioSource, volume, loop }: PlaySfxOptions) => void;
3972
4755
  /**
3973
- * Stop a sound effect.
4756
+ * Stops a sound effect by pausing playback and resetting its position to the beginning.\
4757
+ * Useful for immediately silencing sound effects or interrupting looped audio.\
4758
+ * Note that this completely stops the audio - to temporarily pause, use audioSource.pause() directly.
3974
4759
  * @param audioSource - The audio source to stop.
3975
4760
  * @public
3976
4761
  * @category Audio
@@ -3985,9 +4770,9 @@ declare const stopSfx: (audioSource: HTMLAudioElement) => void;
3985
4770
  /**
3986
4771
  * Symbols to be used as dependency identifiers
3987
4772
  * @public
3988
- * @category Config
4773
+ * @category Decorators
3989
4774
  */
3990
- declare const Symbols: {
4775
+ declare const BuiltInDependencyIdentifiers: {
3991
4776
  AssetManager: symbol;
3992
4777
  CanvasElement: symbol;
3993
4778
  CollisionRepository: symbol;
@@ -3999,4 +4784,4 @@ declare const Symbols: {
3999
4784
  TimeManager: symbol;
4000
4785
  };
4001
4786
 
4002
- export { Animation, type AnimationSlice, Animator, type AnimatorOptions, type Archetype, type ArchetypeComponent, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, type AudioPlayerState, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchCriteria, type SearchResult, ShadowRenderer, type ShadowRendererOptions, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, Symbols, type System, type SystemGroup, SystemManager, type SystemType, TextOrientation, TextRenderer, type TextRendererOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, debugRenderLayer, decorate, defaultRenderLayer, defaultTextureAtlasOptions, degreesToRadians, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, playSfx, radiansToDegrees, randomFloat, randomInt, range, rgbToHex, stopSfx };
4787
+ export { Animation, type AnimationOptions, type AnimationSlice, Animator, type AnimatorOptions, type Archetype, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, type AudioPlayerState, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, BuiltInDependencyIdentifiers, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, DarknessRenderer, type DarknessRendererOptions, type DependencyName, type DependencyType, type DisabledComponent, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchResult, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, type System, type SystemGroup, SystemManager, type SystemType, TextOrientation, TextRenderer, type TextRendererOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, debugRenderLayer, decorate, defaultRenderLayer, defaultTextureAtlasOptions, degreesToRadians, disableComponent, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, playSfx, radiansToDegrees, randomFloat, randomInt, range, rgbToHex, stopSfx };