angry-pixel 1.2.6 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/lib/index.cjs.js +2 -1
  2. package/lib/index.cjs.js.map +1 -0
  3. package/lib/index.d.ts +5 -41
  4. package/lib/index.esm.js +2 -1
  5. package/lib/index.esm.js.map +1 -0
  6. package/lib/index.js +2 -1
  7. package/lib/index.js.map +1 -0
  8. package/package.json +6 -30
  9. package/.github/workflows/analyzeCode.yml +0 -25
  10. package/.github/workflows/buildCode.yml +0 -23
  11. package/.github/workflows/main.yml +0 -15
  12. package/.github/workflows/setupNode.yml +0 -40
  13. package/api-docs/.nojekyll +0 -1
  14. package/api-docs/assets/highlight.css +0 -92
  15. package/api-docs/assets/main.js +0 -59
  16. package/api-docs/assets/navigation.js +0 -1
  17. package/api-docs/assets/search.js +0 -1
  18. package/api-docs/assets/style.css +0 -1383
  19. package/api-docs/classes/Animator.html +0 -128
  20. package/api-docs/classes/AudioPlayer.html +0 -131
  21. package/api-docs/classes/BallCollider.html +0 -132
  22. package/api-docs/classes/BoxCollider.html +0 -136
  23. package/api-docs/classes/Button.html +0 -125
  24. package/api-docs/classes/Camera.html +0 -114
  25. package/api-docs/classes/Component.html +0 -106
  26. package/api-docs/classes/EdgeCollider.html +0 -134
  27. package/api-docs/classes/Game.html +0 -24
  28. package/api-docs/classes/GameCamera.html +0 -163
  29. package/api-docs/classes/GameObject.html +0 -149
  30. package/api-docs/classes/GamepadController.html +0 -11
  31. package/api-docs/classes/GamepadData.html +0 -81
  32. package/api-docs/classes/KeyboardController.html +0 -43
  33. package/api-docs/classes/MaskRenderer.html +0 -119
  34. package/api-docs/classes/MouseController.html +0 -14
  35. package/api-docs/classes/PhysicsComponent.html +0 -107
  36. package/api-docs/classes/PolygonCollider.html +0 -134
  37. package/api-docs/classes/PreRenderComponent.html +0 -107
  38. package/api-docs/classes/Rectangle.html +0 -30
  39. package/api-docs/classes/RigidBody.html +0 -123
  40. package/api-docs/classes/Rotation.html +0 -5
  41. package/api-docs/classes/Scene.html +0 -73
  42. package/api-docs/classes/SpacePointer.html +0 -147
  43. package/api-docs/classes/Sprite.html +0 -20
  44. package/api-docs/classes/SpriteRenderer.html +0 -134
  45. package/api-docs/classes/TextRenderer.html +0 -138
  46. package/api-docs/classes/TiledTilemapRenderer.html +0 -127
  47. package/api-docs/classes/TilemapCollider.html +0 -124
  48. package/api-docs/classes/TilemapRenderer.html +0 -126
  49. package/api-docs/classes/TouchController.html +0 -8
  50. package/api-docs/classes/Transform.html +0 -124
  51. package/api-docs/classes/Vector2.html +0 -65
  52. package/api-docs/classes/VideoRenderer.html +0 -145
  53. package/api-docs/enums/BroadPhaseMethods.html +0 -3
  54. package/api-docs/enums/ButtonType.html +0 -3
  55. package/api-docs/enums/CollisionMethods.html +0 -3
  56. package/api-docs/enums/RigidBodyType.html +0 -4
  57. package/api-docs/enums/TextOrientation.html +0 -5
  58. package/api-docs/enums/TilemapOrientation.html +0 -5
  59. package/api-docs/functions/between.html +0 -5
  60. package/api-docs/functions/clamp.html +0 -5
  61. package/api-docs/functions/fixedRound.html +0 -4
  62. package/api-docs/functions/randomFloat.html +0 -4
  63. package/api-docs/functions/randomInt.html +0 -4
  64. package/api-docs/functions/range.html +0 -5
  65. package/api-docs/index.html +0 -37
  66. package/api-docs/interfaces/AnimationConfig.html +0 -10
  67. package/api-docs/interfaces/AnimatorOptions.html +0 -6
  68. package/api-docs/interfaces/AudioPlayerOptions.html +0 -8
  69. package/api-docs/interfaces/BallColliderOptions.html +0 -16
  70. package/api-docs/interfaces/BoxColliderOptions.html +0 -20
  71. package/api-docs/interfaces/ButtonOptions.html +0 -16
  72. package/api-docs/interfaces/ColliderComponent.html +0 -14
  73. package/api-docs/interfaces/CollisionData.html +0 -10
  74. package/api-docs/interfaces/EdgeColliderOptions.html +0 -18
  75. package/api-docs/interfaces/GameConfig.html +0 -28
  76. package/api-docs/interfaces/IAssetManager.html +0 -40
  77. package/api-docs/interfaces/ICollider.html +0 -11
  78. package/api-docs/interfaces/ICollision.html +0 -4
  79. package/api-docs/interfaces/ICollisionResolution.html +0 -4
  80. package/api-docs/interfaces/IDomManager.html +0 -6
  81. package/api-docs/interfaces/IGameObjectManager.html +0 -49
  82. package/api-docs/interfaces/IInputManager.html +0 -12
  83. package/api-docs/interfaces/IPhysicsManager.html +0 -8
  84. package/api-docs/interfaces/IRenderManager.html +0 -7
  85. package/api-docs/interfaces/ISceneManager.html +0 -18
  86. package/api-docs/interfaces/ITimeManager.html +0 -16
  87. package/api-docs/interfaces/MaskRendererOptions.html +0 -18
  88. package/api-docs/interfaces/PolygonColliderOptions.html +0 -18
  89. package/api-docs/interfaces/RigidBodyOptions.html +0 -17
  90. package/api-docs/interfaces/Slice.html +0 -5
  91. package/api-docs/interfaces/SpriteConfig.html +0 -10
  92. package/api-docs/interfaces/SpriteRendererOptions.html +0 -32
  93. package/api-docs/interfaces/TextRendererOptions.html +0 -38
  94. package/api-docs/interfaces/TiledChunk.html +0 -7
  95. package/api-docs/interfaces/TiledLayer.html +0 -17
  96. package/api-docs/interfaces/TiledTilemap.html +0 -9
  97. package/api-docs/interfaces/TiledTilemapRendererOptions.html +0 -18
  98. package/api-docs/interfaces/TilemapColliderOptions.html +0 -12
  99. package/api-docs/interfaces/TilemapRendererOptions.html +0 -22
  100. package/api-docs/interfaces/Tileset.html +0 -13
  101. package/api-docs/interfaces/TouchInteraction.html +0 -6
  102. package/api-docs/interfaces/VideoRendererOptions.html +0 -34
  103. package/api-docs/modules.html +0 -85
  104. package/api-docs/types/CollisionMatrix.html +0 -1
  105. package/lib/component/Animation.d.ts +0 -12
  106. package/lib/component/Animator.d.ts +0 -139
  107. package/lib/component/AudioPlayer.d.ts +0 -97
  108. package/lib/component/Button.d.ts +0 -117
  109. package/lib/component/Camera.d.ts +0 -47
  110. package/lib/component/RigidBody.d.ts +0 -97
  111. package/lib/component/Sprite.d.ts +0 -22
  112. package/lib/component/Transform.d.ts +0 -65
  113. package/lib/component/collider/BallCollider.d.ts +0 -73
  114. package/lib/component/collider/BoxCollider.d.ts +0 -90
  115. package/lib/component/collider/Collider.d.ts +0 -82
  116. package/lib/component/collider/EdgeCollider.d.ts +0 -81
  117. package/lib/component/collider/PolygonCollider.d.ts +0 -92
  118. package/lib/component/collider/TilemapCollider.d.ts +0 -71
  119. package/lib/component/rendering/MaskRenderer.d.ts +0 -83
  120. package/lib/component/rendering/Sprite.d.ts +0 -61
  121. package/lib/component/rendering/SpriteRenderer.d.ts +0 -133
  122. package/lib/component/rendering/TextRenderer.d.ts +0 -145
  123. package/lib/component/rendering/TiledTilemapRenderer.d.ts +0 -186
  124. package/lib/component/rendering/TilemapRenderer.d.ts +0 -170
  125. package/lib/component/rendering/VideoRenderer.d.ts +0 -158
  126. package/lib/core/Component.d.ts +0 -203
  127. package/lib/core/Game.d.ts +0 -112
  128. package/lib/core/GameActor.d.ts +0 -131
  129. package/lib/core/GameConfig.d.ts +0 -61
  130. package/lib/core/GameObject.d.ts +0 -196
  131. package/lib/core/Scene.d.ts +0 -45
  132. package/lib/core/facades/AssetManagerFacade.d.ts +0 -51
  133. package/lib/core/facades/DomManagerFacade.d.ts +0 -8
  134. package/lib/core/facades/GameObjectManagerFacade.d.ts +0 -70
  135. package/lib/core/facades/InputManagerFacade.d.ts +0 -13
  136. package/lib/core/facades/SceneManagerFacade.d.ts +0 -18
  137. package/lib/core/facades/TimeManagerFacade.d.ts +0 -11
  138. package/lib/core/ioc/Config.d.ts +0 -4
  139. package/lib/core/managers/AssetManager.d.ts +0 -95
  140. package/lib/core/managers/DomManager.d.ts +0 -23
  141. package/lib/core/managers/GameObjectManager.d.ts +0 -118
  142. package/lib/core/managers/HeadlessIterationManager.d.ts +0 -33
  143. package/lib/core/managers/IterationManager.d.ts +0 -63
  144. package/lib/core/managers/SceneManager.d.ts +0 -93
  145. package/lib/core/managers/TimeManager.d.ts +0 -73
  146. package/lib/gameObject/GameCamera.d.ts +0 -38
  147. package/lib/gameObject/SpacePointer.d.ts +0 -15
  148. package/lib/input/GamepadController.d.ts +0 -225
  149. package/lib/input/InputManager.d.ts +0 -37
  150. package/lib/input/KeyboardController.d.ts +0 -81
  151. package/lib/input/MouseController.d.ts +0 -56
  152. package/lib/input/TouchController.d.ts +0 -45
  153. package/lib/utils/Container.d.ts +0 -13
  154. package/lib/utils/Exception.d.ts +0 -5
  155. package/lib/utils/UUID.d.ts +0 -1
  156. package/typedoc.json +0 -13
