angry-pixel 2.1.2 → 2.1.3

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,65 @@ type SearchResult<T extends Component> = {
648
721
  component: T;
649
722
  };
650
723
  /**
651
- * This type represents a search criteria object
724
+ * This type represents a search criteria object used to filter components when searching for entities.\
725
+ * It defines a set of key-value pairs where the keys correspond to component properties\
726
+ * and the values are the criteria to match against those properties.
652
727
  * @public
653
728
  * @category Entity-Component-System
654
729
  */
655
- type SearchCriteria = {
656
- [key: string]: any;
657
- };
730
+ type SearchCriteria = Record<string, any>;
658
731
  /**
659
- * This type represents an Entity Archetype
732
+ * This type represents an Entity Archetype, which defines a template for creating entities with a specific set of components.\
733
+ * It specifies which components should be attached to the entity, whether the entity should be enabled/disabled,\
734
+ * and can include child archetypes to create hierarchical entity structures.
660
735
  * @public
661
736
  * @category Entity-Component-System
737
+ * @example
738
+ * ```typescript
739
+ * // Define an archetype for a player entity with multiple components
740
+ * const playerArchetype: Archetype = {
741
+ * components: [
742
+ * new Transform({position: new Vector2(0, 0)}),
743
+ * new Player({health: 100}),
744
+ * new SpriteRenderer({sprite: 'player.png'})
745
+ * ],
746
+ * };
747
+ *
748
+ * // Define an archetype with disabled components and child entities
749
+ * const enemyArchetype: Archetype = {
750
+ * components: [
751
+ * new Transform(),
752
+ * new Enemy(),
753
+ * disableComponent(new BoxCollider()) // This component starts disabled
754
+ * ],
755
+ * children: [
756
+ * {
757
+ * components: [new WeaponMount()],
758
+ * enabled: false // This child entity starts disabled
759
+ * }
760
+ * ],
761
+ * };
762
+ * ```
662
763
  */
663
764
  type Archetype = {
664
- components: (ArchetypeComponent | Component)[];
765
+ components: (Component | ComponentType | DisabledComponent)[];
665
766
  children?: Archetype[];
666
767
  enabled?: boolean;
667
768
  };
668
769
  /**
669
- * This type represents an Entity Archetype Component
770
+ * This type represents a disabled component
670
771
  * @public
671
772
  * @category Entity-Component-System
672
773
  */
