angry-pixel 1.0.7 → 1.1.0
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/component/Animation.d.ts +12 -0
- package/lib/component/Animator.d.ts +18 -0
- package/lib/component/AudioPlayer.d.ts +24 -0
- package/lib/component/Camera.d.ts +30 -0
- package/lib/component/ComponentTypes.d.ts +15 -0
- package/lib/component/RigidBody.d.ts +22 -0
- package/lib/component/RigidBodyOld.d.ts +39 -0
- package/lib/component/Sprite.d.ts +31 -0
- package/lib/component/Transform.d.ts +32 -0
- package/lib/component/collider/BoxCollider.d.ts +34 -0
- package/lib/component/collider/Collider.d.ts +22 -0
- package/lib/component/collider/PolygonCollider.d.ts +32 -0
- package/lib/component/collider/TilemapCollider.d.ts +16 -0
- package/lib/component/colliderComponent/AbstractColliderComponent.d.ts +27 -0
- package/lib/component/colliderComponent/BoxCollider.d.ts +34 -0
- package/lib/component/colliderComponent/PolygonCollider.d.ts +32 -0
- package/lib/component/colliderComponent/TilemapCollider.d.ts +17 -0
- package/lib/component/colliderComponent/TriangleCollider.d.ts +32 -0
- package/lib/component/rendering/MaskRenderer.d.ts +29 -0
- package/lib/component/rendering/SpriteRenderer.d.ts +46 -0
- package/lib/component/rendering/TextRenderer.d.ts +49 -0
- package/lib/component/rendering/tilemap/CsvTilemapRenderer.d.ts +13 -0
- package/lib/component/rendering/tilemap/Tile.d.ts +7 -0
- package/lib/component/rendering/tilemap/TileData.d.ts +10 -0
- package/lib/component/rendering/tilemap/TiledTilemapRenderer.d.ts +43 -0
- package/lib/component/rendering/tilemap/TilemapRenderer.d.ts +72 -0
- package/lib/component/rendering/tilemap/Tileset.d.ts +25 -0
- package/lib/component/renderingComponent/MaskRenderer.d.ts +29 -0
- package/lib/component/renderingComponent/SpriteRenderer.d.ts +46 -0
- package/lib/component/renderingComponent/TextRenderer.d.ts +49 -0
- package/lib/component/renderingComponent/tilemap/CsvTilemapRenderer.d.ts +13 -0
- package/lib/component/renderingComponent/tilemap/Tile.d.ts +7 -0
- package/lib/component/renderingComponent/tilemap/TileData.d.ts +10 -0
- package/lib/component/renderingComponent/tilemap/TiledTilemapRenderer.d.ts +43 -0
- package/lib/component/renderingComponent/tilemap/TilemapRenderer.d.ts +72 -0
- package/lib/component/renderingComponent/tilemap/Tileset.d.ts +25 -0
- package/lib/core/Component.d.ts +130 -0
- package/lib/core/Game.d.ts +69 -0
- package/lib/core/GameObject.d.ts +151 -0
- package/lib/core/Scene.d.ts +69 -0
- package/lib/core/facades/AssetManagerFacade.d.ts +29 -0
- package/lib/core/facades/DomManagerFacade.d.ts +8 -0
- package/lib/core/facades/GameObjectManagerFacade.d.ts +54 -0
- package/lib/core/facades/InputManagerFacade.d.ts +13 -0
- package/lib/core/facades/SceneManagerFacade.d.ts +18 -0
- package/lib/core/facades/TimeManagerFacade.d.ts +10 -0
- package/lib/core/ioc/Config.d.ts +3 -0
- package/lib/core/managers/AssetManager.d.ts +16 -0
- package/lib/core/managers/DomManager.d.ts +9 -0
- package/lib/core/managers/GameObjectManager.d.ts +17 -0
- package/lib/core/managers/IterationManager.d.ts +42 -0
- package/lib/core/managers/SceneManager.d.ts +21 -0
- package/lib/core/managers/TimeManager.d.ts +20 -0
- package/lib/gameObject/GameCamera.d.ts +17 -0
- package/lib/gameObject/SpacePointer.d.ts +8 -0
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +39 -38
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/input/GamepadController.d.ts +48 -0
- package/lib/input/InputManager.d.ts +12 -0
- package/lib/input/KeyboardController.d.ts +12 -0
- package/lib/input/MouseController.d.ts +21 -0
- package/lib/input/TouchController.d.ts +13 -0
- package/lib/math/Rectangle.d.ts +50 -0
- package/lib/math/Rotation.d.ts +13 -0
- package/lib/math/Utils.d.ts +33 -0
- package/lib/math/Vector2.d.ts +114 -0
- package/lib/physics/PhysicsManager.d.ts +24 -0
- package/lib/physics/PhysicsManagerOld2.d.ts +34 -0
- package/lib/physics/collision/ColliderData.d.ts +15 -0
- package/lib/physics/collision/CollisionData.d.ts +8 -0
- package/lib/physics/collision/CollisionManager.d.ts +31 -0
- package/lib/physics/collision/CollisionManagerOld.d.ts +27 -0
- package/lib/physics/collision/QuadTree.d.ts +37 -0
- package/lib/physics/collision/collider/ICollider.d.ts +14 -0
- package/lib/physics/collision/collider/RectangleCollider.d.ts +32 -0
- package/lib/physics/collision/resolver/AABBResolver.d.ts +12 -0
- package/lib/physics/collision/resolver/CollisionResolution.d.ts +6 -0
- package/lib/physics/collision/resolver/CollisionResolver.d.ts +5 -0
- package/lib/physics/collision/resolver/ICollisionResolver.d.ts +5 -0
- package/lib/physics/collision/resolver/SatResolver.d.ts +15 -0
- package/lib/physics/collision/shape/Polygon.d.ts +31 -0
- package/lib/physics/collision/shape/Rectangle.d.ts +9 -0
- package/lib/physics/collision/shape/Shape.d.ts +17 -0
- package/lib/physics/collision-old/CollisionData.d.ts +8 -0
- package/lib/physics/collision-old/CollisionManager.d.ts +30 -0
- package/lib/physics/collision-old/QuadTree.d.ts +32 -0
- package/lib/physics/collision-old/collider/ICollider.d.ts +14 -0
- package/lib/physics/collision-old/collider/RectangleCollider.d.ts +32 -0
- package/lib/physics/collision-old/resolver/AABBResolver.d.ts +14 -0
- package/lib/physics/collision-old/resolver/ICollisionResolver.d.ts +5 -0
- package/lib/physics/collision-old/resolver/SatResolver.d.ts +14 -0
- package/lib/physics/collision-old/shape/Rectangle.d.ts +13 -0
- package/lib/physics/collision-old/shape/Shape.d.ts +28 -0
- package/lib/physics/rigodBody/RigidBodyData.d.ts +9 -0
- package/lib/physics/rigodBody/RigidBodyManager.d.ts +23 -0
- package/lib/rendering/CameraData.d.ts +9 -0
- package/lib/rendering/ContextRenderer.d.ts +6 -0
- package/lib/rendering/CullingService.d.ts +10 -0
- package/lib/rendering/FontAtlasFactory.d.ts +24 -0
- package/lib/rendering/RenderManager.d.ts +22 -0
- package/lib/rendering/context2D/Context2DRenderer.d.ts +18 -0
- package/lib/rendering/renderData/ColliderRenderData.d.ts +7 -0
- package/lib/rendering/renderData/GeometricRenderData.d.ts +12 -0
- package/lib/rendering/renderData/ImageRenderData.d.ts +22 -0
- package/lib/rendering/renderData/MaskRenderData.d.ts +9 -0
- package/lib/rendering/renderData/RenderData.d.ts +22 -0
- package/lib/rendering/renderData/TextRenderData.d.ts +22 -0
- package/lib/rendering/renderData/TilemapRenderData.d.ts +22 -0
- package/lib/rendering/webGL/ProgramFactory.d.ts +7 -0
- package/lib/rendering/webGL/ProgramManager.d.ts +26 -0
- package/lib/rendering/webGL/ShaderLoader.d.ts +3 -0
- package/lib/rendering/webGL/TextureFactory.d.ts +8 -0
- package/lib/rendering/webGL/TextureManager.d.ts +11 -0
- package/lib/rendering/webGL/Utils.d.ts +7 -0
- package/lib/rendering/webGL/WebGLRenderer.d.ts +36 -0
- package/lib/rendering/webGL/renderer/GeometricRenderer.d.ts +20 -0
- package/lib/rendering/webGL/renderer/ImageRenderer.d.ts +16 -0
- package/lib/rendering/webGL/renderer/MaskRenderer.d.ts +14 -0
- package/lib/rendering/webGL/renderer/TextRenderer.d.ts +21 -0
- package/lib/rendering/webGL/renderer/TilemapRenderer.d.ts +19 -0
- package/lib/rendering/webGL/shader/imageFragmentShader.d.ts +1 -0
- package/lib/rendering/webGL/shader/imageVertexShader.d.ts +1 -0
- package/lib/rendering/webGL/shader/legacy/imageFragmentShader.d.ts +1 -0
- package/lib/rendering/webGL/shader/legacy/imageVertexShader.d.ts +1 -0
- package/lib/utils/Container.d.ts +12 -0
- package/lib/utils/Exception.d.ts +4 -0
- package/lib/utils/UUID.d.ts +1 -0
- package/package.json +1 -1
- package/angry-pixel-v1.0.7.tgz +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Component } from "./Component";
|
|
2
|
+
import { Transform } from "../component/Transform";
|
|
3
|
+
import { RigidBody } from "../component/RigidBody";
|
|
4
|
+
import { GameObjectFactory } from "../core/managers/GameObjectManager";
|
|
5
|
+
import { Scene } from "./Scene";
|
|
6
|
+
import { FrameEvent } from "./managers/IterationManager";
|
|
7
|
+
export declare const LAYER_DEFAULT = "Default";
|
|
8
|
+
export declare type ComponentFactory = () => Component;
|
|
9
|
+
export declare class GameObject {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
tag: string;
|
|
13
|
+
layer: string;
|
|
14
|
+
ui: boolean;
|
|
15
|
+
keep: boolean;
|
|
16
|
+
private _active;
|
|
17
|
+
private _parent;
|
|
18
|
+
private started;
|
|
19
|
+
private sceneManager;
|
|
20
|
+
private gameObjectManager;
|
|
21
|
+
private components;
|
|
22
|
+
constructor();
|
|
23
|
+
get active(): boolean;
|
|
24
|
+
setActive(active: boolean): void;
|
|
25
|
+
get transform(): Transform;
|
|
26
|
+
get rigidBody(): RigidBody;
|
|
27
|
+
get parent(): GameObject | null;
|
|
28
|
+
set parent(parent: GameObject | null);
|
|
29
|
+
dispatch(event: FrameEvent): void;
|
|
30
|
+
/**
|
|
31
|
+
* This method is called only once.
|
|
32
|
+
* Recommended for GameObject cration.
|
|
33
|
+
*/
|
|
34
|
+
protected init(): void;
|
|
35
|
+
/**
|
|
36
|
+
* This method is called only once.
|
|
37
|
+
*/
|
|
38
|
+
protected start(): void;
|
|
39
|
+
/**
|
|
40
|
+
* This method is called on every frame.
|
|
41
|
+
*/
|
|
42
|
+
protected update(): void;
|
|
43
|
+
/**
|
|
44
|
+
* This method is called before the object is destroyed.
|
|
45
|
+
*/
|
|
46
|
+
protected destroy(): void;
|
|
47
|
+
/**
|
|
48
|
+
* @returns The current loaded scene
|
|
49
|
+
*/
|
|
50
|
+
protected getCurrentScene<T extends Scene>(): T;
|
|
51
|
+
/**
|
|
52
|
+
* @param gameObjectFactory The factory function for the game object
|
|
53
|
+
* @param name The name of the game object, this must not be used by another game object
|
|
54
|
+
* @returns The added game object
|
|
55
|
+
*/
|
|
56
|
+
protected addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
|
|
57
|
+
/**
|
|
58
|
+
* @param name The name of the game object to find
|
|
59
|
+
* @returns The found game object
|
|
60
|
+
*/
|
|
61
|
+
protected findGameObjectByName<T extends GameObject>(name: string): T;
|
|
62
|
+
/**
|
|
63
|
+
* @param tag The tag of the game objects to find
|
|
64
|
+
* @returns The found game objects
|
|
65
|
+
*/
|
|
66
|
+
protected findGameObjectsByTag(tag: string): GameObject[];
|
|
67
|
+
/**
|
|
68
|
+
* @param tag The tag of the game object to find
|
|
69
|
+
* @returns The found game object
|
|
70
|
+
*/
|
|
71
|
+
protected findGameObjectByTag<T extends GameObject>(tag: string): T;
|
|
72
|
+
/**
|
|
73
|
+
* Add a components to the game obejct
|
|
74
|
+
*
|
|
75
|
+
* @param componentFactory The factory function for the component
|
|
76
|
+
* @param name (optional) The name of the component, this must not be used by another component
|
|
77
|
+
* @returns The added component
|
|
78
|
+
*/
|
|
79
|
+
addComponent<T extends Component>(componentFactory: ComponentFactory, name?: string | null): T;
|
|
80
|
+
private checkMultipleComponent;
|
|
81
|
+
/**
|
|
82
|
+
* @returns All the added components
|
|
83
|
+
*/
|
|
84
|
+
getComponents(): Component[];
|
|
85
|
+
/**
|
|
86
|
+
* @param name The name of the component to find
|
|
87
|
+
* @returns The found component
|
|
88
|
+
*/
|
|
89
|
+
getComponentByName<T extends Component>(name: string): T;
|
|
90
|
+
/**
|
|
91
|
+
* @param type The type of the component to find
|
|
92
|
+
* @returns The found component
|
|
93
|
+
*/
|
|
94
|
+
getComponentByType<T extends Component>(type: string): T;
|
|
95
|
+
/**
|
|
96
|
+
* @param type The type of the components to find
|
|
97
|
+
* @returns The found components
|
|
98
|
+
*/
|
|
99
|
+
getComponentsByType<T extends Component>(type: string): T[];
|
|
100
|
+
/**
|
|
101
|
+
* @param name The name of the component to find
|
|
102
|
+
* @returns TRUE or FALSE
|
|
103
|
+
*/
|
|
104
|
+
hasComponentOfName(name: string): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @param type The type of the component to find
|
|
107
|
+
* @returns TRUE or FALSE
|
|
108
|
+
*/
|
|
109
|
+
hasComponentOfType(type: string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* @param name The name of the component to remove
|
|
112
|
+
*/
|
|
113
|
+
removeComponentByName(name: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* @param type The tyepe of the component to remove
|
|
116
|
+
*/
|
|
117
|
+
removeComponentByType(type: string): void;
|
|
118
|
+
/**
|
|
119
|
+
* Add a child game object.
|
|
120
|
+
*
|
|
121
|
+
* @param gameObjectFactory The factory of the child game object
|
|
122
|
+
* @param name The name of the child game object, this must not be used by another game object
|
|
123
|
+
* @returns The added child game object
|
|
124
|
+
*/
|
|
125
|
+
addChild<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
|
|
126
|
+
/**
|
|
127
|
+
* @returns The children game objects
|
|
128
|
+
*/
|
|
129
|
+
getChildren(): GameObject[];
|
|
130
|
+
/**
|
|
131
|
+
* @param name The name of the child game object to find
|
|
132
|
+
* @returns The found child game object
|
|
133
|
+
*/
|
|
134
|
+
getChild<T extends GameObject>(name: string): T;
|
|
135
|
+
/**
|
|
136
|
+
* Destroy all the children game objects
|
|
137
|
+
*/
|
|
138
|
+
destroyChildren(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Destroy one game objects by its name
|
|
141
|
+
* @param name The name of the game object
|
|
142
|
+
*/
|
|
143
|
+
destroyGameObjectByName(name: string): void;
|
|
144
|
+
/**
|
|
145
|
+
* Destroy the game objects
|
|
146
|
+
* @param gameObject The game object to destory
|
|
147
|
+
*/
|
|
148
|
+
destroyGameObject(gameObject: GameObject): void;
|
|
149
|
+
private _destroy;
|
|
150
|
+
private destroyComponents;
|
|
151
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { GameCamera } from "../gameObject/GameCamera";
|
|
2
|
+
import { Game } from "./Game";
|
|
3
|
+
import { GameObject } from "./GameObject";
|
|
4
|
+
import { GameObjectFactory } from "../core/managers/GameObjectManager";
|
|
5
|
+
import { FrameEvent } from "./managers/IterationManager";
|
|
6
|
+
export declare const GAME_CAMERA_ID = "GameCamera";
|
|
7
|
+
export declare class Scene {
|
|
8
|
+
private readonly gameObjectManager;
|
|
9
|
+
game: Game;
|
|
10
|
+
name: string;
|
|
11
|
+
private started;
|
|
12
|
+
constructor();
|
|
13
|
+
get gameCamera(): GameCamera;
|
|
14
|
+
dispatch(event: FrameEvent): void;
|
|
15
|
+
/**
|
|
16
|
+
* This method is called only once.
|
|
17
|
+
* Recommended for GameObject cration.
|
|
18
|
+
*/
|
|
19
|
+
protected init(): void;
|
|
20
|
+
/**
|
|
21
|
+
* This method is called only once.
|
|
22
|
+
*/
|
|
23
|
+
protected start(): void;
|
|
24
|
+
/**
|
|
25
|
+
* This method is called on every frame.
|
|
26
|
+
*/
|
|
27
|
+
protected update(): void;
|
|
28
|
+
/**
|
|
29
|
+
* This method is called before the scene is destroyed.
|
|
30
|
+
*/
|
|
31
|
+
protected destroy(): void;
|
|
32
|
+
/**
|
|
33
|
+
* @param gameObjectFactory The factory function for the game object
|
|
34
|
+
* @param name The name of the game object, this must not be used by another game object
|
|
35
|
+
* @returns The added game object
|
|
36
|
+
*/
|
|
37
|
+
protected addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
|
|
38
|
+
/**
|
|
39
|
+
* @returns The all the loaded game objects
|
|
40
|
+
*/
|
|
41
|
+
protected getGameObjects(): GameObject[];
|
|
42
|
+
/**
|
|
43
|
+
* @param name The name of the game object to find
|
|
44
|
+
* @returns The found game object
|
|
45
|
+
*/
|
|
46
|
+
protected findGameObjectByName<T extends GameObject>(name: string): T;
|
|
47
|
+
/**
|
|
48
|
+
* @param tag The tag of the game objects to find
|
|
49
|
+
* @returns The found game objects
|
|
50
|
+
*/
|
|
51
|
+
protected findGameObjectsByTag(tag: string): GameObject[];
|
|
52
|
+
/**
|
|
53
|
+
* @param tag The tag of the game object to find
|
|
54
|
+
* @returns The found game object
|
|
55
|
+
*/
|
|
56
|
+
protected findGameObjectByTag<T extends GameObject>(tag: string): T;
|
|
57
|
+
/**
|
|
58
|
+
* Destroy one game objects by its name
|
|
59
|
+
* @param name The name of the game object
|
|
60
|
+
*/
|
|
61
|
+
protected destroyGameObjectByName(name: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Destroy the game objects
|
|
64
|
+
*
|
|
65
|
+
* @param gameObject The game object to destory
|
|
66
|
+
*/
|
|
67
|
+
protected destroyGameObject(gameObject: GameObject): void;
|
|
68
|
+
private _destroy;
|
|
69
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
* @returns The created image element
|
|
12
|
+
*/
|
|
13
|
+
static loadImage(url: string): HTMLImageElement;
|
|
14
|
+
/**
|
|
15
|
+
* @param url The url of the audio file
|
|
16
|
+
* @returns The created audio element
|
|
17
|
+
*/
|
|
18
|
+
static loadAudio(url: string): HTMLAudioElement;
|
|
19
|
+
/**
|
|
20
|
+
* @param url The url of the image element to find
|
|
21
|
+
* @returns the found image element
|
|
22
|
+
*/
|
|
23
|
+
static getImage(url: string): HTMLImageElement;
|
|
24
|
+
/**
|
|
25
|
+
* @param url The url of the audio element to find
|
|
26
|
+
* @returns The found audio element
|
|
27
|
+
*/
|
|
28
|
+
static getAudio(url: string): HTMLAudioElement;
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { GameObjectManager, GameObjectFactory } from "../managers/GameObjectManager";
|
|
2
|
+
import { GameObject } from "../GameObject";
|
|
3
|
+
export declare class GameObjectManagerFacade {
|
|
4
|
+
private static manager;
|
|
5
|
+
static initialize(manager: GameObjectManager): void;
|
|
6
|
+
/**
|
|
7
|
+
* @param gameObjectFactory The factory function for the game object
|
|
8
|
+
* @param name The name of the game object, this must not be used by another game object
|
|
9
|
+
* @param parent (optional) The parent game object
|
|
10
|
+
* @returns the added game object
|
|
11
|
+
*/
|
|
12
|
+
static addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string, parent?: GameObject): T;
|
|
13
|
+
/**
|
|
14
|
+
* @returns All the added game objects
|
|
15
|
+
*/
|
|
16
|
+
static getGameObjects(): GameObject[];
|
|
17
|
+
/**
|
|
18
|
+
* @param name The name of the game object to find
|
|
19
|
+
* @returns The found game object
|
|
20
|
+
*/
|
|
21
|
+
static findGameObjectByName<T extends GameObject>(name: string): T;
|
|
22
|
+
/**
|
|
23
|
+
* @param parent The parent game object
|
|
24
|
+
* @returns The found game objects
|
|
25
|
+
*/
|
|
26
|
+
static findGameObjectsByParent(parent: GameObject): GameObject[];
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param parent The parent game object
|
|
30
|
+
* @param name The name of the game object to find
|
|
31
|
+
* @returns The found game objects
|
|
32
|
+
*/
|
|
33
|
+
static findGameObjectByParentAndName<T extends GameObject>(parent: GameObject, name: string): T;
|
|
34
|
+
/**
|
|
35
|
+
* @param tag The tag of the game objects to find
|
|
36
|
+
* @returns The found game objects
|
|
37
|
+
*/
|
|
38
|
+
static findGameObjectsByTag(tag: string): GameObject[];
|
|
39
|
+
/**
|
|
40
|
+
* @param tag The tag of the game object to find
|
|
41
|
+
* @returns The found game object
|
|
42
|
+
*/
|
|
43
|
+
static findGameObjectByTag<T extends GameObject>(tag: string): T;
|
|
44
|
+
/**
|
|
45
|
+
* Destroy the game objects
|
|
46
|
+
* @param gameObject The game object to destory
|
|
47
|
+
*/
|
|
48
|
+
static destroyGameObject(gameObject: GameObject): void;
|
|
49
|
+
/**
|
|
50
|
+
* Destroy one game objects by its name
|
|
51
|
+
* @param name The name of the game object
|
|
52
|
+
*/
|
|
53
|
+
static destroyGameObjectByName(name: string): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum AssetType {
|
|
2
|
+
Image = "Image",
|
|
3
|
+
Audio = "Audio",
|
|
4
|
+
Video = "Video"
|
|
5
|
+
}
|
|
6
|
+
export declare class AssetManager {
|
|
7
|
+
private assets;
|
|
8
|
+
getAssetsLoaded(): boolean;
|
|
9
|
+
laadImage(url: string): HTMLImageElement;
|
|
10
|
+
loadAudio(url: string): HTMLAudioElement;
|
|
11
|
+
getImage(url: string): HTMLImageElement;
|
|
12
|
+
getVideo(url: string): HTMLVideoElement;
|
|
13
|
+
getAudio(url: string): HTMLAudioElement;
|
|
14
|
+
getAsset<EType extends HTMLImageElement | HTMLVideoElement | HTMLAudioElement>(url: string, type?: AssetType | null): EType;
|
|
15
|
+
private createAsset;
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class DomManager {
|
|
2
|
+
private gameWidth;
|
|
3
|
+
private gameHeight;
|
|
4
|
+
private containerNode;
|
|
5
|
+
private _canvas;
|
|
6
|
+
constructor(containerNode: HTMLElement, gameWidth: number, gameHeight: number);
|
|
7
|
+
get canvas(): HTMLCanvasElement;
|
|
8
|
+
private setupCanvas;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GameObject } from "../GameObject";
|
|
2
|
+
export declare type GameObjectFactory = () => GameObject;
|
|
3
|
+
export declare class GameObjectManager {
|
|
4
|
+
private gameObjects;
|
|
5
|
+
addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string, parent?: GameObject): T;
|
|
6
|
+
getGameObjects(): GameObject[];
|
|
7
|
+
findGameObjectById(id: string): GameObject;
|
|
8
|
+
findGameObjectByName(name: string): GameObject;
|
|
9
|
+
findGameObjectsByParent(parent: GameObject): GameObject[];
|
|
10
|
+
findGameObjectByParentAndName(parent: GameObject, name: string): GameObject;
|
|
11
|
+
findGameObjectsByTag(tag: string): GameObject[];
|
|
12
|
+
findGameObjectByTag(tag: string): GameObject;
|
|
13
|
+
destroyAllGameObjects(): void;
|
|
14
|
+
destroyGameObject(gameObject: GameObject): void;
|
|
15
|
+
private destroy;
|
|
16
|
+
private destroyChildren;
|
|
17
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GameObjectManager } from "./GameObjectManager";
|
|
2
|
+
import { SceneManager } from "./SceneManager";
|
|
3
|
+
import { InputManager } from "../../input/InputManager";
|
|
4
|
+
import { CollisionManager } from "../../physics/collision/CollisionManager";
|
|
5
|
+
import { RigidBodyManager } from "../../physics/rigodBody/RigidBodyManager";
|
|
6
|
+
import { RenderManager } from "../../rendering/RenderManager";
|
|
7
|
+
import { TimeManager } from "./TimeManager";
|
|
8
|
+
export declare enum FrameEvent {
|
|
9
|
+
Init = 0,
|
|
10
|
+
Start = 1,
|
|
11
|
+
Update = 2,
|
|
12
|
+
UpdateEngine = 3,
|
|
13
|
+
UpdateCollider = 4,
|
|
14
|
+
UpdatePhysics = 5,
|
|
15
|
+
UpdateTransform = 6,
|
|
16
|
+
UpdatePreRender = 7,
|
|
17
|
+
UpdateCamera = 8,
|
|
18
|
+
UpdateRender = 9,
|
|
19
|
+
Destroy = 10
|
|
20
|
+
}
|
|
21
|
+
export declare class IterationManager {
|
|
22
|
+
private readonly timeManager;
|
|
23
|
+
private readonly collisionManager;
|
|
24
|
+
private readonly physicsManager;
|
|
25
|
+
private readonly renderManager;
|
|
26
|
+
private readonly inputManager;
|
|
27
|
+
private readonly gameObjectManager;
|
|
28
|
+
private readonly sceneManager;
|
|
29
|
+
private gameLoopAccumulator;
|
|
30
|
+
private physicsLoopAccumulator;
|
|
31
|
+
private currentScene;
|
|
32
|
+
private gameObjects;
|
|
33
|
+
private components;
|
|
34
|
+
constructor(timeManager: TimeManager, collisionManager: CollisionManager, physicsManager: RigidBodyManager, renderManager: RenderManager, inputManager: InputManager, gameObjectManager: GameObjectManager, sceneManager: SceneManager);
|
|
35
|
+
update(time: number): void;
|
|
36
|
+
private load;
|
|
37
|
+
private mainIteration;
|
|
38
|
+
private physicsIteration;
|
|
39
|
+
private preRenderIteration;
|
|
40
|
+
private renderIteration;
|
|
41
|
+
private dispatchFrameEvent;
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Game } from "../Game";
|
|
2
|
+
import { Scene } from "../Scene";
|
|
3
|
+
import { RenderManager } from "../../rendering/RenderManager";
|
|
4
|
+
export declare type SceneConstructor = () => Scene;
|
|
5
|
+
export declare class SceneManager {
|
|
6
|
+
private game;
|
|
7
|
+
private renderManager;
|
|
8
|
+
private scenes;
|
|
9
|
+
private currentScene;
|
|
10
|
+
private openingSceneName;
|
|
11
|
+
private sceneToLoad;
|
|
12
|
+
currentSceneName: string;
|
|
13
|
+
constructor(game: Game, renderManager: RenderManager);
|
|
14
|
+
getCurrentScene<T extends Scene>(): T;
|
|
15
|
+
addScene(name: string, sceneConstructor: SceneConstructor, openingScene?: boolean): void;
|
|
16
|
+
loadOpeningScene(): void;
|
|
17
|
+
loadScene(name: string): void;
|
|
18
|
+
update(): void;
|
|
19
|
+
private _loadScene;
|
|
20
|
+
unloadCurrentScene(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const MIN_BROWSER_FRAMERATE = 15;
|
|
2
|
+
export declare const DEFAULT_GAME_FRAMERATE = 60;
|
|
3
|
+
export declare const MIN_PHYSICS_FRAMERATE = 60;
|
|
4
|
+
export declare const DEFAULT_PHYSICS_FRAMERATE = 240;
|
|
5
|
+
export declare class TimeManager {
|
|
6
|
+
readonly minGameDeltatime: number;
|
|
7
|
+
readonly minPhysicsDeltaTime: number;
|
|
8
|
+
readonly gameFramerate: number;
|
|
9
|
+
readonly physicsFramerate: number;
|
|
10
|
+
timeScale: number;
|
|
11
|
+
browserDeltaTime: number;
|
|
12
|
+
unscaledGameDeltaTime: number;
|
|
13
|
+
unscaledPhysicsDeltaTime: number;
|
|
14
|
+
private readonly max;
|
|
15
|
+
private then;
|
|
16
|
+
constructor(physicsFramerate: number);
|
|
17
|
+
update(time: number): void;
|
|
18
|
+
get deltaTime(): number;
|
|
19
|
+
get physicsDeltaTime(): number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GameObject } from "../core/GameObject";
|
|
2
|
+
import { Camera } from "../component/Camera";
|
|
3
|
+
import { Rectangle } from "../math/Rectangle";
|
|
4
|
+
export declare class GameCamera extends GameObject {
|
|
5
|
+
readonly camera: Camera;
|
|
6
|
+
constructor();
|
|
7
|
+
set layers(layers: string[]);
|
|
8
|
+
get layers(): string[];
|
|
9
|
+
set depth(depth: number);
|
|
10
|
+
get depth(): number;
|
|
11
|
+
set zoom(zoom: number);
|
|
12
|
+
get zoom(): number;
|
|
13
|
+
get originalViewporRect(): Rectangle;
|
|
14
|
+
get worldSpaceRect(): Rectangle;
|
|
15
|
+
get viewportRect(): Rectangle;
|
|
16
|
+
addLayer(layer: string): void;
|
|
17
|
+
}
|