@@ -1,131 +0,0 @@
1
- import { IPhysicsManager } from "angry-pixel-2d-physics";
2
- import { IInputManager } from "../input/InputManager";
3
- import { Container } from "../utils/Container";
4
- import { GameConfig } from "./GameConfig";
5
- import { GameObject, GameObjectClass } from "./GameObject";
6
- import { IAssetManager } from "./managers/AssetManager";
7
- import { IDomManager } from "./managers/DomManager";
8
- import { IGameObjectManager } from "./managers/GameObjectManager";
9
- import { FrameEvent } from "./managers/IterationManager";
10
- import { ISceneManager } from "./managers/SceneManager";
11
- import { ITimeManager } from "./managers/TimeManager";
12
- import { IRenderManager } from "angry-pixel-2d-renderer";
13
- /** @private */
14
- export interface InitOptions {
15
- [key: string]: any;
16
- }
17
- /**
18
- * Base class from which Scene, GameObjects and Component are extended.
19
- * @private
20
- */
21
- export declare abstract class GameActor {
22
- /** @private */
23
- protected readonly updateEvent: FrameEvent;
24
- /** @private */
25
- protected readonly container: Container;
26
- /** Used to load and retrieve assets. */
27
- protected readonly assetManager: IAssetManager;
28
- /** Used to access the canvas element. */
29
- protected readonly domManager: IDomManager;
30
- /** Used to obtain information about the input. */
31
- protected readonly inputManager: IInputManager;
32
- /** Used to create, retrieve and destroy GameObject instances. */
33
- protected readonly gameObjectManager: IGameObjectManager;
34
- /** Used to manage colliders and rigidBodies. */
35
- protected readonly physicsManager: IPhysicsManager;
36
- /** Used to manage the render and camera data. */
37
- protected readonly renderManager: IRenderManager;
38
- /** Used to load scenes. */
39
- protected readonly sceneManager: ISceneManager;
40
- /** Used to manage and obtain information about the time in the game. */
41
- protected readonly timeManager: ITimeManager;
42
- /** Object containing the game configuration. */
43
- protected readonly gameConfig: GameConfig;
44
- private started;
45
- /** @private */
46
- constructor(container: Container);
47
- /** @private */
48
- dispatch(event: FrameEvent, options?: InitOptions): void;
49
- /**
50
- * This method is called after instantiation (recommended for the creation of game objects).
51
- */
52
- protected init?(options?: InitOptions): void;
53
- /**
54
- * This method is called only once on the first available frame.
55
- */
56
- protected start?(): void;
57
- /**
58
- * This method is called on every frame.
59
- */
60
- protected update?(): void;
61
- /**
62
- * This method is called before destruction.
63
- */
64
- protected onDestroy?(): void;
65
- /**
66
- * Adds a new game object to the scene.
67
- * @param gameObjectClass The game object class
68
- * @returns The added game object
69
- */
70
- protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
71
- /**
72
- * Adds a new game object to the scene.
73
- * @param gameObjectClass The game object class
74
- * @param name The name of the game object
75
- * @returns The added game object
76
- */
77
- protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, name: string): T;
78
- /**
79
- * Adds a new game object to the scene.
80
- * @param gameObjectClass The game object class
81
- * @param options This options will be passed to the init method
82
- * @returns The added game object
83
- */
84
- protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options: InitOptions): T;
85
- /**
86
- * Adds a new game object to the scene.
87
- * @param gameObjectClass The game object class
88
- * @param options [optional] This options will be passed to the init method
89
- * @param name [optional] The name of the game object
90
- * @returns The added game object
91
- */
92
- protected addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions | string, name?: string): T;
93
- /**
94
- * Returns all the game objects in the scene.
95
- * @returns The found game objects
96
- */
97
- protected findGameObjects(): GameObject[];
98
- /**
99
- * Returns a collection of found game objects for the given class
100
- * @param gameObjectClass The game object class to find
101
- * @returns The found game objects
102
- */
103
- protected findGameObjects<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T[];
104
- /**
105
- * Returns the first game object found for the given class, or undefined otherwise.
106
- * @param gameObjectClass The game object class to find
107
- * @returns The found game object
108
- */
109
- protected findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
110
- /**
111
- * Returns the first game object found for the given name, or undefined otherwise.
112
- * @param name The name of the game object to find
113
- * @returns The found game object
114
- */
115
- protected findGameObject<T extends GameObject>(name: string): T;
116
- /**
117
- * Returns a collection of game objects found for the given tag
118
- * @param tag The tag of the game objects to find
119
- * @returns The found game objects
120
- */
121
- protected findGameObjectsByTag<T extends GameObject>(tag: string): T[];
122
- /**
123
- * Destroy the given game object
124
- * @param gameObject The game object to destory
125
- */
126
- protected destroyGameObject(gameObject: GameObject): void;
127
- /** @private */
128
- protected abstract _destroy(): void;
129
- /** @private */
130
- protected abstract _stopGame(): void;
131
- }
@@ -1,61 +0,0 @@
1
- import { BroadPhaseMethods, CollisionMatrix, CollisionMethods } from "angry-pixel-2d-physics";
2
- import { Rectangle, Vector2 } from "angry-pixel-math";
3
- /**
4
- * Game configuration options
5
- * @public
6
- * @category Core
7
- * @example
8
- * ```js
9
- * const gameConfig = {
10
- * containerNode: document.getElementById("app"),
11
- * gameWidth: 1920,
12
- * gameHeight: 1080,
13
- * debugEnabled: false,
14
- * canvasColor: "#000000",
15
- * physicsFramerate: 180,
16
- * headless: false,
17
- * spriteDefaultScale: new Vector2(1, 1),
18
- * collisions: {
19
- * collisionMatrix: [
20
- * ["layer1", "layer2"],
21
- * ["layer1", "layer3"],
22
- * ],
23
- * collisionMethod: CollisionMethods.SAT,
24
- * collisionBroadPhaseMethod: BroadPhaseMethods.SpartialGrid,
25
- * collisionArea: new Rectangle(-960, -540, 1920, 1080),
26
- * }
27
- * };
28
- * ```
29
- */
30
- export interface GameConfig {
31
- /** HTML element where the game will be created */
32
- containerNode?: HTMLElement;
33
- /** Game width */
34
- gameWidth?: number;
35
- /** Game height */
36
- gameHeight?: number;
37
- /** Enables the debug mode */
38
- debugEnabled?: boolean;
39
- /** Background color of canvas */
40
- canvasColor?: string;
41
- /** Framerate for physics execution. The allowed values are 60, 120, 180, 240.
42
- * The higher the framerate, the more accurate the physics will be, but it will consume more processor resources.
43
- * Default value is 180.
44
- */
45
- physicsFramerate?: number;
46
- /** Define a general scaling for all sprites. It can be overwritten individually on each sprite */
47
- spriteDefaultScale?: Vector2;
48
- /** Enable Headless mode. The input and rendering functions are turned off. Ideal for game server development */
49
- headless?: boolean;
50
- /** Collision configuration options */
51
- collisions?: {
52
- /** Collision detection method: CollisionMethods.SAT or CollisionMethods.ABB. Default value is CollisionMethods.SAT */
53
- collisionMethod?: CollisionMethods;
54
- /** Define a fixed area */
55
- collisionArea?: Rectangle;
56
- /** Define a fixed rectangular area for collision detection */
57
- collisionMatrix?: CollisionMatrix;
58
- /** Collision broad phase method: BroadPhaseMethods.QuadTree or BroadPhaseMethods.SpartialGrid. Default values is BroadPhaseMethods.SpartialGrid */
59
- collisionBroadPhaseMethod?: BroadPhaseMethods;
60
- };
61
- }
@@ -1,196 +0,0 @@
1
- import { Component, ComponentClass } from "./Component";
2
- import { Transform } from "../component/Transform";
3
- import { RigidBody } from "../component/RigidBody";
4
- import { Scene } from "./Scene";
5
- import { GameActor, InitOptions } from "./GameActor";
6
- import { Container } from "../utils/Container";
7
- /** @private */
8
- export declare const LAYER_DEFAULT = "Default";
9
- /** @private */
10
- export type GameObjectClass<T extends GameObject = GameObject> = new (container: Container, id: number, name?: string, parent?: GameObject) => T;
11
- /**
12
- * Base class for all objects in the scene.
13
- * @public
14
- * @category Core
15
- * @example
16
- * ```js
17
- * class Player extends GameObject {
18
- * init(options) {
19
- * this.tag = "Tag";
20
- * this.layer = "Default";
21
- * }
22
- * start() {
23
- * // executed in the first available frame
24
- * }
25
- * update() {
26
- * // executed on every frame
27
- * }
28
- * }
29
- * ```
30
- * @example
31
- * ```ts
32
- * class Player extends GameObject {
33
- * protected init(options?: InitOptions): void {
34
- * this.tag = "Tag";
35
- * this.layer = "Default";
36
- * }
37
- * protected start(): void {
38
- * // executed in the first available frame
39
- * }
40
- * protected update(): void {
41
- * // executed on every frame
42
- * }
43
- * }
44
- * ```
45
- */
46
- export declare class GameObject extends GameActor {
47
- /** Id automatically assigned at the time of instantiation. */
48
- readonly id: number;
49
- /** Name given manually at the time of instantiation. */
50
- readonly name: string;
51
- /** Tag used to group objects and optimize their retrieval. */
52
- tag: string;
53
- /** Layer used for rendering and physics. Default value is "Default". */
54
- layer: string;
55
- /** TRUE for UI objects. Default value is FALSE. Renders the object outside the game world coordinates. */
56
- ui: boolean;
57
- /** TRUE to prevent the object from being automatically destroyed when changing the scene. Default value is FALSE. */
58
- keep: boolean;
59
- /** @private */
60
- private _parent;
61
- /** @private */
62
- private _active;
63
- /** @private */
64
- private components;
65
- /** @private */
66
- private activeComponentsCache;
67
- /** @private */
68
- private activeChildrenCache;
69
- /** @private */
70
- constructor(container: Container, id: number, name?: string, parent?: GameObject);
71
- /** TRUE for enabled object, FALSE for disabled object. */
72
- get active(): boolean;
73
- /** TRUE for enabled object, FALSE for disabled object. */
74
- set active(active: boolean);
75
- /** Parent game object. A child object depends on the parent's Transform. */
76
- get parent(): GameObject | null;
77
- /** Parent game object. A child object depends on the parent's Transform. */
78
- set parent(parent: GameObject | null);
79
- /** @private */
80
- private updateComponentsActiveStatus;
81
- /** @private */
82
- private updateChildrenActiveStatus;
83
- /**
84
- * Transform component added natively in the object
85
- */
86
- get transform(): Transform;
87
- /** RigidBody Component (if any) */
88
- get rigidBody(): RigidBody;
89
- /**
90
- * This method is called when the active state changes.
91
- */
92
- protected onActiveChange(): void;
93
- /**
94
- * @returns The current loaded scene
95
- */
96
- protected getCurrentScene<T extends Scene>(): T;
97
- /**
98
- * Add a component to the game obejct
99
- * @param componentClass The class of the component
100
- * @returns The added component
101
- */
102
- addComponent<ComponentType extends Component = Component>(componentClass: ComponentClass<ComponentType>): ComponentType;
103
- /**
104
- * Add a component to the game obejct
105
- * @param componentClass The class of the component
106
- * @param options The options passed to the init method of the component
107
- * @returns The added component
108
- */
109
- addComponent<ComponentType extends Component = Component, OptionsType extends InitOptions = InitOptions>(componentClass: ComponentClass<ComponentType>, options: OptionsType): ComponentType;
110
- /**
111
- * Add a component to the game obejct
112
- * @param componentClass The class of the component
113
- * @param name The name of the component
114
- * @returns The added component
115
- */
116
- addComponent<ComponentType extends Component = Component>(componentClass: ComponentClass<ComponentType>, name: string): ComponentType;
117
- /**
118
- * Add a component to the game obejct
119
- * @param componentClass The class of the component
120
- * @param options The options passed to the init method of the component
121
- * @param name The name of the component
122
- * @returns The added component
123
- */
124
- addComponent<ComponentType extends Component = Component, OptionsType extends InitOptions = InitOptions>(componentClass: ComponentClass<ComponentType>, options: OptionsType, name: string): ComponentType;
125
- /** @private */
126
- private checkMultipleComponent;
127
- /**
128
- * Returns all the components in the game object.
129
- * @returns The found components
130
- */
131
- getComponents(): Component[];
132
- /**
133
- * Returns all the components for the given class in the game object.
134
- * @param componentClass The class of the components
135
- * @returns The found components
136
- */
137
- getComponents<T extends Component>(componentClass: ComponentClass<T>): T[];
138
- /**
139
- * Returns the first component found for the given class, or undefined otherwise.
140
- * @param componentClass The class of the component
141
- * @returns The found component
142
- */
143
- getComponent<T extends Component>(componentClass: ComponentClass<T>): T;
144
- /**
145
- * Returns the first component found for the given name, or undefined otherwise.
146
- * @param name The name of the component
147
- * @returns The found component
148
- */
149
- getComponent<T extends Component>(name: string): T;
150
- /**
151
- * Returns TRUE if the game object has a component for the given class, or FALSE otherwise
152
- * @param componentClass The class of the component to find
153
- * @returns boolean
154
- */
155
- hasComponent<T extends Component>(componentClass: ComponentClass<T>): boolean;
156
- /**
157
- * @param name The name of the component to find
158
- * @returns boolean
159
- */
160
- hasComponent(name: string): boolean;
161
- removeComponent(component: Component): void;
162
- /**
163
- * Add a child game object.
164
- * @param gameObjectClass The class of the child game object
165
- * @param options [optional] This options will be passed to the init method
166
- * @param name [optional] The name of the game object
167
- * @returns The added child game object
168
- */
169
- addChild<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, name?: string): T;
170
- /**
171
- * @returns The children game objects
172
- */
173
- getChildren<T extends GameObject>(): T[];
174
- /**
175
- * Returns the first child found for the given class, or undefined otherwise.
176
- * @param gameObjectClass The class of the child game object to find
177
- * @returns The found child game object
178
- */
179
- getChild<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
180
- /**
181
- * Returns the first child found for the given name, or undefined otherwise.
182
- * @param name The name of the child game object to find
183
- * @returns The found child game object
184
- */
185
- getChild<T extends GameObject>(name: string): T;
186
- /**
187
- * Destroy all the children game objects
188
- */
189
- destroyChildren(): void;
190
- /** @private */
191
- protected _destroy(): void;
192
- /** @private */
193
- private destroyComponents;
194
- /** @private */
195
- protected _stopGame(): void;
196
- }
@@ -1,45 +0,0 @@
1
- import { GameCamera } from "../gameObject/GameCamera";
2
- import { Container } from "../utils/Container";
3
- import { Game } from "./Game";
4
- import { GameActor } from "./GameActor";
5
- /** @private */
6
- export type SceneClass = new (container: Container, name: string, game: Game) => Scene;
7
- /**
8
- * Base class for all game scenes
9
- * @public
10
- * @category Core
11
- * @example
12
- * ```js
13
- * class GameScene extends Scene {
14
- * init(options) {
15
- * this.addGameObject(Player);
16
- * }
17
- * start() {}
18
- * update() {}
19
- * }
20
- * ```
21
- * @example
22
- * ```ts
23
- * class GameScene extends Scene {
24
- * protected init(options?: InitOptions): void {
25
- * this.addGameObject(Player);
26
- * }
27
- * protected start(): void {}
28
- * protected update(): void {}
29
- * }
30
- * ```
31
- */
32
- export declare class Scene extends GameActor {
33
- readonly name: string;
34
- readonly game: Game;
35
- /** @private */
36
- constructor(container: Container, name: string, game: Game);
37
- /**
38
- * The main active camera
39
- */
40
- get gameCamera(): GameCamera;
41
- /** @private */
42
- protected _destroy(): void;
43
- /** @private */
44
- protected _stopGame(): void;
45
- }
@@ -1,51 +0,0 @@
1
- import { AssetManager } from "../managers/AssetManager";
2
- export declare class AssetManagerFacade {
3
- private static assetManager;
4
- static initialize(assetManager: AssetManager): void;
5
- /**
6
- * @returns TRUE if all the assets are loaded, FALSE instead
7
- */
8
- static getAssetsLoaded(): boolean;
9
- /**
10
- * @param url The url of the image
11
- * @param preloadTexture [optional] preload the texture for this image
12
- * @returns The created image element
13
- */
14
- static loadImage(url: string, preloadTexture?: boolean): HTMLImageElement;
15
- /**
16
- * @param url The url of the audio file
17
- * @returns The created audio element
18
- */
19
- static loadAudio(url: string): HTMLAudioElement;
20
- /**
21
- * @param family The family name of the font
22
- * @param url The url of the font
23
- * @returns The created fontFace element
24
- */
25
- static loadFont(family: string, url: string): FontFace;
26
- /**
27
- * @param url The url of the video file
28
- * @returns The created video element
29
- */
30
- static loadVideo(url: string): HTMLVideoElement;
31
- /**
32
- * @param url The url of the image element to find
33
- * @returns the found image element
34
- */
35
- static getImage(url: string): HTMLImageElement;
36
- /**
37
- * @param url The url of the audio element to find
38
- * @returns The found audio element
39
- */
40
- static getAudio(url: string): HTMLAudioElement;
41
- /**
42
- * @param family The family of the font
43
- * @returns The found audio element
44
- */
45
- static getFont(family: string): FontFace;
46
- /**
47
- * @param url The url of the video element to find
48
- * @returns The found video element
49
- */
50
- static getVideo(url: string): HTMLVideoElement;
51
- }
@@ -1,8 +0,0 @@
1
- import { DomManager } from "../managers/DomManager";
2
- export declare class DomManagerFacade {
3
- private static domManager;
4
- static initialize(domManager: DomManager): void;
5
- static get gameWidth(): number;
6
- static get gameHeight(): number;
7
- static get canvas(): HTMLCanvasElement;
8
- }
@@ -1,70 +0,0 @@
1
- import { GameObjectManager } from "../managers/GameObjectManager";
2
- import { GameObject, GameObjectClass } from "../GameObject";
3
- import { InitOptions } from "../GameActor";
4
- export declare class GameObjectManagerFacade {
5
- private static manager;
6
- static initialize(manager: GameObjectManager): void;
7
- /**
8
- * Adds a new game object to the scene.
9
- * @param gameObjectClass The class of the game object
10
- * @param options [optional] This options will be passed to the init method
11
- * @param parent [optional] The parent game object
12
- * @param name [optional] The name of the game object
13
- * @returns the added game object
14
- */
15
- static addGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>, options?: InitOptions, parent?: GameObject, name?: string): T;
16
- /**
17
- * Returns all the game objects in the scene.
18
- * @returns The found game objects
19
- */
20
- static findAllGameObjects(): GameObject[];
21
- /**
22
- * Returns a collection of game objects found for the given class
23
- * @param gameObjectClass The game object class to find
24
- * @returns The found game objects
25
- */
26
- static findGameObjects<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T[];
27
- /**
28
- * Returns the first game object found for the given class, or undefined otherwise.
29
- * @param gameObjectClass The game object class to find
30
- * @returns The found game object
31
- */
32
- static findGameObject<T extends GameObject>(gameObjectClass: GameObjectClass<T>): T;
33
- /**
34
- * Returns the first game object found for the given name, or undefined otherwise.
35
- * @param name The name of the game object to find
36
- * @returns The found game object
37
- */
38
- static findGameObject<T extends GameObject>(name: string): T;
39
- /**
40
- * Returns a collection of game objects found for the given parent
41
- * @param parent The parent game object
42
- * @returns The found game objects
43
- */
44
- static findGameObjectsByParent<T extends GameObject>(parent: GameObject): T[];
45
- /**
46
- * Returns the first child found for the given parent and class, or undefined otherwise.
47
- * @param parent The parent game object
48
- * @param gameObjectClass The class of the child game object to find
49
- * @returns The found child game object
50
- */
51
- static findGameObjectByParent<T extends GameObject>(parent: GameObject, gameObjectClass: GameObjectClass<T>): T;
52
- /**
53
- * Returns the first child found for the given parent and name, or undefined otherwise.
54
- * @param parent The parent game object
55
- * @param name The name of the child game object to find
56
- * @returns The found child game object
57
- */
58
- static findGameObjectByParent<T extends GameObject>(parent: GameObject, name: string): T;
59
- /**
60
- * Returns a collection of game objects found for the given tag
61
- * @param tag The tag of the game objects to find
62
- * @returns The found game objects
63
- */
64
- static findGameObjectsByTag<T extends GameObject>(tag: string): T[];
65
- /**
66
- * Destroy the game objects
67
- * @param gameObject The game object to destory
68
- */
69
- static destroyGameObject(gameObject: GameObject): void;
70
- }
@@ -1,13 +0,0 @@
1
- import { GamepadController } from "../../input/GamepadController";
2
- import { InputManager } from "../../input/InputManager";
3
- import { KeyboardController } from "../../input/KeyboardController";
4
- import { MouseController } from "../../input/MouseController";
5
- import { TouchController } from "../../input/TouchController";
6
- export declare class InputManagerFacade {
7
- private static inputManager;
8
- static initialize(inputManager: InputManager): void;
9
- static get mouse(): MouseController;
10
- static get keyboard(): KeyboardController;
11
- static get gamepad(): GamepadController;
12
- static get touch(): TouchController;
13
- }
@@ -1,18 +0,0 @@
1
- import { SceneManager } from "../managers/SceneManager";
2
- export declare class SceneManagerFacade {
3
- private static sceneManager;
4
- static initialize(sceneManager: SceneManager): void;
5
- /**
6
- * Unload the current scene and load the new scene
7
- * @param name The scene name to load
8
- */
9
- static loadScene(name: string): void;
10
- /**
11
- * @returns The name of the current scene
12
- */
13
- static getCurrentSceneName(): string;
14
- /**
15
- * Load the opening scene
16
- */
17
- static loadOpeningScene(): void;
18
- }
@@ -1,11 +0,0 @@
1
- import { TimeManager } from "../managers/TimeManager";
2
- export declare class TimeManagerFacade {
3
- private static timeManager;
4
- static initialize(timeManager: TimeManager): void;
5
- static get deltaTime(): number;
6
- static getTimeScale(): number;
7
- static setTimeScale(scale: number): void;
8
- static get unscaledDeltaTime(): number;
9
- static get physicsDeltaTime(): number;
10
- static get browserDeltaTime(): number;
11
- }
@@ -1,4 +0,0 @@
1
- import { GameConfig } from "../GameConfig";
2
- import { Container } from "../../utils/Container";
3
- /** @private */
4
- export declare const loadDependencies: (container: Container, gameConfig: GameConfig) => void;