673
- type ArchetypeComponent<T extends Component = Component> = {
674
- type: ComponentType<T>;
675
- data?: Partial<T>;
676
- enabled?: boolean;
774
+ type DisabledComponent = {
775
+ enabled: false;
776
+ component: Component | ComponentType;
677
777
  };
678
778
  /**
679
- * This interface is used for the creation of system classes. You will have to inject the dependencies you need manully.
779
+ * This interface defines the core structure for system classes in the ECS architecture.\
780
+ * Systems contain the game logic that operates on entities and their components.\
781
+ * Dependencies like EntityManager can be injected using dependency injection decorators.\
782
+ * Systems must implement onUpdate() and can optionally implement lifecycle hooks like onCreate(), onDestroy(), onEnabled() and onDisabled().
680
783
  * @public
681
784
  * @category Entity-Component-System
682
785
  * @example
@@ -720,7 +823,9 @@ interface System {
720
823
  onUpdate(): void;
721
824
  }
722
825
  /**
723
- * This type represents a system class
826
+ * This type represents a constructor type for System classes.\
827
+ * It defines the shape of a class that can be instantiated to create System objects.\
828
+ * Used for type-safe system registration and retrieval in the SystemManager.
724
829
  * @public
725
830
  * @category Entity-Component-System
726
831
  */
@@ -731,10 +836,58 @@ type SystemType<T extends System = System> = {
731
836
  type SystemGroup = string | number | symbol;
732
837
 
733
838
  /**
734
- * The EntityManager manages the entities and components.\
735
- * It provides the necessary methods for reading and writing entities and components.
839
+ * The EntityManager is responsible for managing the lifecycle and relationships of entities and components.\
840
+ * It provides methods for creating, reading, updating and deleting entities and their associated components.\
841
+ * Handles parent-child relationships between entities and enables/disables entities and components.\
842
+ * Acts as the central registry for all game objects and their behaviors.
736
843
  * @public
737
844
  * @category Entity-Component-System
845
+ * @example
846
+ * ```js
847
+ * // Create an entity with components
848
+ * const entity = entityManager.createEntity([
849
+ * new Transform({position: new Vector2(100, 100)}),
850
+ * new SpriteRenderer({sprite: "player.png"})
851
+ * ]);
852
+ *
853
+ * // Get a component from an entity
854
+ * const transform = entityManager.getComponent(entity, Transform);
855
+ *
856
+ * // Get all components from an entity
857
+ * const components = entityManager.getComponents(entity);
858
+ *
859
+ * // Find entity by component
860
+ * const entityWithSprite = entityManager.getEntityForComponent(spriteRenderer);
861
+ *
862
+ * // Update component data
863
+ * entityManager.updateComponentData(entity, Transform, {
864
+ * position: new Vector2(200, 200)
865
+ * });
866
+ *
867
+ * // Create parent-child relationship
868
+ * const child = entityManager.createEntity([Transform], parent);
869
+ * // or if you already have the child entity
870
+ * entityManager.setParent(child, parent);
871
+ *
872
+ * // Enable/disable entities
873
+ * entityManager.disableEntity(entity);
874
+ * entityManager.enableEntity(entity);
875
+ *
876
+ * // Remove components
877
+ * entityManager.removeComponent(entity, SpriteRenderer);
878
+ * entityManager.removeComponent(spriteRenderer);
879
+ *
880
+ * // Search for entities with specific components
881
+ * const searchResult = entityManager.search(SpriteRenderer);
882
+ * searchResult.forEach(({component, entity}) => {
883
+ * // do something with the component and entity
884
+ * })
885
+ *
886
+ * const searchResult = entityManager.search(Enemy, {status: "alive"});
887
+ * searchResult.forEach(({component, entity}) => {
888
+ * // do something with the component and entity
889
+ * })
890
+ * ```
738
891
  */
739
892
  declare class EntityManager {
740
893
  private lastEntityId;
@@ -757,85 +910,10 @@ declare class EntityManager {
757
910
  */
758
911
  createEntity(): Entity;
759
912
  /**
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
913
+ * Creates an Entity with the given components.\
914
+ * Since the components are not cloned, the collection of components must not be reused.
838
915
  * @param components A collection of component instances and component classes
916
+ * @param parent The parent entity (optional)
839
917
  * @return The created Entity
840
918
  * @public
841
919
  * @example
@@ -846,32 +924,35 @@ declare class EntityManager {
846
924
  * ]);
847
925
  * ```
848
926
  */
849
- createEntity(components: Array<ComponentType | Component>, parent?: Entity): Entity;
850
- private createEntityFromComponents;
851
- private createEntityFromArchetype;
927
+ createEntity(components: (ComponentType | Component)[], parent?: Entity): Entity;
852
928
  /**
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
929
+ * Creates an Entity based on an Archetype.\
930
+ * Since the components are cloned, the archetype can be reused to create multiple entities.
931
+ * @param archetype The archetype to create the entity from
932
+ * @param parent The parent entity (optional)
933
+ * @returns The created Entity
856
934
  * @public
857
935
  * @example
858
936
  * ```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]);
937
+ * const archetype = {
938
+ * components: [
939
+ * new Transform({position: new Vector2(100, 100)}),
940
+ * SpriteRenderer
941
+ * ],
942
+ * children: [childArchetype],
943
+ * enabled: true
944
+ * }
945
+ * const entity = entityManager.createEntityFromArchetype(archetype);
872
946
  * ```
873
947
  */
874
- createEntities(componentsList: Array<ComponentType | Component>[]): Entity[];
948
+ createEntityFromArchetype({ components, children, enabled }: Archetype, parent?: Entity): Entity;
949
+ /**
950
+ * Creates components from an archetype
951
+ * @param components The components to create
952
+ * @param entity The entity to create the components for
953
+ * @private
954
+ */
955
+ private createComponentsFromArchetype;
875
956
  /**
876
957
  * Removes an Entity and all its Components
877
958
  * @param entity The entity to remove
@@ -1074,6 +1155,18 @@ declare class EntityManager {
1074
1155
  * ```
1075
1156
  */
1076
1157
  getComponents(entity: Entity): Component[];
1158
+ /**
1159
+ * Updates the data of a component instance
1160
+ * @param entity The entity
1161
+ * @param componentType The component type
1162
+ * @param data The data to update
1163
+ * @public
1164
+ * @example
1165
+ * ```js
1166
+ * entityManager.updateComponentData(entity, Transform, { position: new Vector2(100, 100) });
1167
+ * ```
1168
+ */
1169
+ updateComponentData<T extends Component = Component>(entity: Entity, componentType: ComponentType<T>, data: Partial<T>): void;
1077
1170
  /**
1078
1171
  * Searches for and returns an entity for the component instance
1079
1172
  * @param component The component instance
@@ -1282,8 +1375,10 @@ declare class EntityManager {
1282
1375
  }
1283
1376
 
1284
1377
  /**
1285
- * The SystemManager manages the systems.\
1286
- * It provides the necessary methods for reading and writing systems.
1378
+ * The SystemManager is responsible for managing the lifecycle and execution of game systems.\
1379
+ * It provides methods for adding, enabling, disabling and retrieving systems that operate on entities and components.\
1380
+ * Systems are organized into groups to control their execution order and update frequency.\
1381
+ * Acts as the central orchestrator for all game logic and behavior processing.
1287
1382
  * @public
1288
1383
  * @category Entity-Component-System
1289
1384
  */
@@ -1376,7 +1471,35 @@ declare class SystemManager {
1376
1471
  }
1377
1472
 
1378
1473
  /**
1379
- * Represent a collision. It contains the colliders involved, the entities, and the resolution data.
1474
+ * Creates a disabled component
1475
+ * @param component The component to disable
1476
+ * @returns The disabled component
1477
+ * @category Entity-Component-System
1478
+ * @public
1479
+ * @example
1480
+ * ```js
1481
+ * const disabledTransform = disableComponent(Transform);
1482
+ * ```
1483
+ */
1484
+ declare const disableComponent: (component: Component | ComponentType) => DisabledComponent;
1485
+
1486
+ /**
1487
+ * Represents a collision between two entities in the game world. It contains information about the colliding entities,
1488
+ * their collider components, and resolution data for handling the collision response.
1489
+ * @example
1490
+ * ```typescript
1491
+ * // Example collision between player and enemy
1492
+ * const collision: Collision = {
1493
+ * localEntity: playerEntity,
1494
+ * localCollider: playerCollider,
1495
+ * remoteEntity: enemyEntity,
1496
+ * remoteCollider: enemyCollider,
1497
+ * resolution: {
1498
+ * normal: new Vector2(1, 0),
1499
+ * depth: 5
1500
+ * }
1501
+ * };
1502
+ * ```
1380
1503
  * @category Collisions
1381
1504
  * @public
1382
1505
  */
@@ -1409,9 +1532,25 @@ interface Collision {
1409
1532
  }
1410
1533
 
1411
1534
  /**
1412
- * The CollisionRepository has the necessary methods to perform queries on the current collisions
1535
+ * The CollisionRepository stores and manages collision data between colliders.
1536
+ * It provides methods for querying collisions by collider and layer,
1537
+ * and handles persisting/removing collision records.
1413
1538
  * @public
1414
1539
  * @category Collisions
1540
+ * @example
1541
+ * ```typescript
1542
+ * // Get all collisions for a collider
1543
+ * const collisions = collisionRepository.findCollisionsForCollider(playerCollider);
1544
+ *
1545
+ * // Get collisions between player and enemies
1546
+ * const enemyCollisions = collisionRepository.findCollisionsForColliderAndLayer(
1547
+ * playerCollider,
1548
+ * "enemy"
1549
+ * );
1550
+ *
1551
+ * // Get all current collisions
1552
+ * const allCollisions = collisionRepository.findAll();
1553
+ * ```
1415
1554
  */
1416
1555
  declare class CollisionRepository {
1417
1556
  private collisions;
@@ -1448,7 +1587,10 @@ declare class CollisionRepository {
1448
1587
  type CollisionMatrix = [string, string][];
1449
1588
 
1450
1589
  /**
1451
- * Game configuration options
1590
+ * Configuration options for initializing and customizing game behavior.
1591
+ * Includes settings for canvas dimensions, debug visualization, physics simulation,
1592
+ * collision detection, and dependency injection.\
1593
+ * Required for creating a new Game instance.
1452
1594
  * @public
1453
1595
  * @category Config
1454
1596
  * @example
@@ -1524,7 +1666,9 @@ declare class CreateSystemService {
1524
1666
  }
1525
1667
 
1526
1668
  /**
1527
- * Manages the asset loading (images, fonts, audios, videos).
1669
+ * Manages loading and retrieval of game assets including images, fonts, audio files, videos and JSON data.\
1670
+ * Provides methods to load assets asynchronously and check their loading status.\
1671
+ * Assets can be referenced by URL or optional name identifiers.
1528
1672
  * @public
1529
1673
  * @category Managers
1530
1674
  * @example
@@ -1533,12 +1677,14 @@ declare class CreateSystemService {
1533
1677
  * this.assetManager.loadAudio("audio.ogg");
1534
1678
  * this.assetManager.loadVideo("video.mp4");
1535
1679
  * this.assetManager.loadFont("custom-font", "custom-font.ttf");
1680
+ * this.assetManager.loadJson("data.json");
1536
1681
  *
1537
1682
  * const imageElement = this.assetManager.getImage("image.png");
1538
1683
  * const audioElement = this.assetManager.getAudio("audio.ogg");
1539
1684
  * const videoElement = this.assetManager.getVideo("video.mp4");
1540
1685
  * const fontFace = this.assetManager.getFont("custom-font");
1541
- *
1686
+ * const jsonData = this.assetManager.getJson("data.json");
1687
+
1542
1688
  * if (this.assetManager.getAssetsLoaded()) {
1543
1689
  * // do something when assets are loaded
1544
1690
  * }
@@ -1645,18 +1791,37 @@ declare class AssetManager {
1645
1791
  }
1646
1792
 
1647
1793
  /**
1648
- * Options for setting an interval.
1794
+ * Options for configuring an interval timer.
1795
+ * @property {Function} callback - The function to execute at each interval
1796
+ * @property {number} delay - The time in milliseconds between each execution
1797
+ * @property {number} [times] - Optional number of times to execute before auto-clearing. Omit for infinite execution.
1798
+ * @property {boolean} [executeImmediately] - Whether to execute the callback immediately before starting the interval timer
1649
1799
  * @public
1650
1800
  * @category Managers
1801
+ * @example
1802
+ * ```ts
1803
+ * const intervalId = timeManager.setInterval({
1804
+ * callback: () => console.log("Will be called 5 times!"),
1805
+ * delay: 1000,
1806
+ * times: 5,
1807
+ * });
1808
+ * ```
1651
1809
  */
1652
1810
  type IntervalOptions = {
1811
+ /** The function to execute at each interval */
1653
1812
  callback: () => void;
1813
+ /** The time in milliseconds between each execution */
1654
1814
  delay: number;
1815
+ /** Optional number of times to execute before auto-clearing. Omit for infinite execution. */
1655
1816
  times?: number;
1817
+ /** Whether to execute the callback immediately before starting the interval timer */
1656
1818
  executeImmediately?: boolean;
1657
1819
  };
1658
1820
  /**
1659
- * Manages the properties associated with time.
1821
+ * Manages the properties associated with time.\
1822
+ * Provides methods to set intervals, clear intervals, and manage time scaling.\
1823
+ * Manages the fixed game framerate and physics framerate.\
1824
+ * Manages the fixed game delta time and physics delta time.
1660
1825
  * @public
1661
1826
  * @category Managers
1662
1827
  * @example
@@ -1784,13 +1949,17 @@ declare class TimeManager {
1784
1949
  /**
1785
1950
  * This type represents a scene class
1786
1951
  * @public
1787
- * @category Core
1952
+ * @category Managers
1788
1953
  */
1789
1954
  type SceneType<T extends Scene = Scene> = {
1790
1955
  new (entityManager: EntityManager, assetManager: AssetManager): T;
1791
1956
  };
1792
1957
  /**
1793
- * Base class for all game scenes
1958
+ * Base class for all game scenes.\
1959
+ * Provides core functionality for loading assets, registering systems, and setting up entities.\
1960
+ * Scenes are the main organizational unit for game states and levels.\
1961
+ * Each scene has access to the EntityManager for creating/managing entities and the AssetManager
1962
+ * for loading and accessing game resources.
1794
1963
  * @public
1795
1964
  * @category Core
1796
1965
  * @example
@@ -1826,7 +1995,9 @@ declare abstract class Scene {
1826
1995
  setup(): void;
1827
1996
  }
1828
1997
  /**
1829
- * Manges the loading of the scenes.
1998
+ * Manages scene loading, transitions and lifecycle.\
1999
+ * Provides methods to register scenes, load scenes by name, and handles the opening scene.\
2000
+ * Ensures proper cleanup between scene transitions and maintains scene state.
1830
2001
  * @public
1831
2002
  * @category Managers
1832
2003
  * @example
@@ -1859,11 +2030,17 @@ declare class SceneManager {
1859
2030
  }
1860
2031
 
1861
2032
  /**
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.
2033
+ * The Game class is the core entry point for creating and managing a game instance.\
2034
+ * It serves as a central hub that coordinates all game systems including scenes, entities,
2035
+ * components, and various managers (rendering, physics, input, etc.).\
2036
+ * The class provides methods to initialize the game with custom configuration, add scenes
2037
+ * and dependencies, and control the game loop execution.\
2038
+ * Through dependency injection, it ensures proper initialization and communication between all game systems.
1863
2039
  * @public
1864
2040
  * @category Core
1865
2041
  * @example
1866
2042
  * ```js
2043
+ * // Basic game setup with minimal configuration
1867
2044
  * const game = new Game({
1868
2045
  * containerNode: document.getElementById("app"),
1869
2046
  * width: 1920,
@@ -1874,6 +2051,7 @@ declare class SceneManager {
1874
2051
  * ```
1875
2052
  * @example
1876
2053
  * ```js
2054
+ * // Advanced game setup with custom physics and collision settings
1877
2055
  * const game = new Game({
1878
2056
  * containerNode: document.getElementById("app"),
1879
2057
  * width: 1920,
@@ -1934,8 +2112,35 @@ declare class Game {
1934
2112
  }
1935
2113
 
1936
2114
  /**
2115
+ * Animator component configuration
1937
2116
  * @public
1938
- * @category Components
2117
+ * @category Components Configuration
2118
+ * @example
2119
+ * ```js
2120
+ * const walkAnimation = new Animation({
2121
+ * image: "walk.png",
2122
+ * slice: { size: new Vector2(32, 32) },
2123
+ * fps: 12,
2124
+ * loop: true
2125
+ * });
2126
+ *
2127
+ * const idleAnimation = new Animation({
2128
+ * image: "idle.png",
2129
+ * slice: { size: new Vector2(32, 32) },
2130
+ * fps: 8,
2131
+ * loop: true
2132
+ * });
2133
+ *
2134
+ * const animator = new Animator({
2135
+ * animations: new Map([
2136
+ * ["walk", walkAnimation],
2137
+ * ["idle", idleAnimation]
2138
+ * ]),
2139
+ * animation: "idle",
2140
+ * speed: 1,
2141
+ * playing: true
2142
+ * });
2143
+ * ```
1939
2144
  */
1940
2145
  interface AnimatorOptions {
1941
2146
  animations: Map<string, Animation>;
@@ -1944,8 +2149,36 @@ interface AnimatorOptions {
1944
2149
  playing: boolean;
1945
2150
  }
1946
2151
  /**
2152
+ * The Animator component manages sprite animations. It holds a map of named animations
2153
+ * and controls which animation is currently playing, its speed, and playback state.
1947
2154
  * @public
1948
2155
  * @category Components
2156
+ * @example
2157
+ * ```js
2158
+ * const walkAnimation = new Animation({
2159
+ * image: "walk.png",
2160
+ * slice: { size: new Vector2(32, 32) },
2161
+ * fps: 12,
2162
+ * loop: true
2163
+ * });
2164
+ *
2165
+ * const idleAnimation = new Animation({
2166
+ * image: "idle.png",
2167
+ * slice: { size: new Vector2(32, 32) },
2168
+ * fps: 8,
2169
+ * loop: true
2170
+ * });
2171
+ *
2172
+ * const animator = new Animator({
2173
+ * animations: new Map([
2174
+ * ["walk", walkAnimation],
2175
+ * ["idle", idleAnimation]
2176
+ * ]),
2177
+ * animation: "idle",
2178
+ * speed: 1,
2179
+ * playing: true
2180
+ * });
2181
+ * ```
1949
2182
  */
1950
2183
  declare class Animator {
1951
2184
  animations: Map<string, Animation>;
@@ -1957,23 +2190,95 @@ declare class Animator {
1957
2190
  currentTime: number;
1958
2191
  /** @internal */
1959
2192
  _currentAnimation: string;
2193
+ /** @internal */
2194
+ _assetsReady: boolean;
1960
2195
  constructor(options?: Partial<AnimatorOptions>);
1961
2196
  }
1962
2197
  /**
2198
+ * Animation configuration
1963
2199
  * @public
1964
- * @category Components
2200
+ * @category Components Configuration
2201
+ * @example
2202
+ * ```js
2203
+ * const walkAnimation = new Animation({
2204
+ * image: "walk.png",
2205
+ * slice: { size: new Vector2(32, 32) },
2206
+ * fps: 12,
2207
+ * loop: true
2208
+ * });
2209
+ *
2210
+ * const idleAnimation = new Animation({
2211
+ * image: "idle.png",
2212
+ * slice: { size: new Vector2(32, 32) },
2213
+ * fps: 8,
2214
+ * loop: true
2215
+ * });
2216
+ *
2217
+ * const animator = new Animator({
2218
+ * animations: new Map([
2219
+ * ["walk", walkAnimation],
2220
+ * ["idle", idleAnimation]
2221
+ * ]),
2222
+ * animation: "idle",
2223
+ * speed: 1,
2224
+ * playing: true
2225
+ * });
2226
+ * ```
2227
+ */
2228
+ interface AnimationOptions {
2229
+ image: HTMLImageElement | HTMLImageElement[] | string | string[];
2230
+ slice?: {
2231
+ size: Vector2;
2232
+ offset?: Vector2;
2233
+ padding?: Vector2;
2234
+ };
2235
+ frames?: number[];
2236
+ fps?: number;
2237
+ loop?: boolean;
2238
+ }
2239
+ /**
2240
+ * Animation class used to configure sprite animations. It defines properties like the source image(s),
2241
+ * slice dimensions for sprite sheets, frame sequence, playback speed and looping behavior.
2242
+ * @public
2243
+ * @category Components Configuration
2244
+ * @example
2245
+ * ```js
2246
+ * const walkAnimation = new Animation({
2247
+ * image: "walk.png",
2248
+ * slice: { size: new Vector2(32, 32) },
2249
+ * fps: 12,
2250
+ * loop: true
2251
+ * });
2252
+ *
2253
+ * const idleAnimation = new Animation({
2254
+ * image: "idle.png",
2255
+ * slice: { size: new Vector2(32, 32) },
2256
+ * fps: 8,
2257
+ * loop: true
2258
+ * });
2259
+ *
2260
+ * const animator = new Animator({
2261
+ * animations: new Map([
2262
+ * ["walk", walkAnimation],
2263
+ * ["idle", idleAnimation]
2264
+ * ]),
2265
+ * animation: "idle",
2266
+ * speed: 1,
2267
+ * playing: true
2268
+ * });
2269
+ * ```
1965
2270
  */
1966
2271
  declare class Animation {
1967
- image: HTMLImageElement | HTMLImageElement[];
2272
+ image: HTMLImageElement | HTMLImageElement[] | string | string[];
1968
2273
  slice: AnimationSlice;
1969
2274
  frames: number[];
1970
2275
  fps: number;
1971
2276
  loop: boolean;
1972
- constructor(options?: Partial<Animation>);
2277
+ constructor(options?: AnimationOptions);
1973
2278
  }
1974
2279
  /**
1975
2280
  * @public
1976
- * @category Components
2281
+ * @category Components Configuration
1977
2282
  */
1978
2283
  type AnimationSlice = {
1979
2284
  size: Vector2;
@@ -1982,14 +2287,24 @@ type AnimationSlice = {
1982
2287
  };
1983
2288
 
1984
2289
  /**
2290
+ * AudioPlayer component configuration
1985
2291
  * @public
1986
- * @category Components
2292
+ * @category Components Configuration
2293
+ * @example
2294
+ * ```js
2295
+ * const audioPlayer = new AudioPlayer({
2296
+ * audioSource: "sound.mp3",
2297
+ * volume: 0.5,
2298
+ * loop: true,
2299
+ * fixedToTimeScale: false
2300
+ * });
2301
+ * ```
1987
2302
  */
1988
2303
  interface AudioPlayerOptions {
1989
2304
  /** The action to perform with the audio source. */
1990
2305
  action: AudioPlayerAction;
1991
2306
  /** The audio source to play. */
1992
- audioSource: HTMLAudioElement;
2307
+ audioSource: HTMLAudioElement | string;
1993
2308
  /** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
1994
2309
  fixedToTimeScale: boolean;
1995
2310
  /** TRUE If the audio source should loop. */
@@ -1998,14 +2313,25 @@ interface AudioPlayerOptions {
1998
2313
  volume: number;
1999
2314
  }
2000
2315
  /**
2316
+ * The AudioPlayer component handles audio playback in the game. It manages playing, pausing and stopping audio sources,
2317
+ * controls volume and looping behavior, and can optionally sync playback speed with the game's time scale.
2001
2318
  * @public
2002
2319
  * @category Components
2320
+ * @example
2321
+ * ```js
2322
+ * const audioPlayer = new AudioPlayer({
2323
+ * audioSource: "sound.mp3",
2324
+ * volume: 0.5,
2325
+ * loop: true,
2326
+ * fixedToTimeScale: false
2327
+ * });
2328
+ * ```
2003
2329
  */
2004
2330
  declare class AudioPlayer {
2005
2331
  /** The action to perform with the audio source. This action will be erased at the end of the frame */
2006
2332
  action: AudioPlayerAction;
2007
2333
  /** The audio source to play. */
2008
- audioSource: HTMLAudioElement;
2334
+ audioSource: HTMLAudioElement | string;
2009
2335
  /** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
2010
2336
  fixedToTimeScale: boolean;
2011
2337
  /** TRUE If the audio source should loop. */
@@ -2040,18 +2366,31 @@ declare class AudioPlayer {
2040
2366
  }
2041
2367
  /**
2042
2368
  * @public
2043
- * @category Components
2369
+ * @category Components Configuration
2044
2370
  */
2045
2371
  type AudioPlayerAction = "stop" | "play" | "pause";
2046
2372
  /**
2047
2373
  * @public
2048
- * @category Components
2374
+ * @category Components Configuration
2049
2375
  */
2050
2376
  type AudioPlayerState = "stopped" | "playing" | "paused";
2051
2377
 
2052
2378
  /**
2379
+ * Button component configuration
2053
2380
  * @public
2054
- * @category Components
2381
+ * @category Components Configuration
2382
+ * @example
2383
+ * ```js
2384
+ * const button = new Button({
2385
+ * shape: ButtonShape.Rectangle,
2386
+ * width: 100,
2387
+ * height: 50,
2388
+ * offset: new Vector2(0, 0),
2389
+ * touchEnabled: true,
2390
+ * onClick: () => console.log("Button clicked!"),
2391
+ * onPressed: () => console.log("Button pressed!")
2392
+ * });
2393
+ * ```
2055
2394
  */
2056
2395
  interface ButtonOptions {
2057
2396
  shape: ButtonShape;
@@ -2064,8 +2403,23 @@ interface ButtonOptions {
2064
2403
  onPressed: () => void;
2065
2404
  }
2066
2405
  /**
2406
+ * The Button component creates an interactive button that can be clicked or pressed.\
2407
+ * It supports rectangular or circular shapes and can be configured with dimensions,
2408
+ * position offset, touch input, and click/press event handlers.
2067
2409
  * @public
2068
2410
  * @category Components
2411
+ * @example
2412
+ * ```js
2413
+ * const button = new Button({
2414
+ * shape: ButtonShape.Rectangle,
2415
+ * width: 100,
2416
+ * height: 50,
2417
+ * offset: new Vector2(0, 0),
2418
+ * touchEnabled: true,
2419
+ * onClick: () => console.log("Button clicked!"),
2420
+ * onPressed: () => console.log("Button pressed!")
2421
+ * });
2422
+ * ```
2069
2423
  */
2070
2424
  declare class Button {
2071
2425
  /** The shape of the button */
@@ -2092,7 +2446,7 @@ declare class Button {
2092
2446
  }
2093
2447
  /**
2094
2448
  * @public
2095
- * @category Components
2449
+ * @category Components Configuration
2096
2450
  */
2097
2451
  declare enum ButtonShape {
2098
2452
  Rectangle = 0,
@@ -2100,25 +2454,56 @@ declare enum ButtonShape {
2100
2454
  }
2101
2455
 
2102
2456
  /**
2457
+ * TiledWrapper component configuration
2103
2458
  * @public
2104
- * @category Components
2459
+ * @category Components Configuration
2460
+ * @example
2461
+ * ```js
2462
+ * const tiledWrapper = new TiledWrapper({
2463
+ * tilemap: "tilemap.json",
2464
+ * layerToRender: "Ground"
2465
+ * });
2466
+ *
2467
+ * const tiledWrapper = new TiledWrapper({
2468
+ * tilemap: assetManager.getJson("tilemap.json"),
2469
+ * layerToRender: "Ground"
2470
+ * });
2471
+ * ```
2105
2472
  */
2106
2473
  interface TiledWrapperOptions {
2107
- tilemap: TiledTilemap;
2474
+ tilemap: TiledTilemap | string;
2108
2475
  layerToRender: string;
2109
2476
  }
2110
2477
  /**
2478
+ * The TiledWrapper component wraps a Tiled map editor tilemap and handles rendering a specific layer.\
2479
+ * It provides an interface between Tiled's map format and the engine's tilemap rendering system.
2111
2480
  * @public
2112
2481
  * @category Components
2482
+ * @example
2483
+ * ```js
2484
+ * const tiledWrapper = new TiledWrapper({
2485
+ * tilemap: {
2486
+ * width: 10,
2487
+ * height: 10,
2488
+ * infinite: false,
2489
+ * layers: [],
2490
+ * renderorder: "right-down",
2491
+ * tilesets: [{ firstgid: 1 }],
2492
+ * tilewidth: 32,
2493
+ * tileheight: 32
2494
+ * },
2495
+ * layerToRender: "Ground"
2496
+ * });
2497
+ * ```
2113
2498
  */
2114
2499
  declare class TiledWrapper {
2115
- tilemap: TiledTilemap;
2500
+ tilemap: TiledTilemap | string;
2116
2501
  layerToRender: string;
2117
2502
  constructor(options?: Partial<TiledWrapperOptions>);
2118
2503
  }
2119
2504
  /**
2120
2505
  * @public
2121
- * @category Components
2506
+ * @category Components Configuration
2122
2507
  */
2123
2508
  interface TiledTilemap {
2124
2509
  width: number;
@@ -2135,7 +2520,7 @@ interface TiledTilemap {
2135
2520
  }
2136
2521
  /**
2137
2522
  * @public
2138
- * @category Components
2523
+ * @category Components Configuration
2139
2524
  */
2140
2525
  interface TiledChunk {
2141
2526
  data: number[];
@@ -2147,7 +2532,7 @@ interface TiledChunk {
2147
2532
  }
2148
2533
  /**
2149
2534
  * @public
2150
- * @category Components
2535
+ * @category Components Configuration
2151
2536
  */
2152
2537
  interface TiledLayer {
2153
2538
  name: string;
@@ -2170,7 +2555,7 @@ interface TiledLayer {
2170
2555
  }
2171
2556
  /**
2172
2557
  * @public
2173
- * @category Components
2558
+ * @category Components Configuration
2174
2559
  */
2175
2560
  interface TiledObjectLayer {
2176
2561
  draworder: string;
@@ -2186,7 +2571,7 @@ interface TiledObjectLayer {
2186
2571
  }
2187
2572
  /**
2188
2573
  * @public
2189
- * @category Components
2574
+ * @category Components Configuration
2190
2575
  */
2191
2576
  interface TiledObject {
2192
2577
  gid: number;
@@ -2211,7 +2596,7 @@ interface TiledObject {
2211
2596
  }
2212
2597
  /**
2213
2598
  * @public
2214
- * @category Components
2599
+ * @category Components Configuration
2215
2600
  */
2216
2601
  interface TiledProperty {
2217
2602
  name: string;
@@ -2220,8 +2605,17 @@ interface TiledProperty {
2220
2605
  }
2221
2606
 
2222
2607
  /**
2608
+ * Transform component configuration
2223
2609
  * @public
2224
- * @category Components
2610
+ * @category Components Configuration
2611
+ * @example
2612
+ * ```js
2613
+ * const transform = new Transform({
2614
+ * position: new Vector2(100, 100),
2615
+ * scale: new Vector2(2, 2),
2616
+ * rotation: Math.PI / 4
2617
+ * });
2618
+ * ```
2225
2619
  */
2226
2620
  interface TransformOptions {
2227
2621
  position: Vector2;
@@ -2229,8 +2623,20 @@ interface TransformOptions {
2229
2623
  rotation: number;
2230
2624
  }
2231
2625
  /**
2626
+ * The Transform component defines an entity's position, scale and rotation in the game world.\
2627
+ * It can be nested under a parent transform to create hierarchical relationships, where child
2628
+ * transforms inherit and combine with their parent's transformations.\
2629
+ * The component provides both local and world-space values, and allows selectively ignoring parent transformations.
2232
2630
  * @public
2233
2631
  * @category Components
2632
+ * @example
2633
+ * ```js
2634
+ * const transform = new Transform({
2635
+ * position: new Vector2(100, 100),
2636
+ * scale: new Vector2(2, 2),
2637
+ * rotation: Math.PI / 4
2638
+ * });
2639
+ * ```
2234
2640
  */
2235
2641
  declare class Transform {
2236
2642
  /** Position relative to the zero point of the simulated world, or relative to the parent if it has one */
@@ -2239,11 +2645,17 @@ declare class Transform {
2239
2645
  scale: Vector2;
2240
2646
  /** Rotation expressed in radians */
2241
2647
  rotation: number;
2242
- /** The real position in the simulated world. It has the same value as `position` property if there is no parent */
2648
+ /** If TRUE, the parent position will be ignored */
2649
+ ignoreParentPosition: boolean;
2650
+ /** If TRUE, the parent scale will be ignored */
2651
+ ignoreParentScale: boolean;
2652
+ /** If TRUE, the parent rotation will be ignored */
2653
+ ignoreParentRotation: boolean;
2654
+ /** READONLY: The real position in the simulated world. It has the same value as `position` property if there is no parent */
2243
2655
  localPosition: Vector2;
2244
- /** The real scale in the simulated world. It has the same value as `scale` property if there is no parent */
2656
+ /** READONLY: The real scale in the simulated world. It has the same value as `scale` property if there is no parent */
2245
2657
  localScale: Vector2;
2246
- /** The real rotation in the simulated world. It has the same value as `rotation` property if there is no parent */
2658
+ /** READONLY: The real rotation in the simulated world. It has the same value as `rotation` property if there is no parent */
2247
2659
  localRotation: number;
2248
2660
  /** @internal */
2249
2661
  _awake: boolean;
@@ -2253,9 +2665,9 @@ declare class Transform {
2253
2665
  }
2254
2666
 
2255
2667
  /**
2256
- * Configuration object for BallCollider creation
2668
+ * BallCollider component configuration
2257
2669
  * @public
2258
- * @category Components
2670
+ * @category Components Configuration
2259
2671
  * @example
2260
2672
  * ```js
2261
2673
  * const ballCollider = new BallCollider({
@@ -2280,7 +2692,10 @@ interface BallColliderOptions {
2280
2692
  ignoreCollisionsWithLayers: string[];
2281
2693
  }
2282
2694
  /**
2283
- * Circumference shaped collider for 2d collisions.
2695
+ * The BallCollider component defines a circular collision shape for an entity.\
2696
+ * It can be used for both physics interactions and collision detection.\
2697
+ * The collider's size is determined by its radius, and it can be offset from the entity's position.\
2698
+ * Collision layers allow controlling which objects can collide with each other.
2284
2699
  * @public
2285
2700
  * @category Components
2286
2701
  * @example
@@ -2311,9 +2726,9 @@ declare class BallCollider implements Collider {
2311
2726
  }
2312
2727
 
2313
2728
  /**
2314
- * Configuration object for BoxCollider creation
2729
+ * BoxCollider component configuration
2315
2730
  * @public
2316
- * @category Components
2731
+ * @category Components Configuration
2317
2732
  * @example
2318
2733
  * ```js
2319
2734
  * const boxCollider = new BoxCollider({
@@ -2344,7 +2759,10 @@ interface BoxColliderOptions {
2344
2759
  ignoreCollisionsWithLayers: string[];
2345
2760
  }
2346
2761
  /**
2347
- * Rectangle shaped collider for 2d collisions.
2762
+ * The BoxCollider component defines a rectangular collision shape for an entity.\
2763
+ * It can be used for both physics interactions and collision detection.\
2764
+ * The collider's size is determined by its width and height, and it can be offset and rotated.\
2765
+ * Collision layers allow controlling which objects can collide with each other.
2348
2766
  * @public
2349
2767
  * @category Components
2350
2768
  * @example
@@ -2381,9 +2799,9 @@ declare class BoxCollider implements Collider {
2381
2799
  }
2382
2800
 
2383
2801
  /**
2384
- * Configuration object for EdgeCollider creation
2802
+ * EdgeCollider component configuration
2385
2803
  * @public
2386
- * @category Components
2804
+ * @category Components Configuration
2387
2805
  * @example
2388
2806
  * ```js
2389
2807
  * const edgeCollider = new EdgeCollider({
@@ -2411,7 +2829,10 @@ interface EdgeColliderOptions {
2411
2829
  ignoreCollisionsWithLayers: string[];
2412
2830
  }
2413
2831
  /**
2414
- * Collider composed of lines defined by its vertices, for 2d collisions.
2832
+ * The EdgeCollider component defines a collision shape made up of connected line segments.\
2833
+ * It can be used for both physics interactions and collision detection.\
2834
+ * The collider's shape is determined by a series of vertices that form edges between them.\
2835
+ * The shape can be offset and rotated, and collision layers allow controlling which objects can collide with each other.
2415
2836
  * @public
2416
2837
  * @category Components
2417
2838
  * @example
@@ -2444,9 +2865,9 @@ declare class EdgeCollider implements Collider {
2444
2865
  }
2445
2866
 
2446
2867
  /**
2447
- * Configuration object for PolygonCollider creation
2868
+ * PolygonCollider component configuration
2448
2869
  * @public
2449
- * @category Components
2870
+ * @category Components Configuration
2450
2871
  * @example
2451
2872
  * ```js
2452
2873
  * const polygonCollider = new PolygonCollider({
@@ -2474,7 +2895,11 @@ interface PolygonColliderOptions {
2474
2895
  ignoreCollisionsWithLayers: string[];
2475
2896
  }
2476
2897
  /**
2477
- * Polygon shaped Collider for 2d collisions. Only convex polygons are allowed.
2898
+ * The PolygonCollider component defines a convex polygon-shaped collision area for an entity.\
2899
+ * It can be used for both physics interactions and collision detection.\
2900
+ * The collider's shape is determined by a series of vertices that form a closed convex polygon.\
2901
+ * Note that only convex polygons are supported - concave shapes must be broken into multiple convex polygons.\
2902
+ * The shape can be offset and rotated, and collision layers allow controlling which objects can collide with each other.
2478
2903
  * @public
2479
2904
  * @category Components
2480
2905
  * @example
@@ -2512,7 +2937,7 @@ declare class PolygonCollider implements Collider {
2512
2937
  * - **Dynamic:** This type of body is affected by gravity and velocity and can be moved by other rigid bodies.
2513
2938
  * - **Kinematic:** This type of body is not affected by gravity and cannot be moved by other rigid bodies, but can be velocity applied.
2514
2939
  * - **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
2940
+ * @category Components Configuration
2516
2941
  * @public
2517
2942
  */
2518
2943
  declare enum RigidBodyType {
@@ -2523,7 +2948,7 @@ declare enum RigidBodyType {
2523
2948
  /**
2524
2949
  * RigidBody configuration options
2525
2950
  * @public
2526
- * @category Components
2951
+ * @category Components Configuration
2527
2952
  * @example
2528
2953
  * ```js
2529
2954
  const rigidBody = new RigidBody({
@@ -2574,13 +2999,19 @@ interface RigidBodyOptions {
2574
2999
  acceleration: Vector2;
2575
3000
  }
2576
3001
  /**
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.
3002
+ * The RigidBody component enables physics simulation for an entity, allowing it to interact with other physics-enabled objects in the game world.\
3003
+ * It defines how the entity behaves under forces like gravity, collisions, and applied velocities. The component supports three types of bodies:
3004
+ *
3005
+ * - **Dynamic:** Fully physics-simulated bodies that respond to forces, collisions, gravity, and can be moved by other rigid bodies.
3006
+ * Best for objects that need realistic physical behavior like players, projectiles, or items.
3007
+ *
3008
+ * - **Kinematic:** Bodies that can move with applied velocities but are not affected by gravity or collisions from other bodies.
3009
+ * Ideal for moving platforms, enemies with predefined paths, or objects that need controlled movement without full physics simulation.
3010
+ * More performance efficient than Dynamic bodies.
3011
+ *
3012
+ * - **Static:** Immobile bodies that act as solid, unmovable obstacles. They don't respond to any forces or collisions.
3013
+ * Perfect for level geometry, walls, or any unchanging collision objects.
3014
+ * The most performance efficient option as they require minimal physics calculations.
2584
3015
  * @public
2585
3016
  * @category Components
2586
3017
  * @example
@@ -2611,6 +3042,7 @@ declare class RigidBody {
2611
3042
  /**
2612
3043
  * The type of the rigid body to create:
2613
3044
  * - Dynamic: This type of body is affected by gravity and velocity.
3045
+ * - Kinematic: This type of body is not affected by gravity and cannot be moved by other rigid bodies, but can be velocity applied.
2614
3046
  * - Static: This type of body is immovable, is unaffected by velocity and gravity.
2615
3047
  * @public
2616
3048
  */
@@ -2634,9 +3066,9 @@ declare class RigidBody {
2634
3066
  }
2635
3067
 
2636
3068
  /**
2637
- * Configuration object for TilemapCollider creation
3069
+ * TilemapCollider component configuration
2638
3070
  * @public
2639
- * @category Components
3071
+ * @category Components Configuration
2640
3072
  * @example
2641
3073
  * ```js
2642
3074
  * const tilemapCollider = new TilemapCollider({
@@ -2661,8 +3093,12 @@ interface TilemapColliderOptions {
2661
3093
  physics: boolean;
2662
3094
  }
2663
3095
  /**
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.
3096
+ * The TilemapCollider component automatically generates collision shapes for tilemap edges.\
3097
+ * When composite is FALSE, it creates individual rectangle colliders for each edge tile.\
3098
+ * When composite is TRUE, it optimizes by generating connected line segments that follow the tilemap's outer edges.\
3099
+ * This is useful for efficiently handling collision detection with tilemap boundaries.\
3100
+ * **Limitations:** The collider shapes are generated once and cannot be modified after creation.
3101
+ * To update the collision shapes, you must create a new TilemapCollider instance.
2666
3102
  * @public
2667
3103
  * @category Components
2668
3104
  * @example
@@ -2715,7 +3151,7 @@ interface RenderData {
2715
3151
 
2716
3152
  /**
2717
3153
  * Mask shape: Rectangle or Circumference.
2718
- * @category Components
3154
+ * @category Components Configuration
2719
3155
  * @public
2720
3156
  */
2721
3157
  declare enum MaskShape {
@@ -2783,7 +3219,7 @@ interface SpriteRenderData extends RenderData {
2783
3219
  }
2784
3220
  /**
2785
3221
  * Cut the image based on straight coordinates starting from the top left downward.
2786
- * @category Components
3222
+ * @category Components Configuration
2787
3223
  * @public
2788
3224
  */
2789
3225
  interface Slice {
@@ -2799,7 +3235,7 @@ interface Slice {
2799
3235
 
2800
3236
  /**
2801
3237
  * Direction in which the text will be rendered.
2802
- * @category Components
3238
+ * @category Components Configuration
2803
3239
  * @public
2804
3240
  */
2805
3241
  declare enum TextOrientation {
@@ -2835,8 +3271,7 @@ interface TextRenderData extends RenderData {
2835
3271
 
2836
3272
  /**
2837
3273
  * Direction in which the tilemap will be rendered.
2838
- * @category Components
2839
- * @public
3274
+ * @internal
2840
3275
  */
2841
3276
  declare enum TilemapOrientation {
2842
3277
  Center = 0,
@@ -2846,23 +3281,8 @@ declare enum TilemapOrientation {
2846
3281
  }
2847
3282
  interface TilemapRenderData extends RenderData {
2848
3283
  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
- };
3284
+ tilemap: Tilemap;
3285
+ tileset: Tileset$1;
2866
3286
  smooth?: boolean;
2867
3287
  flipHorizontal?: boolean;
2868
3288
  flipVertical?: boolean;
@@ -2873,6 +3293,23 @@ interface TilemapRenderData extends RenderData {
2873
3293
  tintColor?: string;
2874
3294
  orientation?: TilemapOrientation;
2875
3295
  }
3296
+ type Tileset$1 = {
3297
+ image: HTMLImageElement;
3298
+ width: number;
3299
+ tileWidth: number;
3300
+ tileHeight: number;
3301
+ margin?: Vector2;
3302
+ spacing?: Vector2;
3303
+ correction?: Vector2;
3304
+ };
3305
+ type Tilemap = {
3306
+ width: number;
3307
+ tileWidth: number;
3308
+ tileHeight: number;
3309
+ height: number;
3310
+ realWidth: number;
3311
+ realHeight: number;
3312
+ };
2876
3313
 
2877
3314
  interface VideoRenderData extends RenderData {
2878
3315
  video: HTMLVideoElement;
@@ -2890,8 +3327,7 @@ interface VideoRenderData extends RenderData {
2890
3327
 
2891
3328
  /**
2892
3329
  * Default render layer
2893
- * @public
2894
- * @category Components
3330
+ * @internal
2895
3331
  */
2896
3332
  declare const defaultRenderLayer = "Default";
2897
3333
  /**
@@ -2900,8 +3336,18 @@ declare const defaultRenderLayer = "Default";
2900
3336
  */
2901
3337
  declare const debugRenderLayer = "Debug";
2902
3338
  /**
3339
+ * Camera component configuration
2903
3340
  * @public
2904
- * @category Components
3341
+ * @category Components Configuration
3342
+ * @example
3343
+ * ```js
3344
+ * const camera = new Camera({
3345
+ * layers: ["Default", "UI", "Background"],
3346
+ * zoom: 1.5,
3347
+ * depth: 0,
3348
+ * debug: true
3349
+ * });
3350
+ * ```
2905
3351
  */
2906
3352
  interface CameraOptions {
2907
3353
  layers: string[];
@@ -2910,8 +3356,20 @@ interface CameraOptions {
2910
3356
  debug: boolean;
2911
3357
  }
2912
3358
  /**
3359
+ * The Camera component controls what layers and objects are rendered to the screen.\
3360
+ * It supports multiple render layers, zoom level control, and depth ordering when using multiple cameras.\
3361
+ * Each camera can also optionally render debug information for development purposes.\
2913
3362
  * @public
2914
3363
  * @category Components
3364
+ * @example
3365
+ * ```js
3366
+ * const camera = new Camera({
3367
+ * layers: ["Default", "UI", "Background"],
3368
+ * zoom: 1.5,
3369
+ * depth: 0,
3370
+ * debug: true
3371
+ * });
3372
+ * ```
2915
3373
  */
2916
3374
  declare class Camera {
2917
3375
  /** Layers to be rendered by this camera. Layers are rendered in ascending order */
@@ -2928,8 +3386,18 @@ declare class Camera {
2928
3386
  }
2929
3387
 
2930
3388
  /**
3389
+ * LightRenderer component configuration
2931
3390
  * @public
2932
- * @category Components
3391
+ * @category Components Configuration
3392
+ * @example
3393
+ * ```js
3394
+ * const lightRenderer = new LightRenderer({
3395
+ * radius: 100,
3396
+ * smooth: true,
3397
+ * layer: "Default",
3398
+ * intensity: 0.8
3399
+ * });
3400
+ * ```
2933
3401
  */
2934
3402
  interface LightRendererOptions {
2935
3403
  radius: number;
@@ -2938,8 +3406,22 @@ interface LightRendererOptions {
2938
3406
  intensity: number;
2939
3407
  }
2940
3408
  /**
3409
+ * The LightRenderer component is used to render a light effect on the screen.\
3410
+ * It supports a circular light source with a specified radius and intensity.\
3411
+ * The light can be optionally smoothed for a softer edge effect.\
3412
+ * This component requires a ShadowRenderer component to be present in the scene to function properly,
3413
+ * as it works by illuminating areas within the shadow map.\
2941
3414
  * @public
2942
3415
  * @category Components
3416
+ * @example
3417
+ * ```js
3418
+ * const lightRenderer = new LightRenderer({
3419
+ * radius: 100,
3420
+ * smooth: true,
3421
+ * layer: "Default",
3422
+ * intensity: 0.8
3423
+ * });
3424
+ * ```
2943
3425
  */
2944
3426
  declare class LightRenderer {
2945
3427
  /** Light radius */
@@ -2956,8 +3438,44 @@ declare class LightRenderer {
2956
3438
  }
2957
3439
 
2958
3440
  /**
3441
+ * MaskRenderer component configuration
2959
3442
  * @public
2960
- * @category Components
3443
+ * @category Components Configuration
3444
+ * @example
3445
+ * ```js
3446
+ * const maskRenderer = new MaskRenderer({
3447
+ * shape: MaskShape.Rectangle,
3448
+ * width: 32,
3449
+ * height: 32,
3450
+ * color: "#000000",
3451
+ * offset: new Vector2(0, 0),
3452
+ * rotation: 0,
3453
+ * opacity: 1,
3454
+ * layer: "Default"
3455
+ * });
3456
+ * ```
3457
+ * @example
3458
+ * ```js
3459
+ * const maskRenderer = new MaskRenderer({
3460
+ * shape: MaskShape.Circumference,
3461
+ * radius: 16,
3462
+ * color: "#000000",
3463
+ * offset: new Vector2(0, 0),
3464
+ * opacity: 1,
3465
+ * layer: "Default"
3466
+ * });
3467
+ * ```
3468
+ * @example
3469
+ * ```js
3470
+ * const maskRenderer = new MaskRenderer({
3471
+ * shape: MaskShape.Polygon,
3472
+ * vertexModel: [new Vector2(0, 0), new Vector2(32, 0), new Vector2(32, 32), new Vector2(0, 32)],
3473
+ * color: "#000000",
3474
+ * offset: new Vector2(0, 0),
3475
+ * opacity: 1,
3476
+ * layer: "Default"
3477
+ * });
3478
+ * ```
2961
3479
  */
2962
3480
  interface MaskRendererOptions {
2963
3481
  shape: MaskShape;
@@ -2972,37 +3490,46 @@ interface MaskRendererOptions {
2972
3490
  layer: string;
2973
3491
  }
2974
3492
  /**
2975
- * Renders a filled shape (rectangle, circumference or polygon)
3493
+ * The MaskRenderer component renders filled shapes like rectangles, circles, or polygons.\
3494
+ * It supports different shape types with configurable dimensions, colors, positioning and rotation.\
3495
+ * Shapes can be rendered with variable opacity and assigned to specific render layers.\
3496
+ * This component is useful for creating UI elements, visual effects, or masking other rendered content.
2976
3497
  * @public
2977
3498
  * @category Components
2978
3499
  * @example
2979
3500
  * ```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";
3501
+ * const maskRenderer = new MaskRenderer({
3502
+ * shape: MaskShape.Rectangle,
3503
+ * width: 32,
3504
+ * height: 32,
3505
+ * color: "#000000",
3506
+ * offset: new Vector2(0, 0),
3507
+ * rotation: 0,
3508
+ * opacity: 1,
3509
+ * layer: "Default"
3510
+ * });
2988
3511
  * ```
2989
3512
  * @example
2990
3513
  * ```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";
3514
+ * const maskRenderer = new MaskRenderer({
3515
+ * shape: MaskShape.Circumference,
3516
+ * radius: 16,
3517
+ * color: "#000000",
3518
+ * offset: new Vector2(0, 0),
3519
+ * opacity: 1,
3520
+ * layer: "Default"
3521
+ * });
2997
3522
  * ```
2998
3523
  * @example
2999
3524
  * ```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";
3525
+ * const maskRenderer = new MaskRenderer({
3526
+ * shape: MaskShape.Polygon,
3527
+ * vertexModel: [new Vector2(0, 0), new Vector2(32, 0), new Vector2(32, 32), new Vector2(0, 32)],
3528
+ * color: "#000000",
3529
+ * offset: new Vector2(0, 0),
3530
+ * opacity: 1,
3531
+ * layer: "Default"
3532
+ * });
3006
3533
  * ```
3007
3534
  */
3008
3535
  declare class MaskRenderer {
@@ -3032,8 +3559,19 @@ declare class MaskRenderer {
3032
3559
  }
3033
3560
 
3034
3561
  /**
3562
+ * ShadowRenderer component configuration
3035
3563
  * @public
3036
- * @category Components
3564
+ * @category Components Configuration
3565
+ * @example
3566
+ * ```js
3567
+ * const shadowRenderer = new ShadowRenderer({
3568
+ * width: 100,
3569
+ * height: 50,
3570
+ * color: "#000000",
3571
+ * opacity: 0.5,
3572
+ * layer: "Default"
3573
+ * });
3574
+ * ```
3037
3575
  */
3038
3576
  interface ShadowRendererOptions {
3039
3577
  width: number;
@@ -3043,8 +3581,22 @@ interface ShadowRendererOptions {
3043
3581
  layer: string;
3044
3582
  }
3045
3583
  /**
3584
+ * The ShadowRenderer component is used to render a shadow effect on the screen.\
3585
+ * It supports a rectangular shadow with configurable width, height, color, opacity, and render layer.\
3586
+ * This component works in conjunction with LightRenderer components in the scene - the shadow will
3587
+ * block and be affected by any lights that intersect with it.\
3046
3588
  * @public
3047
3589
  * @category Components
3590
+ * @example
3591
+ * ```js
3592
+ * const shadowRenderer = new ShadowRenderer({
3593
+ * width: 100,
3594
+ * height: 50,
3595
+ * color: "#000000",
3596
+ * opacity: 0.5,
3597
+ * layer: "Default"
3598
+ * });
3599
+ * ```
3048
3600
  */
3049
3601
  declare class ShadowRenderer {
3050
3602
  /** Shadow width */
@@ -3065,11 +3617,33 @@ declare class ShadowRenderer {
3065
3617
  }
3066
3618
 
3067
3619
  /**
3620
+ * SpriteRenderer component configuration
3068
3621
  * @public
3069
- * @category Components
3622
+ * @category Components Configuration
3623
+ * @example
3624
+ * ```js
3625
+ * const spriteRenderer = new SpriteRenderer({
3626
+ * image: this.assetManager.getImage("image.png"),
3627
+ * width: 1920,
3628
+ * height: 1080,
3629
+ * offset: new Vector2(0, 0),
3630
+ * flipHorizontally: false,
3631
+ * flipVertically: false,
3632
+ * rotation: 0,
3633
+ * opacity: 1,
3634
+ * maskColor: "#FF0000",
3635
+ * maskColorMix: 0,
3636
+ * tintColor: "#00FF00",
3637
+ * layer: "Default",
3638
+ * slice: {x: 0, y: 0, width: 1920, height: 1080},
3639
+ * scale: new Vector2(1, 1),
3640
+ * tiled: new Vector2(1, 1),
3641
+ * smooth: false
3642
+ * });
3643
+ * ```
3070
3644
  */
3071
3645
  interface SpriteRendererOptions {
3072
- image: HTMLImageElement;
3646
+ image: HTMLImageElement | string;
3073
3647
  layer: string;
3074
3648
  slice: Slice;
3075
3649
  smooth: boolean;
@@ -3087,33 +3661,39 @@ interface SpriteRendererOptions {
3087
3661
  tiled: Vector2;
3088
3662
  }
3089
3663
  /**
3664
+ * The SpriteRenderer component renders 2D images (sprites) to the screen.\
3665
+ * It supports features like image slicing, scaling, rotation, flipping, opacity, color masking and tinting.\
3666
+ * Images can be rendered with custom dimensions, positioned with offsets, and even tiled across an area.\
3667
+ * The component allows control over pixel smoothing and can be assigned to specific render layers.
3090
3668
  * @public
3091
3669
  * @category Components
3092
3670
  * @example
3093
3671
  * ```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;
3672
+ * const spriteRenderer = new SpriteRenderer({
3673
+ * image: this.assetManager.getImage("image.png"),
3674
+ * width: 1920,
3675
+ * height: 1080,
3676
+ * offset: new Vector2(0, 0),
3677
+ * flipHorizontally: false,
3678
+ * flipVertically: false,
3679
+ * rotation: 0,
3680
+ * opacity: 1,
3681
+ * maskColor: "#FF0000",
3682
+ * maskColorMix: 0,
3683
+ * tintColor: "#00FF00",
3684
+ * layer: "Default",
3685
+ * slice: {x: 0, y: 0, width: 1920, height: 1080},
3686
+ * scale: new Vector2(1, 1),
3687
+ * tiled: new Vector2(1, 1),
3688
+ * smooth: false
3689
+ * });
3110
3690
  * ```
3111
3691
  */
3112
3692
  declare class SpriteRenderer {
3113
3693
  /** The render layer */
3114
3694
  layer: string;
3115
3695
  /** The image to render */
3116
- image: HTMLImageElement;
3696
+ image: HTMLImageElement | string;
3117
3697
  /** Cut the image based on straight coordinates starting from the top left downward */
3118
3698
  slice?: Slice;
3119
3699
  /** TRUE for smooth pixels (not recommended for pixel art) */
@@ -3156,8 +3736,40 @@ declare const defaultTextureAtlasOptions: {
3156
3736
  spacing: number;
3157
3737
  };
3158
3738
  /**
3739
+ * TextRenderer component configuration
3159
3740
  * @public
3160
- * @category Components
3741
+ * @category Components Configuration
3742
+ * @example
3743
+ * ```js
3744
+ * const textRenderer = new TextRenderer({
3745
+ * text: "Hello World!",
3746
+ * color: "#FFFFFF",
3747
+ * fontSize: 24,
3748
+ * width: 1920,
3749
+ * height: 32,
3750
+ * opacity: 1,
3751
+ * layer: "TextLayer",
3752
+ * orientation: TextOrientation.RightCenter,
3753
+ * shadow: {
3754
+ * color: "#00FF00",
3755
+ * offset: new Vector2(3, -3),
3756
+ * opacity: 0.5,
3757
+ * },
3758
+ * textureAtlas: {
3759
+ * charRanges: [32, 126, 161, 255, 0x3040, 0x309f],
3760
+ * fontSize: 64,
3761
+ * spacing: 4,
3762
+ * },
3763
+ * font: "Arial",
3764
+ * flipHorizontally: false,
3765
+ * flipVertically: false,
3766
+ * letterSpacing: 0,
3767
+ * lineHeight: 24,
3768
+ * offset: new Vector2(0, 0),
3769
+ * rotation: 0,
3770
+ * smooth: false,
3771
+ * });
3772
+ * ```
3161
3773
  */
3162
3774
  interface TextRendererOptions {
3163
3775
  /** The text color */
@@ -3214,7 +3826,13 @@ interface TextRendererOptions {
3214
3826
  width: number;
3215
3827
  }
3216
3828
  /**
3217
- * The TextRenderer component allows to render text using font families, colors, and other configuration options.
3829
+ * The TextRenderer component renders text to the screen with extensive customization options.\
3830
+ * It supports both web-safe and imported fonts, but works optimally with bitmap fonts.\
3831
+ * Under the hood, it generates a texture atlas containing all the characters needed for rendering.\
3832
+ * The atlas generation can be configured with custom character ranges, font sizes, and spacing.\
3833
+ * Text can be customized with font families, colors, sizing, orientation, shadows, letter spacing,\
3834
+ * line height, opacity, smoothing, and positioning. The component allows text to be rotated,\
3835
+ * flipped, and assigned to specific render layers.
3218
3836
  * @public
3219
3837
  * @category Components
3220
3838
  * @example
@@ -3320,8 +3938,34 @@ declare class TextRenderer {
3320
3938
  }
3321
3939
 
3322
3940
  /**
3941
+ * TilemapRenderer component configuration
3323
3942
  * @public
3324
- * @category Components
3943
+ * @category Components Configuration
3944
+ * @example
3945
+ * ```js
3946
+ * const tilemapRenderer = new TilemapRenderer({
3947
+ * layer: "Default",
3948
+ * tileset: {
3949
+ * image: this.assetManager.getImage("tileset.png"),
3950
+ * width: 10,
3951
+ * tileWidth: 32,
3952
+ * tileHeight: 32,
3953
+ * margin: new Vector2(0, 0),
3954
+ * spacing: new Vector2(0, 0)
3955
+ * },
3956
+ * data: [1, 2, 3, 4],
3957
+ * chunks: [],
3958
+ * width: 2,
3959
+ * height: 2,
3960
+ * tileWidth: 32,
3961
+ * tileHeight: 32,
3962
+ * tintColor: "#FFFFFF",
3963
+ * maskColor: "#FF0000",
3964
+ * maskColorMix: 0,
3965
+ * opacity: 1,
3966
+ * smooth: false
3967
+ * });
3968
+ * ```
3325
3969
  */
3326
3970
  interface TilemapRendererOptions {
3327
3971
  layer: string;
@@ -3339,9 +3983,38 @@ interface TilemapRendererOptions {
3339
3983
  smooth: boolean;
3340
3984
  }
3341
3985
  /**
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.
3986
+ * The TilemapRenderer component renders 2D tile-based maps to the screen.\
3987
+ * It uses a tileset image as a source for individual tiles, which are arranged according to a provided array of tile IDs.\
3988
+ * The component supports features like tinting, masking, opacity control, and custom tile dimensions.\
3989
+ * Maps can be rendered in chunks for improved performance with large tilemaps, and tiles can be assigned to specific render layers.\
3990
+ * Each tile is referenced by an ID, with 0 representing empty space.
3343
3991
  * @public
3344
3992
  * @category Components
3993
+ * @example
3994
+ * ```js
3995
+ * const tilemapRenderer = new TilemapRenderer({
3996
+ * layer: "Default",
3997
+ * tileset: {
3998
+ * image: this.assetManager.getImage("tileset.png"),
3999
+ * width: 10,
4000
+ * tileWidth: 32,
4001
+ * tileHeight: 32,
4002
+ * margin: new Vector2(0, 0),
4003
+ * spacing: new Vector2(0, 0)
4004
+ * },
4005
+ * data: [1, 2, 3, 4],
4006
+ * chunks: [],
4007
+ * width: 2,
4008
+ * height: 2,
4009
+ * tileWidth: 32,
4010
+ * tileHeight: 32,
4011
+ * tintColor: "#FFFFFF",
4012
+ * maskColor: "#FF0000",
4013
+ * maskColorMix: 0,
4014
+ * opacity: 1,
4015
+ * smooth: false
4016
+ * });
4017
+ * ```
3345
4018
  */
3346
4019
  declare class TilemapRenderer {
3347
4020
  /** The render layer */
@@ -3377,13 +4050,16 @@ declare class TilemapRenderer {
3377
4050
  constructor(options?: Partial<TilemapRendererOptions>);
3378
4051
  }
3379
4052
  /**
3380
- * Tileset configuration to be used with the TilemapRenderer
4053
+ * The Tileset configuration defines the properties of a tileset used by the TilemapRenderer.\
4054
+ * It specifies the source image containing the tiles, the dimensions of the tileset and individual tiles,\
4055
+ * and optional margin and spacing between tiles. This configuration is essential for properly\
4056
+ * slicing and rendering tiles from the tileset image.
3381
4057
  * @public
3382
- * @category Components
4058
+ * @category Components Configuration
3383
4059
  */
3384
4060
  type Tileset = {
3385
4061
  /** The tileset image element */
3386
- image: HTMLImageElement;
4062
+ image: HTMLImageElement | string;
3387
4063
  width: number;
3388
4064
  tileWidth: number;
3389
4065
  tileHeight: number;
@@ -3395,7 +4071,7 @@ type Tileset = {
3395
4071
  /**
3396
4072
  * Chunk of tile data
3397
4073
  * @public
3398
- * @category Components
4074
+ * @category Components Configuration
3399
4075
  */
3400
4076
  type Chunk = {
3401
4077
  /** Array of tiles. ID 0 (zero) represents empty space.*/
@@ -3409,8 +4085,30 @@ type Chunk = {
3409
4085
  };
3410
4086
 
3411
4087
  /**
4088
+ * VideoRenderer component configuration
3412
4089
  * @public
3413
- * @category Components
4090
+ * @category Components Configuration
4091
+ * @example
4092
+ * ```js
4093
+ * const videoRenderer = new VideoRenderer({
4094
+ * video: this.assetManager.getVideo("video.mp4"),
4095
+ * width: 1920,
4096
+ * height: 1080,
4097
+ * offset: new Vector2(0, 0),
4098
+ * flipHorizontally: false,
4099
+ * flipVertically: false,
4100
+ * rotation: 0,
4101
+ * opacity: 1,
4102
+ * maskColor: "#FF0000",
4103
+ * maskColorMix: 0,
4104
+ * tintColor: "#00FF00",
4105
+ * layer: "Default",
4106
+ * slice: {x: 0, y: 0, width: 1920, height: 1080},
4107
+ * volume: 1,
4108
+ * loop: false,
4109
+ * fixedToTimeScale: false
4110
+ * });
4111
+ * ```
3414
4112
  */
3415
4113
  interface VideoRendererOptions {
3416
4114
  action: "play" | "pause" | "stop";
@@ -3427,32 +4125,38 @@ interface VideoRendererOptions {
3427
4125
  rotation: number;
3428
4126
  slice: Slice;
3429
4127
  tintColor: string;
3430
- video: HTMLVideoElement;
4128
+ video: HTMLVideoElement | string;
3431
4129
  volume: number;
3432
4130
  width: number;
3433
4131
  }
3434
4132
  /**
3435
- * The VideoRenderer component plays and renders a video element,
3436
- * and allows configuring options such as its dimensions, coloring, etc.
4133
+ * The VideoRenderer component renders video content to the screen.\
4134
+ * It supports features like video playback control, scaling, rotation, flipping, opacity, color masking and tinting.\
4135
+ * Videos can be rendered with custom dimensions, positioned with offsets, and sliced to show specific regions.\
4136
+ * The component provides control over looping, volume, time scaling, and can be assigned to specific render layers.\
4137
+ * Videos can be paused, played, and stopped programmatically.
3437
4138
  * @public
3438
4139
  * @category Components
3439
4140
  * @example
3440
4141
  * ```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;
4142
+ * const videoRenderer = new VideoRenderer({
4143
+ * video: this.assetManager.getVideo("video.mp4"),
4144
+ * width: 1920,
4145
+ * height: 1080,
4146
+ * offset: new Vector2(0, 0),
4147
+ * flipHorizontally: false,
4148
+ * flipVertically: false,
4149
+ * rotation: 0,
4150
+ * opacity: 1,
4151
+ * maskColor: "#FF0000",
4152
+ * maskColorMix: 0,
4153
+ * tintColor: "#00FF00",
4154
+ * layer: "Default",
4155
+ * slice: {x: 0, y: 0, width: 1920, height: 1080},
4156
+ * volume: 1,
4157
+ * loop: false,
4158
+ * fixedToTimeScale: false
4159
+ * });
3456
4160
  * videoRenderer.play();
3457
4161
  * ```
3458
4162
  */
@@ -3488,7 +4192,7 @@ declare class VideoRenderer {
3488
4192
  /** Define a color for tinting the video */
3489
4193
  tintColor: string;
3490
4194
  /**The video element to render */
3491
- video: HTMLVideoElement;
4195
+ video: HTMLVideoElement | string;
3492
4196
  /** The volume of the video (between 1 and 0) */
3493
4197
  volume: number;
3494
4198
  /** Overwrite the original video width */
@@ -3513,7 +4217,8 @@ declare class VideoRenderer {
3513
4217
  }
3514
4218
 
3515
4219
  /**
3516
- * It represents a connected gamepad and has the information of all its buttons and axes..
4220
+ * Represents a connected gamepad controller and provides access to its button states and analog axes values.
4221
+ * Tracks digital button presses, analog stick positions, and d-pad inputs in a normalized format.
3517
4222
  * @public
3518
4223
  * @category Input
3519
4224
  * @example
@@ -3521,11 +4226,11 @@ declare class VideoRenderer {
3521
4226
  * const gamepad = this.inputManager.gamepads[0];
3522
4227
  *
3523
4228
  * if (gamepad.dpadAxes.x > 1) {
3524
- * // if the depad x-axis is pressed to the right, do some action
4229
+ * // if the d-pad x-axis is pressed to the right, do some action
3525
4230
  * }
3526
4231
  *
3527
4232
  * if (gamepad.rightFace) {
3528
- * // if the right face button is pressed, do some action
4233
+ * // if the right face button is pressed (Dual Shock: Square. Xbox: X. Nintendo: Y), do some action
3529
4234
  * }
3530
4235
  * ```
3531
4236
  */
@@ -3671,8 +4376,9 @@ type VibrationInput = {
3671
4376
  };
3672
4377
 
3673
4378
  /**
3674
- * Contains the keyboard information in the last frame.
3675
- * It uses the **code** property of the **js keyboard event**.
4379
+ * Tracks and provides access to keyboard input state from the previous frame.
4380
+ * Uses the standardized `code` property from JavaScript KeyboardEvents to identify keys.
4381
+ * Provides methods to check if individual keys or combinations of keys are pressed.
3676
4382
  * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
3677
4383
  * @public
3678
4384
  * @category Input
@@ -3749,7 +4455,8 @@ declare class Keyboard {
3749
4455
  }
3750
4456
 
3751
4457
  /**
3752
- * Contains the mouse information in the last frame
4458
+ * Stores the mouse state from the previous frame, including button states, cursor position,
4459
+ * movement status, and scroll wheel information
3753
4460
  * @public
3754
4461
  * @category Input
3755
4462
  * @example
@@ -3789,7 +4496,7 @@ declare class Mouse {
3789
4496
  }
3790
4497
 
3791
4498
  /**
3792
- * The information about one interaction with the screen
4499
+ * Represents a single touch or pointer interaction with the screen, including position and size information
3793
4500
  * @public
3794
4501
  * @category Input
3795
4502
  */
@@ -3800,7 +4507,8 @@ interface TouchInteraction {
3800
4507
  radius: Vector2;
3801
4508
  }
3802
4509
  /**
3803
- * Contains the information about the touch screen interaction
4510
+ * Tracks and provides access to touch screen input state from the previous frame. Supports multi-touch
4511
+ * by storing an array of active touch interactions, each containing position and size information.
3804
4512
  * @public
3805
4513
  * @category Input
3806
4514
  * @example
@@ -3824,7 +4532,52 @@ declare class TouchScreen {
3824
4532
  }
3825
4533
 
3826
4534
  /**
3827
- * Manages the input sources: Keyboard, Mouse, Gamepad, TouchScreen.
4535
+ * Manages input sources including keyboard, mouse, gamepad and touch screen interactions.\
4536
+ * Provides methods to check key states, mouse position/buttons, gamepad inputs and touch events.
4537
+ * @example
4538
+ * ```typescript
4539
+ * // Keyboard input
4540
+ * if (inputManager.keyboard.isPressed("Space")) {
4541
+ * // Jump action
4542
+ * }
4543
+ *
4544
+ * // Multiple key checks
4545
+ * if (inputManager.keyboard.orPressed(["Enter", "Space"])) {
4546
+ * // Action for either key pressed
4547
+ * }
4548
+ *
4549
+ * if (inputManager.keyboard.andPressed(["ControlLeft", "KeyC"])) {
4550
+ * // Action for both keys pressed together
4551
+ * }
4552
+ *
4553
+ * // Mouse input
4554
+ * const mousePos = inputManager.mouse.positionInViewport;
4555
+ * if (inputManager.mouse.leftButtonPressed) {
4556
+ * // Shoot action
4557
+ * }
4558
+ *
4559
+ * // Mouse wheel scrolling
4560
+ * const scrollAmount = inputManager.mouse.wheelScroll;
4561
+ *
4562
+ * // Gamepad input
4563
+ * const gamepad = inputManager.gamepads[0];
4564
+ * if (gamepad?.bottomFace) {
4565
+ * // Bottom face button pressed (A on Xbox, B on Nintendo, X on PlayStation)
4566
+ * }
4567
+ *
4568
+ * // Gamepad stick movement
4569
+ * const leftStickPos = gamepad?.leftStickAxes;
4570
+ * const rightStickPos = gamepad?.rightStickAxes;
4571
+ *
4572
+ * // Gamepad vibration
4573
+ * gamepad?.vibrate(200, 0.5, 0.5);
4574
+ *
4575
+ * // Touch input
4576
+ * if (inputManager.touchScreen.touching) {
4577
+ * const touch = inputManager.touchScreen.interactions[0];
4578
+ * // Handle touch at touch.positionInViewport
4579
+ * }
4580
+ * ```
3828
4581
  * @public
3829
4582
  * @category Managers
3830
4583
  */
@@ -3841,8 +4594,15 @@ declare class InputManager {
3841
4594
  }
3842
4595
 
3843
4596
  /**
3844
- * Abstract class which can be used to create Systems.\
3845
- * It includes the following dependencies: EntityManager, AssetManager, SceneManager, TimeManager, InputManager, CollisionRepository.
4597
+ * Abstract base class for creating game systems with commonly needed dependencies injected.\
4598
+ * Provides access to the following core managers and services:\
4599
+ * - EntityManager: For managing game entities and components\
4600
+ * - AssetManager: For loading and managing game resources\
4601
+ * - SceneManager: For controlling scene transitions and state\
4602
+ * - TimeManager: For handling game timing and delta time\
4603
+ * - InputManager: For processing keyboard, mouse and touch input\
4604
+ * - CollisionRepository: For physics and collision detection\
4605
+ * - GameConfig: For accessing game configuration settings
3846
4606
  * @public
3847
4607
  * @category Core
3848
4608
  * @example
@@ -3870,7 +4630,9 @@ declare abstract class GameSystem implements System {
3870
4630
  }
3871
4631
 
3872
4632
  /**
3873
- * Decorator to indicate that the target system will run in the game logic loop.
4633
+ * Decorator to indicate that the target system will run in the game logic loop.\
4634
+ * Game logic systems handle core gameplay mechanics, AI behavior, input processing,\
4635
+ * and other non-physics, non-rendering game state updates that occur each frame.
3874
4636
  * @public
3875
4637
  * @category Decorators
3876
4638
  * @example
@@ -3882,7 +4644,9 @@ declare abstract class GameSystem implements System {
3882
4644
  */
3883
4645
  declare function gameLogicSystem(): (target: SystemType) => void;
3884
4646
  /**
3885
- * Decorator to indicate that the target system will run in the physics loop.
4647
+ * Decorator to indicate that the target system will run in the physics loop.\
4648
+ * Physics systems handle physics calculations, collisions, and other physics-related updates.\
4649
+ * They typically run at a lower frequency than game logic systems to ensure accurate physics simulations.
3886
4650
  * @public
3887
4651
  * @category Decorators
3888
4652
  * @example
@@ -3894,7 +4658,10 @@ declare function gameLogicSystem(): (target: SystemType) => void;
3894
4658
  */
3895
4659
  declare function gamePhysicsSystem(): (target: SystemType) => void;
3896
4660
  /**
3897
- * Decorator to indicate that the target system will be executed at the begining of the render loop.
4661
+ * Decorator to indicate that the target system will be executed at the begining of the render loop.\
4662
+ * Pre-render systems handle tasks that need to be completed before the final rendering step.\
4663
+ * They are useful for tasks like sorting sprites, updating UI elements, and positioning the camera before rendering,
4664
+ * along with other preparatory operations.
3898
4665
  * @public
3899
4666
  * @category Decorators
3900
4667
  * @example
@@ -3907,7 +4674,9 @@ declare function gamePhysicsSystem(): (target: SystemType) => void;
3907
4674
  declare function gamePreRenderSystem(): (target: SystemType) => void;
3908
4675
 
3909
4676
  /**
3910
- * Applies a decorator manually.
4677
+ * Applies a decorator manually to a target (class, property, or constructor parameter).\
4678
+ * This utility function simplifies the process of programmatically applying decorators without using the @ syntax.\
4679
+ * This is primarily useful in JavaScript where decorator syntax is not yet standardized.
3911
4680
  * @param decorator The decorator function to be applied.
3912
4681
  * @param target The target to which the decorator is applied (class, prototype, or constructor argument).
3913
4682
  * @param propertyKey The property name or constructor argument index (optional).
@@ -3937,9 +4706,26 @@ declare function gamePreRenderSystem(): (target: SystemType) => void;
3937
4706
  declare function decorate(decorator: (...args: any[]) => any, target: any, propertyKey?: string | symbol | number): void;
3938
4707
 
3939
4708
  /**
3940
- * Options for playSfx function.
4709
+ * Configuration options for playing sound effects with the playSfx function.
4710
+ * Allows specifying the audio source to play, optional volume level (0-1),
4711
+ * and whether the sound should loop continuously.
3941
4712
  * @public
3942
4713
  * @category Audio
4714
+ * @example
4715
+ * ```javascript
4716
+ * const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
4717
+ * playSfx({ audioSource });
4718
+ * ```
4719
+ * @example
4720
+ * ```javascript
4721
+ * const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
4722
+ * playSfx({ audioSource, volume: 0.5 });
4723
+ * ```
4724
+ * @example
4725
+ * ```javascript
4726
+ * const audioSource = this.assetManager.getAudio("audio/sfx/coin.ogg");
4727
+ * playSfx({ audioSource, loop: true });
4728
+ * ```
3943
4729
  */
3944
4730
  interface PlaySfxOptions {
3945
4731
  audioSource: HTMLAudioElement;
@@ -3947,8 +4733,9 @@ interface PlaySfxOptions {
3947
4733
  loop?: boolean;
3948
4734
  }
3949
4735
  /**
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.
4736
+ * 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.\
4737
+ * While this function can play any audio, it's recommended to use the AudioPlayer component for background music or longer tracks.\
4738
+ * The AudioPlayer component provides additional features like handling browser autoplay policies, fading, and advanced playback control.
3952
4739
  * @param playSfxOptions - The options for playing the sound effect.
3953
4740
  * @public
3954
4741
  * @category Audio
@@ -3970,7 +4757,9 @@ interface PlaySfxOptions {
3970
4757
  */
3971
4758
  declare const playSfx: ({ audioSource, volume, loop }: PlaySfxOptions) => void;
3972
4759
  /**
3973
- * Stop a sound effect.
4760
+ * Stops a sound effect by pausing playback and resetting its position to the beginning.\
4761
+ * Useful for immediately silencing sound effects or interrupting looped audio.\
4762
+ * Note that this completely stops the audio - to temporarily pause, use audioSource.pause() directly.
3974
4763
  * @param audioSource - The audio source to stop.
3975
4764
  * @public
3976
4765
  * @category Audio
@@ -3985,9 +4774,9 @@ declare const stopSfx: (audioSource: HTMLAudioElement) => void;
3985
4774
  /**
3986
4775
  * Symbols to be used as dependency identifiers
3987
4776
  * @public
3988
- * @category Config
4777
+ * @category Decorators
3989
4778
  */
3990
- declare const Symbols: {
4779
+ declare const BuiltInDependencyIdentifiers: {
3991
4780
  AssetManager: symbol;
3992
4781
  CanvasElement: symbol;
3993
4782
  CollisionRepository: symbol;
@@ -3999,4 +4788,4 @@ declare const Symbols: {
3999
4788
  TimeManager: symbol;
4000
4789
  };
4001
4790
 
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 };
4791
+ 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, 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 SearchCriteria, type SearchResult, ShadowRenderer, type ShadowRendererOptions, 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 };