angry-pixel 2.0.0 → 2.0.1

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
@@ -1,6 +1,16 @@
1
+ /**
2
+ * This type represents a dependency class
3
+ * @public
4
+ * @category Core
5
+ */
1
6
  type DependencyType = {
2
7
  new (...args: any[]): any;
3
8
  };
9
+ /**
10
+ * This type represents a dependency name
11
+ * @public
12
+ * @category Core
13
+ */
4
14
  type DependencyName = string | symbol;
5
15
  type PropertyKey = string | symbol;
6
16
  declare class Container {
@@ -11,7 +21,40 @@ declare class Container {
11
21
  get<T>(name: DependencyName): T;
12
22
  has(name: DependencyName): boolean;
13
23
  }
24
+ /**
25
+ * Decorator to identify a class as an injectable dependency
26
+ * @param name the name to identify the dependency
27
+ * @public
28
+ * @category Decorators
29
+ * @example
30
+ * ```typescript
31
+ * @injectable("SomeDependency")
32
+ * class SomeDependency {}
33
+ * ```
34
+ */
14
35
  declare function injectable(name: DependencyName): (target: DependencyType) => void;
36
+ /**
37
+ * Decorator to identify a property, or constructor argument, as a dependency to be injected
38
+ * @param name the name to identify the dependency
39
+ * @public
40
+ * @category Decorators
41
+ * @example
42
+ * ```typescript
43
+ * class SomeClass {
44
+ * private anotherDependency: DependencyType;
45
+ *
46
+ * constructor(@inject("AnotherDependency") anotherDependency: DependencyType) {
47
+ * this.anotherDependency = anotherDependency;
48
+ * }
49
+ * }
50
+ * ```
51
+ * @example
52
+ * ```typescript
53
+ * class SomeClass {
54
+ * @inject("AnotherDependency") private anotherDependency: DependencyType;
55
+ * }
56
+ * ```
57
+ */
15
58
  declare function inject(name: DependencyName): (target: any, propertyKey: PropertyKey, parameterIndex?: number) => void;
16
59
 
17
60
  /**
@@ -329,6 +372,7 @@ declare const range: (start: number, end: number, steps?: number) => number[];
329
372
  */
330
373
  declare const between: (value: number, min: number, max: number) => boolean;
331
374
 
375
+ /** @internal */
332
376
  interface Shape {
333
377
  boundingBox: Rectangle;
334
378
  collider: number;
@@ -344,6 +388,7 @@ interface Shape {
344
388
  vertices: Vector2[];
345
389
  updateCollisions: boolean;
346
390
  }
391
+ /** @internal */
347
392
  declare class Polygon implements Shape {
348
393
  rotation: number;
349
394
  boundingBox: Rectangle;
@@ -362,6 +407,7 @@ declare class Polygon implements Shape {
362
407
  set vertexModel(vertexModel: Vector2[]);
363
408
  constructor(vertexModel: Vector2[], rotation?: number);
364
409
  }
410
+ /** @internal */
365
411
  declare class Circumference implements Shape {
366
412
  radius: number;
367
413
  boundingBox: Rectangle;
@@ -391,8 +437,21 @@ declare enum BroadPhaseMethods {
391
437
  SpartialGrid = 1
392
438
  }
393
439
 
440
+ /**
441
+ * Contains information about the collision
442
+ * @public
443
+ * @category Collisions
444
+ */
394
445
  interface CollisionResolution {
446
+ /**
447
+ * Intersection between both colliders expressed in pixels
448
+ * @public
449
+ */
395
450
  penetration: number;
451
+ /**
452
+ * Collision direction
453
+ * @public
454
+ */
396
455
  direction: Vector2;
397
456
  }
398
457
 
@@ -408,105 +467,590 @@ declare enum CollisionMethods {
408
467
  SAT = 1
409
468
  }
410
469
 
470
+ /**
471
+ * Interface implemented by the collider components
472
+ * @public
473
+ * @category Collisions
474
+ */
411
475
  interface Collider {
476
+ /** Ignores collisions with layers in the array */
412
477
  ignoreCollisionsWithLayers: string[];
478
+ /** Collision layer*/
413
479
  layer: string;
480
+ /** X-Y axis offset */
414
481
  offset: Vector2;
482
+ /** TRUE if this collider interact with rigid bodies */
415
483
  physics: boolean;
484
+ /** @internal */
416
485
  shapes: Shape[];
417
486
  }
418
487
 
488
+ /**
489
+ * This type an unique identifier of an Entity
490
+ * @public
491
+ * @category Core
492
+ */
419
493
  type Entity = number;
494
+ /**
495
+ * This type represents an instance of a component
496
+ * @public
497
+ * @category Core
498
+ */
420
499
  type Component = {
421
500
  [key: string]: any;
422
501
  };
502
+ /**
503
+ * This type represents a component class
504
+ * @public
505
+ * @category Core
506
+ */
423
507
  type ComponentType<T extends Component = Component> = {
424
508
  new (...args: any[]): T;
425
509
  };
510
+ /**
511
+ * This type represents a search result object
512
+ * @public
513
+ * @category Core
514
+ */
426
515
  type SearchResult<T extends Component> = {
427
516
  entity: Entity;
428
517
  component: T;
429
518
  };
519
+ /**
520
+ * This type represents a search criteria object
521
+ * @public
522
+ * @category Core
523
+ */
430
524
  type SearchCriteria = {
431
525
  [key: string]: any;
432
526
  };
527
+ /**
528
+ * The EntityManager manages the entities and components.\
529
+ * It provides the necessary methods for reading and writing entities and components.
530
+ * @public
531
+ * @category Core
532
+ */
433
533
  declare class EntityManager {
434
534
  private lastEntityId;
435
535
  private lastComponentTypeId;
436
536
  private components;
437
537
  private disabledEntities;
438
538
  private disabledComponents;
539
+ /**
540
+ * Creates an entity without component
541
+ * @return the created Entity
542
+ * @public
543
+ * @category Core
544
+ * @example
545
+ * ```js
546
+ * const entity = entityManager.createEntity();
547
+ * ```
548
+ */
439
549
  createEntity(): Entity;
550
+ /**
551
+ * Creates an Entity based on a collection of Component instances and ComponentTypes
552
+ * @param components A collection of Component instances and ComponentTypes
553
+ * @public
554
+ * @category Core
555
+ * @example
556
+ * ```js
557
+ * const entity = entityManager.createEntity([
558
+ * new Transform({position: new Vector2(100, 100)}),
559
+ * SpriteRenderer
560
+ * ]);
561
+ * ```
562
+ */
440
563
  createEntity(components: Array<ComponentType | Component>): Entity;
564
+ /**
565
+ * Removes an Entity and all its Components
566
+ * @param entity The entity to remove
567
+ * @public
568
+ * @category Core
569
+ * @example
570
+ * ```js
571
+ * entityManager.removeEntity(entity);
572
+ * ```
573
+ */
441
574
  removeEntity(entity: Entity): void;
575
+ /**
576
+ * Removes all Entities and all their Components
577
+ * @public
578
+ * @category Core
579
+ * @example
580
+ * ```js
581
+ * entityManager.removeAllEntities();
582
+ * ```
583
+ */
442
584
  removeAllEntities(): void;
585
+ /**
586
+ * Returns TRUE if the Entity is enabled, otherwise it returns FALSE
587
+ * @param entity The entity to verify
588
+ * @returns boolean
589
+ * @public
590
+ * @category Core
591
+ * @example
592
+ * ```js
593
+ * const entityEnabled = entityManager.isEntityEnabled(entity);
594
+ * ```
595
+ */
443
596
  isEntityEnabled(entity: Entity): boolean;
597
+ /**
598
+ * Enables an Entity
599
+ * @param entity The entity to be enabled
600
+ * @public
601
+ * @category Core
602
+ * @example
603
+ * ```js
604
+ * entityManager.enableEntity(entity);
605
+ * ```
606
+ */
444
607
  enableEntity(entity: Entity): void;
608
+ /**
609
+ * Disables an Entity
610
+ * @param entity The entity to be disabled
611
+ * @public
612
+ * @category Core
613
+ * @example
614
+ * ```js
615
+ * entityManager.disableEntity(entity);
616
+ * ```
617
+ */
445
618
  disableEntity(entity: Entity): void;
619
+ /**
620
+ * Disable all Entities that have a component of the given type
621
+ * @param componentType The class of the component
622
+ * @public
623
+ * @category Core
624
+ * @example
625
+ * ```js
626
+ * entityManager.disableEntitiesByComponent(SpriteRenderer);
627
+ * ```
628
+ */
446
629
  disableEntitiesByComponent(componentType: ComponentType): void;
630
+ /**
631
+ * Enable all Entities that have a component of the given type
632
+ * @param componentType The class of the component
633
+ * @public
634
+ * @category Core
635
+ * @example
636
+ * ```js
637
+ * entityManager.enableEntitiesByComponent(SpriteRenderer);
638
+ * ```
639
+ */
447
640
  enableEntitiesByComponent(componentType: ComponentType): void;
641
+ /**
642
+ * Adds a component to the entity
643
+ * @param entity The Entity to which the component will be added
644
+ * @param componentType The class of the component
645
+ * @returns The instance of the component
646
+ * @public
647
+ * @category Core
648
+ * @example
649
+ * ```js
650
+ * const spriteRenderer = entityManager.addComponent(entity, SpriteRenderer);
651
+ * ```
652
+ */
448
653
  addComponent<T extends Component>(entity: Entity, componentType: ComponentType<T>): T;
654
+ /**
655
+ * Adds an instance of a component to an entity
656
+ * @param entity The Entity to which the component will be added
657
+ * @param component The instance of the component
658
+ * @returns The instance of the component
659
+ * @public
660
+ * @category Core
661
+ * @example
662
+ * ```js
663
+ * const spriteRenderer = new SpriteRenderer();
664
+ * entityManager.addComponent(entity, spriteRenderer);
665
+ * ```
666
+ */
449
667
  addComponent<T extends Component>(entity: Entity, component: T): T;
668
+ /**
669
+ * Returns TRUE if the Entity has a component of the given type, otherwise it returns FALSE.
670
+ * @param entity The entity to verify
671
+ * @param componentType The class of the component
672
+ * @returns boolean
673
+ * @public
674
+ * @category Core
675
+ * @example
676
+ * ```js
677
+ * const hasSpriteRenderer = entityManager.hasComponent(entity, SpriteRenderer);
678
+ * ```
679
+ */
450
680
  hasComponent(entity: Entity, componentType: ComponentType): boolean;
681
+ /**
682
+ * Returns the component of the given type belonging to the entity
683
+ * @param entity The entity
684
+ * @param componentType The class of the component
685
+ * @returns The instance of the component
686
+ * @public
687
+ * @category Core
688
+ * @example
689
+ * ```js
690
+ * const spriteRenderer = entityManager.getComponent(entity, SpriteRenderer);
691
+ * ```
692
+ */
451
693
  getComponent<T extends Component>(entity: Entity, componentType: ComponentType<T>): T;
694
+ /**
695
+ * Returns all the component belonging to the entity
696
+ * @param entity The entity
697
+ * @returns A collection of component instances
698
+ * @public
699
+ * @category Core
700
+ * @example
701
+ * ```js
702
+ * const components = entityManager.getComponents(entity);
703
+ * ```
704
+ */
452
705
  getComponents(entity: Entity): Component[];
706
+ /**
707
+ * Searches for and returns an entity for the component instance
708
+ * @param component The component instance
709
+ * @returns The found Entity
710
+ * @public
711
+ * @category Core
712
+ * @example
713
+ * ```js
714
+ * const entity = entityManager.getEntityForComponent(spriteRenderer);
715
+ * ```
716
+ */
453
717
  getEntityForComponent(component: Component): Entity;
718
+ /**
719
+ * Removes the component instance from its Entity
720
+ * @param component The component instance
721
+ * @public
722
+ * @category Core
723
+ * @example
724
+ * ```js
725
+ * entityManager.removeComponent(spriteRenderer)
726
+ * ```
727
+ */
454
728
  removeComponent(component: Component): void;
729
+ /**
730
+ * Removes a component from the entity according to the given type
731
+ * @param entity The target entity
732
+ * @param componentType The component class
733
+ * @public
734
+ * @category Core
735
+ * @example
736
+ * ```js
737
+ * entityManager.removeComponent(entity, SriteRenderer)
738
+ * ```
739
+ */
455
740
  removeComponent(entity: Entity, componentType: ComponentType): void;
741
+ /**
742
+ * Returns TRUE if the component is enabled, otherwise it returns FALSE
743
+ * @param component The component instance
744
+ * @returns boolean
745
+ * @public
746
+ * @category Core
747
+ * @example
748
+ * ```js
749
+ * entityManager.isComponentEnabled(spriteRenderer)
750
+ * ```
751
+ */
456
752
  isComponentEnabled(component: Component): boolean;
753
+ /**
754
+ * Returns TRUE if the component is enabled, otherwise it returns FALSE
755
+ * @param entity The target entity
756
+ * @param componentType The component class
757
+ * @returns boolean
758
+ * @public
759
+ * @category Core
760
+ * @example
761
+ * ```js
762
+ * entityManager.isComponentEnabled(entity, SpriteRenderer)
763
+ * ```
764
+ */
457
765
  isComponentEnabled<T extends Component>(entity: Entity, componentType: ComponentType<T>): boolean;
766
+ /**
767
+ * Disables a component instance
768
+ * @param component The component instance
769
+ * @public
770
+ * @category Core
771
+ * @example
772
+ * ```js
773
+ * entityManager.disableComponent(spriteRenderer);
774
+ * ```
775
+ */
458
776
  disableComponent(component: Component): void;
777
+ /**
778
+ * Disables a component by its entity and type
779
+ * @param entity The target entity
780
+ * @param componentType The component class
781
+ * @public
782
+ * @category Core
783
+ * @example
784
+ * ```js
785
+ * entityManager.disableComponent(entity, SpriteRenderer);
786
+ * ```
787
+ */
459
788
  disableComponent<T extends Component>(entity: Entity, componentType: ComponentType<T>): void;
789
+ /**
790
+ * Enables a component instance
791
+ * @param component The component instance
792
+ * @public
793
+ * @category Core
794
+ * @example
795
+ * ```js
796
+ * entityManager.enableComponent(spriteRenderer);
797
+ * ```
798
+ */
460
799
  enableComponent(component: Component): void;
800
+ /**
801
+ * Enables a component by its entity and type
802
+ * @param entity The target entity
803
+ * @param componentType The component class
804
+ * @public
805
+ * @category Core
806
+ * @example
807
+ * ```js
808
+ * entityManager.enableComponent(entity, SpriteRenderer);
809
+ * ```
810
+ */
461
811
  enableComponent<T extends Component>(entity: Entity, componentType: ComponentType<T>): void;
812
+ /**
813
+ * Performs a search for entities given a component type.\
814
+ * This method returns a collection of objects of type SearchResult, which has the entity found, and the instance of the component.\
815
+ * This search can be filtered by passing as a second argument an instance of SearchCriteria, which performs a match between the attributes of the component and the given value.\
816
+ * The third argument determines if disabled entities or components are included in the search result,\its default value is FALSE.
817
+ * @param componentType The component class
818
+ * @param criteria The search criteria
819
+ * @param includeDisabled TRUE to incluide disabled entities and components, FALSE otherwise
820
+ * @returns SearchResult
821
+ * @public
822
+ * @category Core
823
+ * @example
824
+ * ```js
825
+ * const searchResult = entityManager.search(SpriteRenderer);
826
+ * searchResult.forEach(({component, entity}) => {
827
+ * // do something with the component and entity
828
+ * })
829
+ * ```
830
+ * @example
831
+ * ```js
832
+ * const searchResult = entityManager.search(Enemy, {status: "alive"});
833
+ * searchResult.forEach(({component, entity}) => {
834
+ * // do something with the component and entity
835
+ * })
836
+ * ```
837
+ */
462
838
  search<T extends Component>(componentType: ComponentType<T>, criteria?: SearchCriteria, includeDisabled?: boolean): SearchResult<T>[];
839
+ /**
840
+ * Performs an entity search given a collection of component types.\
841
+ * The entities found must have an instance of all the given component types.\
842
+ * This method returns a collection of Entities.
843
+ * @param componentTypes A collection of component classes
844
+ * @returns A collection of entities
845
+ * @public
846
+ * @category Core
847
+ * @example
848
+ * ```js
849
+ * const entities = entityManager.searchEntitiesByComponents([Transform, SpriteRenderer, Animator]);
850
+ * ```
851
+ */
463
852
  searchEntitiesByComponents(componentTypes: ComponentType[]): Entity[];
464
853
  private getComponentTypeId;
465
854
  }
466
855
 
856
+ /**
857
+ * This interface is used for the creation of system classes. You will have to inject the dependencies you need manully.
858
+ * @public
859
+ * @category Core
860
+ * @example
861
+ * ```typescript
862
+ * class PlayerSystem implements System {
863
+ * @inject(Symbols.EntityManager) private readonly entityManager: EntityManager;
864
+ *
865
+ * public onUpdate() {
866
+ * this.entityManager.search(Player).forEach(({component, entity}) => {
867
+ * // do somethng
868
+ * });
869
+ * }
870
+ * }
871
+ * ```
872
+ */
467
873
  interface System {
874
+ /**
875
+ * This method is called the first time the system is enabled
876
+ * @public
877
+ */
468
878
  onCreate?(): void;
879
+ /**
880
+ * This method is called when the system is destroyed
881
+ * @public
882
+ */
469
883
  onDestroy?(): void;
884
+ /**
885
+ * This method is called when the system is disabled
886
+ * @public
887
+ */
470
888
  onDisabled?(): void;
889
+ /**
890
+ * This method is called when the system is enabled
891
+ * @public
892
+ */
471
893
  onEnabled?(): void;
894
+ /**
895
+ * This method is called once every frame
896
+ * @public
897
+ */
472
898
  onUpdate(): void;
473
899
  }
900
+ /**
901
+ * This type represents a system class
902
+ * @public
903
+ * @category Core
904
+ */
474
905
  type SystemType<T extends System = System> = {
475
906
  new (...args: any[]): T;
476
907
  };
908
+ /** @internal */
477
909
  type SystemGroup = string | number | symbol;
910
+ /**
911
+ * The SystemManager manages the systems.\
912
+ * It provides the necessary methods for reading and writing systems.
913
+ * @public
914
+ * @category Core
915
+ */
478
916
  declare class SystemManager {
479
917
  private systems;
918
+ /**
919
+ * @param systemType The system class
920
+ * @returns the systen index
921
+ */
480
922
  private findSystemIndex;
923
+ /**
924
+ * Adds a new system instance linked to a group
925
+ * @param system The system instance
926
+ * @param group The system group
927
+ * @internal
928
+ */
481
929
  addSystem(system: System, group: SystemGroup): void;
930
+ /**
931
+ * Returns TRUE if it has a system of the given type, otherwise it returns FALSE
932
+ * @param systemType The system class
933
+ * @returns boolean
934
+ * @public
935
+ * @example
936
+ * ```js
937
+ * const hasPlayerSystem = systemManager.hasSystem(PlayerSystem);
938
+ * ```
939
+ */
482
940
  hasSystem(systemType: SystemType): boolean;
941
+ /**
942
+ * Returns a system instance for the given type
943
+ * @param systemType The system class
944
+ * @returns The system instance
945
+ * @internal
946
+ */
483
947
  getSystem<T extends System>(systemType: SystemType<T>): T;
948
+ /**
949
+ * Enables a system by its type.\
950
+ * The method `onEnabled` of the system will be called. If the system is enabled for the first time, the method `onCreate` will also be called.
951
+ * @param systemType The system class
952
+ * @public
953
+ * @example
954
+ * ```js
955
+ * systemManager.enableSystem(PlayerSystem);
956
+ * ```
957
+ */
484
958
  enableSystem(systemType: SystemType): void;
959
+ /**
960
+ * Disables a system by its type.\
961
+ * The method `onDisabled` of the system will be called.
962
+ * @param systemType The system class
963
+ * @public
964
+ * @example
965
+ * ```js
966
+ * systemManager.disableSystem(PlayerSystem);
967
+ * ```
968
+ */
485
969
  disableSystem(systemType: SystemType): void;
970
+ /**
971
+ * Set the execution priority of a system.
972
+ * @param systemType The system class
973
+ * @param position the priority number
974
+ * @internal
975
+ */
486
976
  setExecutionOrder(systemType: SystemType, position: number): void;
977
+ /**
978
+ * Removes a system by its type.
979
+ * The method `onDestroy` of the system will be called.
980
+ * @param systemType The system class
981
+ * @internal
982
+ */
487
983
  removeSystem(systemType: SystemType): void;
984
+ /**
985
+ * Call the method onUpdate for systems belonging to the given group
986
+ * @param group The system group
987
+ * @internal
988
+ */
488
989
  update(group: SystemGroup): void;
489
990
  }
490
991
 
491
992
  /**
492
- * Represent a collision. It contains the colliders involved and the resolution data.
493
- * @category Components
993
+ * Represent a collision. It contains the colliders involved, the entities, and the resolution data.
994
+ * @category Collisions
494
995
  * @public
495
996
  */
496
997
  interface Collision {
998
+ /**
999
+ * The local collider component
1000
+ * @public
1001
+ */
497
1002
  localCollider: Collider;
1003
+ /**
1004
+ * The local entity
1005
+ * @public
1006
+ */
498
1007
  localEntity: Entity;
1008
+ /**
1009
+ * The remote collider component
1010
+ * @public
1011
+ */
499
1012
  remoteCollider: Collider;
1013
+ /**
1014
+ * The remote collider
1015
+ * @public
1016
+ */
500
1017
  remoteEntity: Entity;
1018
+ /**
1019
+ * Contains the information about the collision
1020
+ * @public
1021
+ */
501
1022
  resolution: CollisionResolution;
502
1023
  }
503
1024
 
1025
+ /**
1026
+ * The CollisionRepository has the necessary methods to perform queries on the current collisions
1027
+ * @public
1028
+ * @category Collisions
1029
+ */
504
1030
  declare class CollisionRepository {
505
1031
  private collisions;
1032
+ /**
1033
+ * Searches for and returns a collection of collisions for the given collider
1034
+ * @param collider The local collider
1035
+ * @returns A collection of collisions
1036
+ */
506
1037
  findCollisionsForCollider(collider: Collider): Collision[];
1038
+ /**
1039
+ * Searches for and returns a collection of collisions for the given collider and layer
1040
+ * @param collider The local collider
1041
+ * @param layer The collision layer
1042
+ * @returns A collection of collisions
1043
+ */
507
1044
  findCollisionsForColliderAndLayer(collider: Collider, layer: string): Collision[];
1045
+ /**
1046
+ * Returns all the collisions
1047
+ * @public
1048
+ * @returns A collection of collisions
1049
+ */
508
1050
  findAll(): Collision[];
1051
+ /** @internal */
509
1052
  persist(collision: Collision): void;
1053
+ /** @internal */
510
1054
  removeAll(): void;
511
1055
  }
512
1056
 
@@ -517,6 +1061,31 @@ declare class CollisionRepository {
517
1061
  */
518
1062
  type CollisionMatrix = [string, string][];
519
1063
 
1064
+ /**
1065
+ * Game configuration options
1066
+ * @public
1067
+ * @category Config
1068
+ * @example
1069
+ * ```js
1070
+ * const gameConfig = {
1071
+ * containerNode: document.getElementById("app"),
1072
+ * width: 1920,
1073
+ * height: 1080,
1074
+ * debugEnabled: false,
1075
+ * canvasColor: "#000000",
1076
+ * physicsFramerate: 180,
1077
+ * headless: false,
1078
+ * collisions: {
1079
+ * collisionMatrix: [
1080
+ * ["layer1", "layer2"],
1081
+ * ["layer1", "layer3"],
1082
+ * ],
1083
+ * collisionMethod: CollisionMethods.SAT,
1084
+ * collisionBroadPhaseMethod: BroadPhaseMethods.SpartialGrid,
1085
+ * }
1086
+ * };
1087
+ * ```
1088
+ */
520
1089
  interface GameConfig {
521
1090
  /** HTML element where the game will be created */
522
1091
  containerNode: HTMLElement;
@@ -585,7 +1154,6 @@ declare class AssetManager {
585
1154
  /**
586
1155
  * Loads an image asset
587
1156
  * @param url The asset URL
588
- * @param preloadTexture Creates the texture to be rendered at load time [optional]
589
1157
  * @returns The HTML Image element created
590
1158
  */
591
1159
  loadImage(url: string): HTMLImageElement;
@@ -635,9 +1203,39 @@ declare class AssetManager {
635
1203
  private createAsset;
636
1204
  }
637
1205
 
1206
+ /**
1207
+ * This type represents a scene class
1208
+ * @public
1209
+ * @category Core
1210
+ */
638
1211
  type SceneType<T extends Scene = Scene> = {
639
1212
  new (entityManager: EntityManager, assetManager: AssetManager): T;
640
1213
  };
1214
+ /**
1215
+ * Base class for all game scenes
1216
+ * @public
1217
+ * @category Core
1218
+ * @example
1219
+ * ```js
1220
+ * class GameScene extends Scene {
1221
+ * systems = [
1222
+ * SomeSystem,
1223
+ * AnotherSystem
1224
+ * ];
1225
+ *
1226
+ * loadAssets() {
1227
+ * this.assetManager.loadImage("image.png");
1228
+ * }
1229
+ *
1230
+ * setup() {
1231
+ * this.entityManager.createEntity([
1232
+ * SomeComponent,
1233
+ * AnotherComponent
1234
+ * ]);
1235
+ * }
1236
+ * }
1237
+ * ```
1238
+ */
641
1239
  declare abstract class Scene {
642
1240
  protected readonly entityManager: EntityManager;
643
1241
  protected readonly assetManager: AssetManager;
@@ -646,6 +1244,15 @@ declare abstract class Scene {
646
1244
  loadAssets(): void;
647
1245
  setup(): void;
648
1246
  }
1247
+ /**
1248
+ * Manges the loading of the scenes.
1249
+ * @public
1250
+ * @category Managers
1251
+ * @example
1252
+ * ```js
1253
+ * this.sceneManager.loadScene("MainScene");
1254
+ * ```
1255
+ */
649
1256
  declare class SceneManager {
650
1257
  private readonly systemManager;
651
1258
  private readonly systemFactory;
@@ -656,6 +1263,7 @@ declare class SceneManager {
656
1263
  private currentSceneName;
657
1264
  private sceneNameToBeLoaded;
658
1265
  private loadingScene;
1266
+ /** @internal */
659
1267
  constructor(systemManager: SystemManager, systemFactory: SystemFactory, entityManager: EntityManager, assetManager: AssetManager);
660
1268
  addScene(sceneType: SceneType, name: string, openingScene?: boolean): void;
661
1269
  loadScene(name: string): void;
@@ -726,7 +1334,7 @@ declare class Game {
726
1334
  /**
727
1335
  * Add a new instance to be used as dependency
728
1336
  *
729
- * @param dependency The dependency instance
1337
+ * @param dependencyInstance The dependency instance
730
1338
  * @param name The name for the dependecy
731
1339
  */
732
1340
  addDependencyInstance(dependencyInstance: any, name: DependencyName): void;
@@ -740,14 +1348,20 @@ declare class Game {
740
1348
  stop(): void;
741
1349
  }
742
1350
 
743
- /** @category Components */
1351
+ /**
1352
+ * @public
1353
+ * @category Components
1354
+ */
744
1355
  interface AnimatorOptions {
745
1356
  animations: Map<string, Animation>;
746
1357
  animation: string;
747
1358
  speed: number;
748
1359
  playing: boolean;
749
1360
  }
750
- /** @category Components */
1361
+ /**
1362
+ * @public
1363
+ * @category Components
1364
+ */
751
1365
  declare class Animator {
752
1366
  animations: Map<string, Animation>;
753
1367
  animation: string;
@@ -760,7 +1374,10 @@ declare class Animator {
760
1374
  _currentAnimation: string;
761
1375
  constructor(options?: Partial<AnimatorOptions>);
762
1376
  }
763
- /** @category Components */
1377
+ /**
1378
+ * @public
1379
+ * @category Components
1380
+ */
764
1381
  declare class Animation {
765
1382
  image: HTMLImageElement | HTMLImageElement[];
766
1383
  slice: AnimationSlice;
@@ -769,21 +1386,30 @@ declare class Animation {
769
1386
  loop: boolean;
770
1387
  constructor(options?: Partial<Animation>);
771
1388
  }
772
- /** @category Components */
1389
+ /**
1390
+ * @public
1391
+ * @category Components
1392
+ */
773
1393
  type AnimationSlice = {
774
1394
  size: Vector2;
775
1395
  offset: Vector2;
776
1396
  padding: Vector2;
777
1397
  };
778
1398
 
779
- /** @category Components */
1399
+ /**
1400
+ * @public
1401
+ * @category Components
1402
+ */
780
1403
  interface AudioPlayerOptions {
781
1404
  action: AudioPlayerAction;
782
1405
  audioSource: HTMLAudioElement;
783
1406
  loop: boolean;
784
1407
  volume: number;
785
1408
  }
786
- /** @category Components */
1409
+ /**
1410
+ * @public
1411
+ * @category Components
1412
+ */
787
1413
  declare class AudioPlayer {
788
1414
  action: AudioPlayerAction;
789
1415
  audioSource: HTMLAudioElement;
@@ -794,9 +1420,16 @@ declare class AudioPlayer {
794
1420
  _currentAudio: string;
795
1421
  constructor(options?: Partial<AudioPlayerOptions>);
796
1422
  }
1423
+ /**
1424
+ * @public
1425
+ * @category Components
1426
+ */
797
1427
  type AudioPlayerAction = "stop" | "play" | "pause";
798
1428
 
799
- /** @category Components */
1429
+ /**
1430
+ * @public
1431
+ * @category Components
1432
+ */
800
1433
  interface ButtonOptions {
801
1434
  shape: ButtonShape;
802
1435
  width: number;
@@ -807,7 +1440,10 @@ interface ButtonOptions {
807
1440
  onClick: () => void;
808
1441
  onPressed: () => void;
809
1442
  }
810
- /** @category Components */
1443
+ /**
1444
+ * @public
1445
+ * @category Components
1446
+ */
811
1447
  declare class Button {
812
1448
  /** The shape of the button */
813
1449
  shape: ButtonShape;
@@ -829,34 +1465,52 @@ declare class Button {
829
1465
  onPressed: () => void;
830
1466
  constructor(options?: Partial<ButtonOptions>);
831
1467
  }
832
- /** @category Components */
1468
+ /**
1469
+ * @public
1470
+ * @category Components
1471
+ */
833
1472
  declare enum ButtonShape {
834
1473
  Rectangle = 0,
835
1474
  Circumference = 1
836
1475
  }
837
1476
 
838
- /** @category Components */
1477
+ /**
1478
+ * @public
1479
+ * @category Components
1480
+ */
839
1481
  declare class Children {
840
1482
  entities: Entity[];
841
1483
  }
842
1484
 
843
- /** @category Components */
1485
+ /**
1486
+ * @public
1487
+ * @category Components
1488
+ */
844
1489
  declare class Parent {
845
1490
  entity: Entity;
846
1491
  }
847
1492
 
848
- /** @category Components */
1493
+ /**
1494
+ * @public
1495
+ * @category Components
1496
+ */
849
1497
  interface TiledWrapperOptions {
850
1498
  tilemap: TiledTilemap;
851
1499
  layerToRender: string;
852
1500
  }
853
- /** @category Components */
1501
+ /**
1502
+ * @public
1503
+ * @category Components
1504
+ */
854
1505
  declare class TiledWrapper {
855
1506
  tilemap: TiledTilemap;
856
1507
  layerToRender: string;
857
1508
  constructor(options?: Partial<TiledWrapperOptions>);
858
1509
  }
859
- /** @category Components */
1510
+ /**
1511
+ * @public
1512
+ * @category Components
1513
+ */
860
1514
  interface TiledTilemap {
861
1515
  width: number;
862
1516
  height: number;
@@ -870,7 +1524,10 @@ interface TiledTilemap {
870
1524
  tileheight: number;
871
1525
  properties?: TiledProperty[];
872
1526
  }
873
- /** @category Components */
1527
+ /**
1528
+ * @public
1529
+ * @category Components
1530
+ */
874
1531
  interface TiledChunk {
875
1532
  data: number[];
876
1533
  x: number;
@@ -879,7 +1536,10 @@ interface TiledChunk {
879
1536
  height: number;
880
1537
  type?: string;
881
1538
  }
882
- /** @category Components */
1539
+ /**
1540
+ * @public
1541
+ * @category Components
1542
+ */
883
1543
  interface TiledLayer {
884
1544
  name: string;
885
1545
  id: number;
@@ -899,7 +1559,10 @@ interface TiledLayer {
899
1559
  tintcolor?: string;
900
1560
  properties?: TiledProperty[];
901
1561
  }
902
- /** @category Components */
1562
+ /**
1563
+ * @public
1564
+ * @category Components
1565
+ */
903
1566
  interface TiledObjectLayer {
904
1567
  draworder: string;
905
1568
  id: number;
@@ -912,7 +1575,10 @@ interface TiledObjectLayer {
912
1575
  y: number;
913
1576
  properties?: TiledProperty[];
914
1577
  }
915
- /** @category Components */
1578
+ /**
1579
+ * @public
1580
+ * @category Components
1581
+ */
916
1582
  interface TiledObject {
917
1583
  gid: number;
918
1584
  height: number;
@@ -926,14 +1592,20 @@ interface TiledObject {
926
1592
  y: number;
927
1593
  properties?: TiledProperty[];
928
1594
  }
929
- /** @category Components */
1595
+ /**
1596
+ * @public
1597
+ * @category Components
1598
+ */
930
1599
  interface TiledProperty {
931
1600
  name: string;
932
1601
  type: "int" | "bool" | "float" | "color" | "string";
933
1602
  value: number | string | boolean;
934
1603
  }
935
1604
 
936
- /** @category Components */
1605
+ /**
1606
+ * @public
1607
+ * @category Components
1608
+ */
937
1609
  interface TransformOptions {
938
1610
  position: Vector2;
939
1611
  scale: Vector2;
@@ -943,7 +1615,10 @@ interface TransformOptions {
943
1615
  localScale: Vector2;
944
1616
  localRotation: number;
945
1617
  }
946
- /** @category Components */
1618
+ /**
1619
+ * @public
1620
+ * @category Components
1621
+ */
947
1622
  declare class Transform {
948
1623
  /** Position relative to the zero point of the simulated world, or relative to the parent if it has one */
949
1624
  position: Vector2;
@@ -969,6 +1644,21 @@ declare class Transform {
969
1644
  constructor(options?: Partial<TransformOptions>);
970
1645
  }
971
1646
 
1647
+ /**
1648
+ * Configuration object for BallCollider creation
1649
+ * @public
1650
+ * @category Components
1651
+ * @example
1652
+ * ```js
1653
+ * const ballCollider = new BallCollider({
1654
+ * radius: 16,
1655
+ * offset: new Vector2(),
1656
+ * layer: "CollisionLayer",
1657
+ * physics: true,
1658
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
1659
+ * });
1660
+ * ```
1661
+ */
972
1662
  interface BallColliderOptions {
973
1663
  /** Circumference radius */
974
1664
  radius: number;
@@ -985,6 +1675,16 @@ interface BallColliderOptions {
985
1675
  * Circumference shaped collider for 2d collisions.
986
1676
  * @public
987
1677
  * @category Components
1678
+ * @example
1679
+ * ```js
1680
+ * const ballCollider = new BallCollider({
1681
+ * radius: 16,
1682
+ * offset: new Vector2(),
1683
+ * layer: "CollisionLayer",
1684
+ * physics: true,
1685
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
1686
+ * });
1687
+ * ```
988
1688
  */
989
1689
  declare class BallCollider implements Collider {
990
1690
  /** Circumference radius */
@@ -1002,6 +1702,23 @@ declare class BallCollider implements Collider {
1002
1702
  constructor(options?: Partial<BallColliderOptions>);
1003
1703
  }
1004
1704
 
1705
+ /**
1706
+ * Configuration object for BoxCollider creation
1707
+ * @public
1708
+ * @category Components
1709
+ * @example
1710
+ * ```js
1711
+ * const boxCollider = new BoxCollider({
1712
+ * width: 16,
1713
+ * height: 16,
1714
+ * rotation: 0,
1715
+ * offset: new Vector2(),
1716
+ * layer: "CollisionLayer",
1717
+ * physics: true,
1718
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
1719
+ * });
1720
+ * ```
1721
+ */
1005
1722
  interface BoxColliderOptions {
1006
1723
  /** Collision layer*/
1007
1724
  layer: string;
@@ -1022,6 +1739,18 @@ interface BoxColliderOptions {
1022
1739
  * Rectangle shaped collider for 2d collisions.
1023
1740
  * @public
1024
1741
  * @category Components
1742
+ * @example
1743
+ * ```js
1744
+ * const boxCollider = new BoxCollider({
1745
+ * width: 16,
1746
+ * height: 16,
1747
+ * rotation: 0,
1748
+ * offset: new Vector2(),
1749
+ * layer: "CollisionLayer",
1750
+ * physics: true,
1751
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
1752
+ * });
1753
+ * ```
1025
1754
  */
1026
1755
  declare class BoxCollider implements Collider {
1027
1756
  /** Collision layer*/
@@ -1043,6 +1772,22 @@ declare class BoxCollider implements Collider {
1043
1772
  constructor(options?: Partial<BoxColliderOptions>);
1044
1773
  }
1045
1774
 
1775
+ /**
1776
+ * Configuration object for EdgeCollider creation
1777
+ * @public
1778
+ * @category Components
1779
+ * @example
1780
+ * ```js
1781
+ * const edgeCollider = new EdgeCollider({
1782
+ * vertexModel: [new Vector2(0, 16), new Vector2(16, 16)],
1783
+ * rotation: 0,
1784
+ * offset: new Vector2(),
1785
+ * layer: "CollisionLayer",
1786
+ * physics: true,
1787
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
1788
+ * });
1789
+ * ```
1790
+ */
1046
1791
  interface EdgeColliderOptions {
1047
1792
  /** Collection of 2d vectors representing the vertices of the collider */
1048
1793
  vertexModel: Vector2[];
@@ -1061,6 +1806,16 @@ interface EdgeColliderOptions {
1061
1806
  * Collider composed of lines defined by its vertices, for 2d collisions.
1062
1807
  * @public
1063
1808
  * @category Components
1809
+ * @example
1810
+ * ```js
1811
+ * const edgeCollider = new EdgeCollider({
1812
+ * vertexModel: [new Vector2(0, 16), new Vector2(16, 16)],
1813
+ * offset: new Vector2(),
1814
+ * layer: "CollisionLayer",
1815
+ * physics: true,
1816
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
1817
+ * });
1818
+ * ```
1064
1819
  */
1065
1820
  declare class EdgeCollider implements Collider {
1066
1821
  /** Collection of 2d vectors representing the vertices of the collider */
@@ -1080,6 +1835,22 @@ declare class EdgeCollider implements Collider {
1080
1835
  constructor(options?: Partial<EdgeColliderOptions>);
1081
1836
  }
1082
1837
 
1838
+ /**
1839
+ * Configuration object for PolygonCollider creation
1840
+ * @public
1841
+ * @category Components
1842
+ * @example
1843
+ * ```js
1844
+ * const polygonCollider = new PolygonCollider({
1845
+ * vertexModel: [new Vector2(0, 16), new Vector2(16, 16), new Vector2(16, 0), new Vector2(0, 0)],
1846
+ * rotation: 0,
1847
+ * offset: new Vector2(),
1848
+ * layer: "CollisionLayer",
1849
+ * physics: true,
1850
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
1851
+ * });
1852
+ * ```
1853
+ */
1083
1854
  interface PolygonColliderOptions {
1084
1855
  /** Collection of 2d vectors representing the vertices of the collider */
1085
1856
  vertexModel: Vector2[];
@@ -1098,6 +1869,17 @@ interface PolygonColliderOptions {
1098
1869
  * Polygon shaped Collider for 2d collisions. Only convex polygons are allowed.
1099
1870
  * @public
1100
1871
  * @category Components
1872
+ * @example
1873
+ * ```js
1874
+ * const polygonCollider = new PolygonCollider({
1875
+ * vertexModel: [new Vector2(0, 16), new Vector2(16, 16), new Vector2(16, 0), new Vector2(0, 0)],
1876
+ * rotation: 0,
1877
+ * offset: new Vector2(),
1878
+ * layer: "CollisionLayer",
1879
+ * physics: true,
1880
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
1881
+ * });
1882
+ * ```
1101
1883
  */
1102
1884
  declare class PolygonCollider implements Collider {
1103
1885
  /** Collection of 2d vectors representing the vertices of the collider */
@@ -1119,7 +1901,7 @@ declare class PolygonCollider implements Collider {
1119
1901
 
1120
1902
  /**
1121
1903
  * The type of the rigid body to create:
1122
- * - Dynamic: This type of body is affected by gravity and velopcity.
1904
+ * - Dynamic: This type of body is affected by gravity and velocity.
1123
1905
  * - Static: This type of body is immovable, is unaffected by velocity and gravity.
1124
1906
  * @category Components
1125
1907
  * @public
@@ -1128,20 +1910,114 @@ declare enum RigidBodyType {
1128
1910
  Dynamic = 0,
1129
1911
  Static = 1
1130
1912
  }
1913
+ /**
1914
+ * RigidBody configuration options
1915
+ * @public
1916
+ * @category Components
1917
+ * @example
1918
+ * ```js
1919
+ const rigidBody = new RigidBody({
1920
+ rigidBodyType: RigidBodyType.Dynamic,
1921
+ gravity: 10,
1922
+ velocity: new Vector2(1, 0),
1923
+ acceleration: new Vector2(1, 0)
1924
+ });
1925
+ * ```
1926
+ * @example
1927
+ * ```js
1928
+ const rigidBody = new RigidBody({
1929
+ rigidBodyType: RigidBodyType.Static,
1930
+ });
1931
+ * ```
1932
+ */
1131
1933
  interface RigidBodyOptions {
1934
+ /**
1935
+ * The type of the rigid body to create:
1936
+ * - Dynamic: This type of body is affected by gravity and velocity.
1937
+ * - Static: This type of body is immovable, is unaffected by velocity and gravity.
1938
+ * @public
1939
+ */
1132
1940
  type: RigidBodyType;
1941
+ /**
1942
+ * Velocity applied to the x-axis and y-axis expressed in pixels per second. Only for Dynamic bodies
1943
+ * @public
1944
+ */
1133
1945
  velocity: Vector2;
1946
+ /**
1947
+ * Gravity expressed in pixels per second squared. Only for Dynamic bodies
1948
+ * @public
1949
+ */
1134
1950
  gravity: number;
1951
+ /**
1952
+ * Acceleration expressed in pixels per second squared. Only for Dynamic bodies
1953
+ * @public
1954
+ */
1135
1955
  acceleration: Vector2;
1136
1956
  }
1957
+ /**
1958
+ * The RigidBody component puts the entity under simulation of the physics engine, where it will interact with other objects that have a RigidBody.\
1959
+ * There are two types of bodies:
1960
+ * - Dynamic = This type of body is affected by gravity, can be velocity-applied and collides with other rigid bodies.
1961
+ * - Static = This type of body is immovable, no velocity can be applied to it and it is not affected by gravity. It is the body type that consumes the least processing resources.
1962
+ * @public
1963
+ * @category Components
1964
+ * @example
1965
+ * ```js
1966
+ const rigidBody = new RigidBody({
1967
+ rigidBodyType: RigidBodyType.Dynamic,
1968
+ gravity: 10,
1969
+ velocity: new Vector2(1, 0),
1970
+ acceleration: new Vector2(1, 0)
1971
+ });
1972
+ * ```
1973
+ * @example
1974
+ * ```js
1975
+ const rigidBody = new RigidBody({
1976
+ rigidBodyType: RigidBodyType.Static,
1977
+ });
1978
+ * ```
1979
+ */
1137
1980
  declare class RigidBody {
1981
+ /**
1982
+ * The type of the rigid body to create:
1983
+ * - Dynamic: This type of body is affected by gravity and velocity.
1984
+ * - Static: This type of body is immovable, is unaffected by velocity and gravity.
1985
+ * @public
1986
+ */
1138
1987
  type: RigidBodyType;
1988
+ /**
1989
+ * Velocity applied to the x-axis and y-axis expressed in pixels per second. Only for Dynamic bodies
1990
+ * @public
1991
+ */
1139
1992
  velocity: Vector2;
1993
+ /**
1994
+ * Gravity expressed in pixels per second squared. Only for Dynamic bodies
1995
+ * @public
1996
+ */
1140
1997
  gravity: number;
1998
+ /**
1999
+ * Acceleration expressed in pixels per second squared. Only for Dynamic bodies
2000
+ * @public
2001
+ */
1141
2002
  acceleration: Vector2;
1142
2003
  constructor(options?: Partial<RigidBodyOptions>);
1143
2004
  }
1144
2005
 
2006
+ /**
2007
+ * Configuration object for TilemapCollider creation
2008
+ * @public
2009
+ * @category Components
2010
+ * @example
2011
+ * ```js
2012
+ * const tilemapCollider = new TilemapCollider({
2013
+ * composite: true,
2014
+ * offset: new Vector2(),
2015
+ * layer: "CollisionLayer",
2016
+ * physics: true,
2017
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
2018
+ * });
2019
+ * ```
2020
+ */
1145
2021
  interface TilemapColliderOptions {
1146
2022
  /** Generate colliders that represent the outer lines of the tile map */
1147
2023
  composite: boolean;
@@ -1154,6 +2030,22 @@ interface TilemapColliderOptions {
1154
2030
  /** TRUE if this collider interact with rigid bodies */
1155
2031
  physics: boolean;
1156
2032
  }
2033
+ /**
2034
+ * Generates rectangle colliders for the map edge tiles (or lines if composite is TRUE).\
2035
+ * **Limitations:** At the moment, it is not possible to modify the shape of the collider once it has been generated.
2036
+ * @public
2037
+ * @category Components
2038
+ * @example
2039
+ * ```js
2040
+ * const tilemapCollider = new TilemapCollider({
2041
+ * composite: true,
2042
+ * offset: new Vector2(),
2043
+ * layer: "CollisionLayer",
2044
+ * physics: true,
2045
+ * ignoreCollisionsWithLayer: ["IgnoredLayer"]
2046
+ * });
2047
+ * ```
2048
+ */
1157
2049
  declare class TilemapCollider implements Collider {
1158
2050
  /** Generate colliders that represent the outer lines of the tile map */
1159
2051
  composite: boolean;
@@ -1218,10 +2110,27 @@ interface ShadowRenderData extends RenderData {
1218
2110
  width: number;
1219
2111
  lights: Light[];
1220
2112
  }
2113
+ /**
2114
+ * Represents a light source
2115
+ * @internal
2116
+ * @example
2117
+ * ```js
2118
+ * const light = {
2119
+ * position: new Vector2(10, 10),
2120
+ * radius: 32,
2121
+ * smooth: true,
2122
+ * intensity: 0.7,
2123
+ * }
2124
+ * ```
2125
+ */
1221
2126
  interface Light {
2127
+ /** The position of the light source */
1222
2128
  position: Vector2;
2129
+ /** The radius of the light source */
1223
2130
  radius: number;
2131
+ /** If it's TRUE the light will gradually disappear away from the origin point, if FALSE the light will be constant over its entire area. */
1224
2132
  smooth: boolean;
2133
+ /** The intensity of the light, between 0 and 1 */
1225
2134
  intensity: number;
1226
2135
  }
1227
2136
 
@@ -1340,6 +2249,11 @@ interface VideoRenderData extends RenderData {
1340
2249
  tintColor?: string;
1341
2250
  }
1342
2251
 
2252
+ /**
2253
+ * Default render layer
2254
+ * @public
2255
+ * @category Components
2256
+ */
1343
2257
  declare const defaultRenderLayer = "Default";
1344
2258
  /**
1345
2259
  * @public
@@ -1964,6 +2878,7 @@ declare class GamepadController {
1964
2878
  */
1965
2879
  vibrate(duration?: number, weakMagnitude?: number, strongMagnitude?: number, startDelay?: number): void;
1966
2880
  }
2881
+ /** @internal */
1967
2882
  type VibrationInput = {
1968
2883
  duration: number;
1969
2884
  weakMagnitude: number;
@@ -2124,10 +3039,19 @@ declare class TouchScreen {
2124
3039
  interactions: TouchInteraction[];
2125
3040
  }
2126
3041
 
3042
+ /**
3043
+ * Manages the input sources: Keyboard, Mouse, Gamepad, TouchScreen.
3044
+ * @public
3045
+ * @category Managers
3046
+ */
2127
3047
  declare class InputManager {
3048
+ /** Manages mouse information. */
2128
3049
  readonly keyboard: Keyboard;
3050
+ /** Manages keyboard information. */
2129
3051
  readonly mouse: Mouse;
3052
+ /** Manages touch screen information. */
2130
3053
  readonly touchScreen: TouchScreen;
3054
+ /** Manages gamepads information. */
2131
3055
  readonly gamepads: GamepadController[];
2132
3056
  constructor();
2133
3057
  }
@@ -2189,6 +3113,20 @@ declare class TimeManager {
2189
3113
  updateForPhysics(time: number): void;
2190
3114
  }
2191
3115
 
3116
+ /**
3117
+ * Abstract class which can be used to create Systems.\
3118
+ * It includes the following dependencies: EntityManager, AssetManager, SceneManager, TimeManager, InputManager, CollisionRepository.
3119
+ * @public
3120
+ * @category Core
3121
+ * @example
3122
+ * ```javascript
3123
+ * class SomeSystem extends GameSystem {
3124
+ * onUpdate() {
3125
+ * const result = this.entityManager.search(SomeComponent);
3126
+ * }
3127
+ * }
3128
+ * ```
3129
+ */
2192
3130
  declare abstract class GameSystem implements System {
2193
3131
  protected readonly entityManager: EntityManager;
2194
3132
  protected readonly assetManager: AssetManager;
@@ -2199,10 +3137,48 @@ declare abstract class GameSystem implements System {
2199
3137
  onUpdate(): void;
2200
3138
  }
2201
3139
 
3140
+ /**
3141
+ * Decorator to indicate that the target system will run in the game logic loop.
3142
+ * @public
3143
+ * @category Decorators
3144
+ * @example
3145
+ * ```typescript
3146
+ * @gameLogicSystem()
3147
+ * class SomeSystem {
3148
+ * }
3149
+ * ```
3150
+ */
2202
3151
  declare function gameLogicSystem(): (target: SystemType) => void;
3152
+ /**
3153
+ * Decorator to indicate that the target system will run in the physics loop.
3154
+ * @public
3155
+ * @category Decorators
3156
+ * @example
3157
+ * ```typescript
3158
+ * @gamePhysicsSystem()
3159
+ * class SomeSystem {
3160
+ * }
3161
+ * ```
3162
+ */
2203
3163
  declare function gamePhysicsSystem(): (target: SystemType) => void;
3164
+ /**
3165
+ * Decorator to indicate that the target system will be executed at the begining of the render loop.
3166
+ * @public
3167
+ * @category Decorators
3168
+ * @example
3169
+ * ```typescript
3170
+ * @gamePreRenderSystem()
3171
+ * class SomeSystem {
3172
+ * }
3173
+ * ```
3174
+ */
2204
3175
  declare function gamePreRenderSystem(): (target: SystemType) => void;
2205
3176
 
3177
+ /**
3178
+ * Symbols to be used as dependency identifiers
3179
+ * @public
3180
+ * @category Config
3181
+ */
2206
3182
  declare const Symbols: {
2207
3183
  AssetManager: symbol;
2208
3184
  CanvasElement: symbol;
@@ -2215,4 +3191,4 @@ declare const Symbols: {
2215
3191
  TimeManager: symbol;
2216
3192
  };
2217
3193
 
2218
- export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, Children, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, Keyboard, type Light, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, Parent, Polygon, PolygonCollider, type PolygonColliderOptions, 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, defaultRenderLayer, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, randomFloat, randomInt, range };
3194
+ export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, Children, 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, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, Parent, Polygon, PolygonCollider, type PolygonColliderOptions, 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, defaultRenderLayer, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, randomFloat, randomInt, range };