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.
- package/lib/index.cjs.js +2 -1
- package/lib/index.cjs.js.map +1 -0
- package/lib/index.d.ts +5 -41
- package/lib/index.esm.js +2 -1
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -0
- package/package.json +6 -30
- package/.github/workflows/analyzeCode.yml +0 -25
- package/.github/workflows/buildCode.yml +0 -23
- package/.github/workflows/main.yml +0 -15
- package/.github/workflows/setupNode.yml +0 -40
- package/api-docs/.nojekyll +0 -1
- package/api-docs/assets/highlight.css +0 -92
- package/api-docs/assets/main.js +0 -59
- package/api-docs/assets/navigation.js +0 -1
- package/api-docs/assets/search.js +0 -1
- package/api-docs/assets/style.css +0 -1383
- package/api-docs/classes/Animator.html +0 -128
- package/api-docs/classes/AudioPlayer.html +0 -131
- package/api-docs/classes/BallCollider.html +0 -132
- package/api-docs/classes/BoxCollider.html +0 -136
- package/api-docs/classes/Button.html +0 -125
- package/api-docs/classes/Camera.html +0 -114
- package/api-docs/classes/Component.html +0 -106
- package/api-docs/classes/EdgeCollider.html +0 -134
- package/api-docs/classes/Game.html +0 -24
- package/api-docs/classes/GameCamera.html +0 -163
- package/api-docs/classes/GameObject.html +0 -149
- package/api-docs/classes/GamepadController.html +0 -11
- package/api-docs/classes/GamepadData.html +0 -81
- package/api-docs/classes/KeyboardController.html +0 -43
- package/api-docs/classes/MaskRenderer.html +0 -119
- package/api-docs/classes/MouseController.html +0 -14
- package/api-docs/classes/PhysicsComponent.html +0 -107
- package/api-docs/classes/PolygonCollider.html +0 -134
- package/api-docs/classes/PreRenderComponent.html +0 -107
- package/api-docs/classes/Rectangle.html +0 -30
- package/api-docs/classes/RigidBody.html +0 -123
- package/api-docs/classes/Rotation.html +0 -5
- package/api-docs/classes/Scene.html +0 -73
- package/api-docs/classes/SpacePointer.html +0 -147
- package/api-docs/classes/Sprite.html +0 -20
- package/api-docs/classes/SpriteRenderer.html +0 -134
- package/api-docs/classes/TextRenderer.html +0 -138
- package/api-docs/classes/TiledTilemapRenderer.html +0 -127
- package/api-docs/classes/TilemapCollider.html +0 -124
- package/api-docs/classes/TilemapRenderer.html +0 -126
- package/api-docs/classes/TouchController.html +0 -8
- package/api-docs/classes/Transform.html +0 -124
- package/api-docs/classes/Vector2.html +0 -65
- package/api-docs/classes/VideoRenderer.html +0 -145
- package/api-docs/enums/BroadPhaseMethods.html +0 -3
- package/api-docs/enums/ButtonType.html +0 -3
- package/api-docs/enums/CollisionMethods.html +0 -3
- package/api-docs/enums/RigidBodyType.html +0 -4
- package/api-docs/enums/TextOrientation.html +0 -5
- package/api-docs/enums/TilemapOrientation.html +0 -5
- package/api-docs/functions/between.html +0 -5
- package/api-docs/functions/clamp.html +0 -5
- package/api-docs/functions/fixedRound.html +0 -4
- package/api-docs/functions/randomFloat.html +0 -4
- package/api-docs/functions/randomInt.html +0 -4
- package/api-docs/functions/range.html +0 -5
- package/api-docs/index.html +0 -37
- package/api-docs/interfaces/AnimationConfig.html +0 -10
- package/api-docs/interfaces/AnimatorOptions.html +0 -6
- package/api-docs/interfaces/AudioPlayerOptions.html +0 -8
- package/api-docs/interfaces/BallColliderOptions.html +0 -16
- package/api-docs/interfaces/BoxColliderOptions.html +0 -20
- package/api-docs/interfaces/ButtonOptions.html +0 -16
- package/api-docs/interfaces/ColliderComponent.html +0 -14
- package/api-docs/interfaces/CollisionData.html +0 -10
- package/api-docs/interfaces/EdgeColliderOptions.html +0 -18
- package/api-docs/interfaces/GameConfig.html +0 -28
- package/api-docs/interfaces/IAssetManager.html +0 -40
- package/api-docs/interfaces/ICollider.html +0 -11
- package/api-docs/interfaces/ICollision.html +0 -4
- package/api-docs/interfaces/ICollisionResolution.html +0 -4
- package/api-docs/interfaces/IDomManager.html +0 -6
- package/api-docs/interfaces/IGameObjectManager.html +0 -49
- package/api-docs/interfaces/IInputManager.html +0 -12
- package/api-docs/interfaces/IPhysicsManager.html +0 -8
- package/api-docs/interfaces/IRenderManager.html +0 -7
- package/api-docs/interfaces/ISceneManager.html +0 -18
- package/api-docs/interfaces/ITimeManager.html +0 -16
- package/api-docs/interfaces/MaskRendererOptions.html +0 -18
- package/api-docs/interfaces/PolygonColliderOptions.html +0 -18
- package/api-docs/interfaces/RigidBodyOptions.html +0 -17
- package/api-docs/interfaces/Slice.html +0 -5
- package/api-docs/interfaces/SpriteConfig.html +0 -10
- package/api-docs/interfaces/SpriteRendererOptions.html +0 -32
- package/api-docs/interfaces/TextRendererOptions.html +0 -38
- package/api-docs/interfaces/TiledChunk.html +0 -7
- package/api-docs/interfaces/TiledLayer.html +0 -17
- package/api-docs/interfaces/TiledTilemap.html +0 -9
- package/api-docs/interfaces/TiledTilemapRendererOptions.html +0 -18
- package/api-docs/interfaces/TilemapColliderOptions.html +0 -12
- package/api-docs/interfaces/TilemapRendererOptions.html +0 -22
- package/api-docs/interfaces/Tileset.html +0 -13
- package/api-docs/interfaces/TouchInteraction.html +0 -6
- package/api-docs/interfaces/VideoRendererOptions.html +0 -34
- package/api-docs/modules.html +0 -85
- package/api-docs/types/CollisionMatrix.html +0 -1
- package/lib/component/Animation.d.ts +0 -12
- package/lib/component/Animator.d.ts +0 -139
- package/lib/component/AudioPlayer.d.ts +0 -97
- package/lib/component/Button.d.ts +0 -117
- package/lib/component/Camera.d.ts +0 -47
- package/lib/component/RigidBody.d.ts +0 -97
- package/lib/component/Sprite.d.ts +0 -22
- package/lib/component/Transform.d.ts +0 -65
- package/lib/component/collider/BallCollider.d.ts +0 -73
- package/lib/component/collider/BoxCollider.d.ts +0 -90
- package/lib/component/collider/Collider.d.ts +0 -82
- package/lib/component/collider/EdgeCollider.d.ts +0 -81
- package/lib/component/collider/PolygonCollider.d.ts +0 -92
- package/lib/component/collider/TilemapCollider.d.ts +0 -71
- package/lib/component/rendering/MaskRenderer.d.ts +0 -83
- package/lib/component/rendering/Sprite.d.ts +0 -61
- package/lib/component/rendering/SpriteRenderer.d.ts +0 -133
- package/lib/component/rendering/TextRenderer.d.ts +0 -145
- package/lib/component/rendering/TiledTilemapRenderer.d.ts +0 -186
- package/lib/component/rendering/TilemapRenderer.d.ts +0 -170
- package/lib/component/rendering/VideoRenderer.d.ts +0 -158
- package/lib/core/Component.d.ts +0 -203
- package/lib/core/Game.d.ts +0 -112
- package/lib/core/GameActor.d.ts +0 -131
- package/lib/core/GameConfig.d.ts +0 -61
- package/lib/core/GameObject.d.ts +0 -196
- package/lib/core/Scene.d.ts +0 -45
- package/lib/core/facades/AssetManagerFacade.d.ts +0 -51
- package/lib/core/facades/DomManagerFacade.d.ts +0 -8
- package/lib/core/facades/GameObjectManagerFacade.d.ts +0 -70
- package/lib/core/facades/InputManagerFacade.d.ts +0 -13
- package/lib/core/facades/SceneManagerFacade.d.ts +0 -18
- package/lib/core/facades/TimeManagerFacade.d.ts +0 -11
- package/lib/core/ioc/Config.d.ts +0 -4
- package/lib/core/managers/AssetManager.d.ts +0 -95
- package/lib/core/managers/DomManager.d.ts +0 -23
- package/lib/core/managers/GameObjectManager.d.ts +0 -118
- package/lib/core/managers/HeadlessIterationManager.d.ts +0 -33
- package/lib/core/managers/IterationManager.d.ts +0 -63
- package/lib/core/managers/SceneManager.d.ts +0 -93
- package/lib/core/managers/TimeManager.d.ts +0 -73
- package/lib/gameObject/GameCamera.d.ts +0 -38
- package/lib/gameObject/SpacePointer.d.ts +0 -15
- package/lib/input/GamepadController.d.ts +0 -225
- package/lib/input/InputManager.d.ts +0 -37
- package/lib/input/KeyboardController.d.ts +0 -81
- package/lib/input/MouseController.d.ts +0 -56
- package/lib/input/TouchController.d.ts +0 -45
- package/lib/utils/Container.d.ts +0 -13
- package/lib/utils/Exception.d.ts +0 -5
- package/lib/utils/UUID.d.ts +0 -1
- package/typedoc.json +0 -13
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { TilemapOrientation } from "angry-pixel-2d-renderer";
|
|
2
|
-
import { Vector2 } from "angry-pixel-math";
|
|
3
|
-
import { RenderComponent } from "../../core/Component";
|
|
4
|
-
export { TilemapOrientation };
|
|
5
|
-
/**
|
|
6
|
-
* Tileset configuration to be used with the TilemapRenderer
|
|
7
|
-
* @public
|
|
8
|
-
* @category Components
|
|
9
|
-
* @example
|
|
10
|
-
* ```js
|
|
11
|
-
* const tileset = {
|
|
12
|
-
* image: this.assetManager.getImage("image.png"),
|
|
13
|
-
* width: 3,
|
|
14
|
-
* tileWidth: 16,
|
|
15
|
-
* tileHeight: 16,
|
|
16
|
-
* margin: new Vector2(0, 0),
|
|
17
|
-
* spacing: new Vector2(0, 0),
|
|
18
|
-
* };
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export interface Tileset {
|
|
22
|
-
/** The tileset image element */
|
|
23
|
-
image: HTMLImageElement;
|
|
24
|
-
width: number;
|
|
25
|
-
tileWidth: number;
|
|
26
|
-
tileHeight: number;
|
|
27
|
-
/** Margin of the tile in pixels (space in the top and the left) */
|
|
28
|
-
margin?: Vector2;
|
|
29
|
-
/** Spacing of the tile in pixels (space in the bottom and the right) */
|
|
30
|
-
spacing?: Vector2;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* TilemapRenderer configuration options
|
|
34
|
-
* @public
|
|
35
|
-
* @category Components
|
|
36
|
-
* @example
|
|
37
|
-
* ```js
|
|
38
|
-
* this.addComponent(TilemapRenderer, {
|
|
39
|
-
* tileset: {
|
|
40
|
-
* image: this.assetManager.getImage("image.png"),
|
|
41
|
-
* width: 3,
|
|
42
|
-
* tileWidth: 16,
|
|
43
|
-
* tileHeight: 16,
|
|
44
|
-
* margin: new Vector2(0, 0),
|
|
45
|
-
* spacing: new Vector2(0, 0),
|
|
46
|
-
* }
|
|
47
|
-
* tiles: [1, 2, 0, 0, 0, 0, 2, 1, 3, 4, 5, 5, 5, 5, 4, 3],
|
|
48
|
-
* width: 8,
|
|
49
|
-
* tileWidth: 16,
|
|
50
|
-
* tileHeight: 16,
|
|
51
|
-
* layer: "Tilemap",
|
|
52
|
-
* orientation: TilemapOrientation.Center,
|
|
53
|
-
* smooth: false,
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export interface TilemapRendererOptions {
|
|
58
|
-
/** Id of tiles separated by commas. The ids start at 1, and increment from left to right,
|
|
59
|
-
* from top to bottom. ID 0 (zero) represents a space with no tile. */
|
|
60
|
-
tiles: string;
|
|
61
|
-
/** The Tileset instance */
|
|
62
|
-
tileset: Tileset;
|
|
63
|
-
width: number;
|
|
64
|
-
tileWidth?: number;
|
|
65
|
-
tileHeight?: number;
|
|
66
|
-
/** The render layer */
|
|
67
|
-
layer?: string;
|
|
68
|
-
/** Direction in which the tilemap will be rendered. */
|
|
69
|
-
orientation?: TilemapOrientation;
|
|
70
|
-
/** Change the opacity between 1 and 0 */
|
|
71
|
-
opacity?: number;
|
|
72
|
-
/** Define a color for tinting the tiles */
|
|
73
|
-
tintColor?: string;
|
|
74
|
-
/** Smoothing pixels (not recommended for pixel art) */
|
|
75
|
-
smooth?: boolean;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* @private
|
|
79
|
-
*/
|
|
80
|
-
export interface ITilemapRenderer {
|
|
81
|
-
tiles: number[];
|
|
82
|
-
width: number;
|
|
83
|
-
height: number;
|
|
84
|
-
tileWidth: number;
|
|
85
|
-
tileHeight: number;
|
|
86
|
-
orientation: TilemapOrientation;
|
|
87
|
-
realWidth: number;
|
|
88
|
-
realHeight: number;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* The TilemapRenderer component allows you to render a tile map defined by an array of tile ids, using an instance of the TileSet object.
|
|
92
|
-
* @public
|
|
93
|
-
* @category Components
|
|
94
|
-
* @example
|
|
95
|
-
* ```js
|
|
96
|
-
* this.addComponent(TilemapRenderer, {
|
|
97
|
-
* tileset: {
|
|
98
|
-
* image: this.assetManager.getImage("image.png"),
|
|
99
|
-
* width: 3,
|
|
100
|
-
* tileWidth: 16,
|
|
101
|
-
* tileHeight: 16,
|
|
102
|
-
* }
|
|
103
|
-
* tiles: [1, 2, 0, 0, 0, 0, 2, 1, 3, 4, 5, 5, 5, 5, 4, 3],
|
|
104
|
-
* width: 8,
|
|
105
|
-
* tileWidth: 16,
|
|
106
|
-
* tileHeight: 16,
|
|
107
|
-
* });
|
|
108
|
-
* ```
|
|
109
|
-
* @example
|
|
110
|
-
* ```js
|
|
111
|
-
* this.addComponent(TilemapRenderer, {
|
|
112
|
-
* tileset: {
|
|
113
|
-
* image: this.assetManager.getImage("image.png"),
|
|
114
|
-
* width: 3,
|
|
115
|
-
* tileWidth: 16,
|
|
116
|
-
* tileHeight: 16,
|
|
117
|
-
* margin: new Vector2(0, 0),
|
|
118
|
-
* spacing: new Vector2(0, 0),
|
|
119
|
-
* }
|
|
120
|
-
* tiles: [1, 2, 0, 0, 0, 0, 2, 1, 3, 4, 5, 5, 5, 5, 4, 3],
|
|
121
|
-
* width: 8,
|
|
122
|
-
* tileWidth: 16,
|
|
123
|
-
* tileHeight: 16,
|
|
124
|
-
* layer: "Tilemap",
|
|
125
|
-
* orientation: TilemapOrientation.Center,
|
|
126
|
-
* smooth: false,
|
|
127
|
-
* });
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
export declare class TilemapRenderer extends RenderComponent implements ITilemapRenderer {
|
|
131
|
-
private readonly spriteDefaultScale;
|
|
132
|
-
/** Id of tiles separated by commas. The ids start at 1, and increment from left to right,
|
|
133
|
-
* from top to bottom. ID 0 (zero) represents a space with no tile. */
|
|
134
|
-
tiles: number[];
|
|
135
|
-
/** The width of the tilemap in tiles */
|
|
136
|
-
width: number;
|
|
137
|
-
/**
|
|
138
|
-
* The height of the tilemap in tiles (this is calculated by the component)
|
|
139
|
-
* @readonly
|
|
140
|
-
*/
|
|
141
|
-
height: number;
|
|
142
|
-
/** The width of the tile to render in pixels */
|
|
143
|
-
tileWidth: number;
|
|
144
|
-
/** The height of the tile to render in pixels */
|
|
145
|
-
tileHeight: number;
|
|
146
|
-
/** Define a color for tinting the tiles */
|
|
147
|
-
tintColor: string;
|
|
148
|
-
/** Change the opacity between 1 and 0 */
|
|
149
|
-
opacity: number;
|
|
150
|
-
/** Direction in which the tilemap will be rendered (default value TilemapOrientation.Center) */
|
|
151
|
-
orientation: TilemapOrientation;
|
|
152
|
-
/**
|
|
153
|
-
* Tilemap width in pixels (this is calculated by the component)
|
|
154
|
-
* @readonly
|
|
155
|
-
*/
|
|
156
|
-
realWidth: number;
|
|
157
|
-
/**
|
|
158
|
-
* Tilemap height in pixels (this is calculated by the component)
|
|
159
|
-
* @readonly
|
|
160
|
-
*/
|
|
161
|
-
realHeight: number;
|
|
162
|
-
private tileset;
|
|
163
|
-
private renderData;
|
|
164
|
-
private layer;
|
|
165
|
-
private scaledTileWidth;
|
|
166
|
-
private scaledTileHeight;
|
|
167
|
-
protected init({ tiles, tileset, tileWidth, tileHeight, width, layer, orientation, opacity, tintColor, smooth, }: TilemapRendererOptions): void;
|
|
168
|
-
protected update(): void;
|
|
169
|
-
private updateRenderData;
|
|
170
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { RenderComponent } from "../../core/Component";
|
|
2
|
-
import { Rotation, Vector2 } from "angry-pixel-math";
|
|
3
|
-
import { Slice } from "angry-pixel-2d-renderer";
|
|
4
|
-
/**
|
|
5
|
-
* VideoRenderer configuration options.
|
|
6
|
-
* @public
|
|
7
|
-
* @category Components
|
|
8
|
-
* @example
|
|
9
|
-
* ```js
|
|
10
|
-
* this.addComponent(VideoRenderer, {
|
|
11
|
-
* video: this.assetManager.getVideo("video.mp4"),
|
|
12
|
-
* width: 1920,
|
|
13
|
-
* height: 1080,
|
|
14
|
-
* offset: new Vector2(0, 0),
|
|
15
|
-
* flipHorizontal: false,
|
|
16
|
-
* flipVertical: false,
|
|
17
|
-
* rotation: new Rotation(0),
|
|
18
|
-
* opacity: 1,
|
|
19
|
-
* maskColor: "#FF0000",
|
|
20
|
-
* maskColorMix: 0,
|
|
21
|
-
* tintColor: "#00FF00",
|
|
22
|
-
* layer: "Video",
|
|
23
|
-
* slice: {x: 0, y:0, width: 1920, height: 1080},
|
|
24
|
-
* volume: 1,
|
|
25
|
-
* loop: false,
|
|
26
|
-
* });
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export interface VideoRendererOptions {
|
|
30
|
-
/**The video element to render */
|
|
31
|
-
video: HTMLVideoElement;
|
|
32
|
-
/** Overwrite the original video width */
|
|
33
|
-
width?: number;
|
|
34
|
-
/** Overwrite the original video height */
|
|
35
|
-
height?: number;
|
|
36
|
-
/** X-axis and Y-axis offset */
|
|
37
|
-
offset?: Vector2;
|
|
38
|
-
/** Video rotation (degrees or radians) */
|
|
39
|
-
rotation?: Rotation;
|
|
40
|
-
/** Flip the video horizontally */
|
|
41
|
-
flipHorizontal?: boolean;
|
|
42
|
-
/** Flip the video vertically */
|
|
43
|
-
flipVertical?: boolean;
|
|
44
|
-
/** Change the opacity between 1 and 0 */
|
|
45
|
-
opacity?: number;
|
|
46
|
-
/** Define a mask color for the video */
|
|
47
|
-
maskColor?: string;
|
|
48
|
-
/** Define the opacity of the mask color between 1 and 0 */
|
|
49
|
-
maskColorMix?: number;
|
|
50
|
-
/** Define a color for tinting the video */
|
|
51
|
-
tintColor?: string;
|
|
52
|
-
/** The render layer */
|
|
53
|
-
layer?: string;
|
|
54
|
-
/** Cut the video based on straight coordinates starting from the top left downward */
|
|
55
|
-
slice?: Slice;
|
|
56
|
-
/** The volume of the video. Values between 1 and 0 */
|
|
57
|
-
volume?: number;
|
|
58
|
-
/** TRUE if the video will play in loop */
|
|
59
|
-
loop?: boolean;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* The VideoRenderer component plays and renders a video element, and allows configuring options such as its dimensions, coloring, etc.
|
|
63
|
-
* @public
|
|
64
|
-
* @category Components
|
|
65
|
-
* @example
|
|
66
|
-
* ```js
|
|
67
|
-
* this.addComponent(VideoRenderer, {
|
|
68
|
-
* video: this.assetManager.getVideo("video.mp4"),
|
|
69
|
-
* });
|
|
70
|
-
* ```
|
|
71
|
-
* @example
|
|
72
|
-
* ```js
|
|
73
|
-
* this.addComponent(VideoRenderer, {
|
|
74
|
-
* video: this.assetManager.getVideo("video.mp4"),
|
|
75
|
-
* width: 1920,
|
|
76
|
-
* height: 1080,
|
|
77
|
-
* offset: new Vector2(0, 0),
|
|
78
|
-
* flipHorizontal: false,
|
|
79
|
-
* flipVertical: false,
|
|
80
|
-
* rotation: new Rotation(0),
|
|
81
|
-
* opacity: 1,
|
|
82
|
-
* maskColor: "#FF0000",
|
|
83
|
-
* maskColorMix: 0,
|
|
84
|
-
* tintColor: "#00FF00",
|
|
85
|
-
* layer: "Video",
|
|
86
|
-
* slice: {x: 0, y:0, width: 1920, height: 1080},
|
|
87
|
-
* volume: 1,
|
|
88
|
-
* loop: false,
|
|
89
|
-
* });
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
export declare class VideoRenderer extends RenderComponent {
|
|
93
|
-
/**The video element to render */
|
|
94
|
-
video: HTMLVideoElement;
|
|
95
|
-
/** Overwrite the original video width */
|
|
96
|
-
width: number;
|
|
97
|
-
/** Overwrite the original video height */
|
|
98
|
-
height: number;
|
|
99
|
-
/** X-axis and Y-axis offset */
|
|
100
|
-
offset: Vector2;
|
|
101
|
-
/** Video rotation (degrees or radians) */
|
|
102
|
-
rotation: Rotation;
|
|
103
|
-
/** Flip the video horizontally */
|
|
104
|
-
flipHorizontal: boolean;
|
|
105
|
-
/** Flip the video vertically */
|
|
106
|
-
flipVertical: boolean;
|
|
107
|
-
/** Change the opacity between 1 and 0 */
|
|
108
|
-
opacity: number;
|
|
109
|
-
/** Define a mask color for the video */
|
|
110
|
-
maskColor: string;
|
|
111
|
-
/** Define the opacity of the mask color between 1 and 0 */
|
|
112
|
-
maskColorMix: number;
|
|
113
|
-
/** Define a color for tinting the video */
|
|
114
|
-
tintColor: string;
|
|
115
|
-
/** The render layer */
|
|
116
|
-
layer: string;
|
|
117
|
-
/** Cut the video based on straight coordinates starting from the top left downward */
|
|
118
|
-
slice?: Slice;
|
|
119
|
-
private renderData;
|
|
120
|
-
private innerPosition;
|
|
121
|
-
private scaledOffset;
|
|
122
|
-
private _loop;
|
|
123
|
-
private _volume;
|
|
124
|
-
private _playing;
|
|
125
|
-
private _paused;
|
|
126
|
-
/** The volume of the video */
|
|
127
|
-
set volume(volume: number);
|
|
128
|
-
/** The volume of the video */
|
|
129
|
-
get volume(): number;
|
|
130
|
-
/** TRUE if the video will play in loop */
|
|
131
|
-
set loop(loop: boolean);
|
|
132
|
-
/** TRUE if the video will play in loop */
|
|
133
|
-
get loop(): boolean;
|
|
134
|
-
/** TRUE if the video is playing */
|
|
135
|
-
get playing(): boolean;
|
|
136
|
-
/** TRUE if the video is paused */
|
|
137
|
-
get paused(): boolean;
|
|
138
|
-
protected init(config: VideoRendererOptions): void;
|
|
139
|
-
/**
|
|
140
|
-
* Play the loaded video
|
|
141
|
-
*/
|
|
142
|
-
play(): void;
|
|
143
|
-
/**
|
|
144
|
-
* Stop playing the current video
|
|
145
|
-
*/
|
|
146
|
-
stop(): void;
|
|
147
|
-
/**
|
|
148
|
-
* Plause the current video
|
|
149
|
-
*/
|
|
150
|
-
pause(): void;
|
|
151
|
-
private videoEventHandler;
|
|
152
|
-
private userInputEventHandler;
|
|
153
|
-
protected update(): void;
|
|
154
|
-
private calculateRenderPosition;
|
|
155
|
-
private translateRenderPosition;
|
|
156
|
-
protected onActiveChange(): void;
|
|
157
|
-
protected onDestroy(): void;
|
|
158
|
-
}
|
package/lib/core/Component.d.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { GameObject } from "./GameObject";
|
|
2
|
-
import { Scene } from "./Scene";
|
|
3
|
-
import { FrameEvent } from "./managers/IterationManager";
|
|
4
|
-
import { GameActor } from "./GameActor";
|
|
5
|
-
import { Container } from "../utils/Container";
|
|
6
|
-
/** @private */
|
|
7
|
-
export type ComponentClass<T extends Component = Component> = new (container: Container, gameObject: GameObject, name?: string) => T;
|
|
8
|
-
/**
|
|
9
|
-
* Base class for all components to be added to game objects.
|
|
10
|
-
* @public
|
|
11
|
-
* @category Core
|
|
12
|
-
* @example
|
|
13
|
-
* ```js
|
|
14
|
-
* class MovementsController extends Component {
|
|
15
|
-
* init(options) {
|
|
16
|
-
* // executed after instantiation
|
|
17
|
-
* }
|
|
18
|
-
* start() {
|
|
19
|
-
* // executed in the first available frame
|
|
20
|
-
* }
|
|
21
|
-
* update() {
|
|
22
|
-
* // executed on every frame
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* class MovementsController extends Component {
|
|
29
|
-
* protected init(options?: InitOptions): void {
|
|
30
|
-
* // executed after instantiation
|
|
31
|
-
* }
|
|
32
|
-
* protected start(): void {
|
|
33
|
-
* // executed in the first available frame
|
|
34
|
-
* }
|
|
35
|
-
* protected update(): void {
|
|
36
|
-
* // executed on every frame
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare abstract class Component extends GameActor {
|
|
42
|
-
/** Name given manually at the time of instantiation. */
|
|
43
|
-
readonly name: string;
|
|
44
|
-
/** Object to which it belongs. */
|
|
45
|
-
readonly gameObject: GameObject;
|
|
46
|
-
/** TRUE if several instances of this component are allowed in the same object. */
|
|
47
|
-
readonly allowMultiple: boolean;
|
|
48
|
-
/** @private */
|
|
49
|
-
private _active;
|
|
50
|
-
/** @private */
|
|
51
|
-
constructor(container: Container, gameObject: GameObject, name?: string);
|
|
52
|
-
/** TRUE for enabled object, FALSE for disabled object. */
|
|
53
|
-
get active(): boolean;
|
|
54
|
-
/** TRUE for enabled object, FALSE for disabled object. */
|
|
55
|
-
set active(active: boolean);
|
|
56
|
-
/**
|
|
57
|
-
* This method is called when the active state changes.
|
|
58
|
-
*/
|
|
59
|
-
protected onActiveChange(): void;
|
|
60
|
-
/**
|
|
61
|
-
* @returns The current loaded scene
|
|
62
|
-
*/
|
|
63
|
-
protected getCurrentScene<T extends Scene>(): T;
|
|
64
|
-
/**
|
|
65
|
-
* @returns The GameObject to which this component is attached
|
|
66
|
-
*/
|
|
67
|
-
protected getGameObject<T extends GameObject>(): T;
|
|
68
|
-
/**
|
|
69
|
-
* Returns all the components in the game object.
|
|
70
|
-
* @returns The found components
|
|
71
|
-
*/
|
|
72
|
-
getComponents(): Component[];
|
|
73
|
-
/**
|
|
74
|
-
* Returns all the components for the given class in the game object.
|
|
75
|
-
* @param componentClass The class of the components
|
|
76
|
-
* @returns The found components
|
|
77
|
-
*/
|
|
78
|
-
getComponents<T extends Component>(componentClass: ComponentClass<T>): T[];
|
|
79
|
-
/**
|
|
80
|
-
* Returns the first component found for the given class, or undefined otherwise.
|
|
81
|
-
* @param componentClass The class of the component
|
|
82
|
-
* @returns The found component
|
|
83
|
-
*/
|
|
84
|
-
getComponent<T extends Component>(componentClass: ComponentClass<T>): T;
|
|
85
|
-
/**
|
|
86
|
-
* Returns the first component found for the given name, or undefined otherwise.
|
|
87
|
-
* @param name The name of the component
|
|
88
|
-
* @returns The found component
|
|
89
|
-
*/
|
|
90
|
-
getComponent<T extends Component>(name: string): T;
|
|
91
|
-
/**
|
|
92
|
-
* Returns TRUE if the game object has a component for the given class, or FALSE otherwise
|
|
93
|
-
* @param componentClass The class of the component to find
|
|
94
|
-
* @returns boolean
|
|
95
|
-
*/
|
|
96
|
-
hasComponent<T extends Component>(componentClass: ComponentClass<T>): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* @param name The name of the component to find
|
|
99
|
-
* @returns boolean
|
|
100
|
-
*/
|
|
101
|
-
hasComponent(name: string): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Removes the given component in the GameObject
|
|
104
|
-
* @param component The class of the component to remnove
|
|
105
|
-
*/
|
|
106
|
-
removeComponent(component: Component): void;
|
|
107
|
-
/** @private */
|
|
108
|
-
protected _destroy(): void;
|
|
109
|
-
/** @private */
|
|
110
|
-
protected _stopGame(): void;
|
|
111
|
-
}
|
|
112
|
-
/** @private */
|
|
113
|
-
export declare abstract class EngineComponent extends Component {
|
|
114
|
-
protected readonly updateEvent: FrameEvent;
|
|
115
|
-
}
|
|
116
|
-
/** @private */
|
|
117
|
-
export declare abstract class ColliderComponent extends Component {
|
|
118
|
-
protected readonly updateEvent: FrameEvent;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Base class for all components that execute logic at physics frame rate. Ideal for custom physics.
|
|
122
|
-
* @public
|
|
123
|
-
* @category Core
|
|
124
|
-
* @example
|
|
125
|
-
* ```js
|
|
126
|
-
* class PlayerMovements extends PhysicsComponent {
|
|
127
|
-
* init(options) {
|
|
128
|
-
* // executed after instantiation
|
|
129
|
-
* }
|
|
130
|
-
* start() {
|
|
131
|
-
* // executed in the first available frame
|
|
132
|
-
* }
|
|
133
|
-
* update() {
|
|
134
|
-
* // executed on every frame
|
|
135
|
-
* }
|
|
136
|
-
* }
|
|
137
|
-
* ```
|
|
138
|
-
* @example
|
|
139
|
-
* ```ts
|
|
140
|
-
* class PlayerMovements extends PhysicsComponent {
|
|
141
|
-
* protected init(options?: InitOptions): void {
|
|
142
|
-
* // executed after instantiation
|
|
143
|
-
* }
|
|
144
|
-
* protected start(): void {
|
|
145
|
-
* // executed in the first available frame
|
|
146
|
-
* }
|
|
147
|
-
* protected update(): void {
|
|
148
|
-
* // executed on every frame
|
|
149
|
-
* }
|
|
150
|
-
* }
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
export declare abstract class PhysicsComponent extends Component {
|
|
154
|
-
protected readonly updateEvent: FrameEvent;
|
|
155
|
-
}
|
|
156
|
-
/** @private */
|
|
157
|
-
export declare abstract class TransformComponent extends Component {
|
|
158
|
-
protected readonly updateEvent: FrameEvent;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Base class for all components that execute logic before rendering. Ideal for components that translate cameras.
|
|
162
|
-
* @public
|
|
163
|
-
* @category Core
|
|
164
|
-
* @example
|
|
165
|
-
* ```js
|
|
166
|
-
* class FollowPlayerCamera extends PreRenderComponent {
|
|
167
|
-
* init(options) {
|
|
168
|
-
* // executed after instantiation
|
|
169
|
-
* }
|
|
170
|
-
* start() {
|
|
171
|
-
* // executed in the first available frame
|
|
172
|
-
* }
|
|
173
|
-
* update() {
|
|
174
|
-
* // executed on every frame
|
|
175
|
-
* }
|
|
176
|
-
* }
|
|
177
|
-
* ```
|
|
178
|
-
* @example
|
|
179
|
-
* ```ts
|
|
180
|
-
* class FollowPlayerCamera extends PreRenderComponent {
|
|
181
|
-
* protected init(options?: InitOptions): void {
|
|
182
|
-
* // executed after instantiation
|
|
183
|
-
* }
|
|
184
|
-
* protected start(): void {
|
|
185
|
-
* // executed in the first available frame
|
|
186
|
-
* }
|
|
187
|
-
* protected update(): void {
|
|
188
|
-
* // executed on every frame
|
|
189
|
-
* }
|
|
190
|
-
* }
|
|
191
|
-
* ```
|
|
192
|
-
*/
|
|
193
|
-
export declare abstract class PreRenderComponent extends Component {
|
|
194
|
-
protected readonly updateEvent: FrameEvent;
|
|
195
|
-
}
|
|
196
|
-
/** @private */
|
|
197
|
-
export declare abstract class CameraComponent extends Component {
|
|
198
|
-
protected readonly updateEvent: FrameEvent;
|
|
199
|
-
}
|
|
200
|
-
/** @private */
|
|
201
|
-
export declare abstract class RenderComponent extends Component {
|
|
202
|
-
protected readonly updateEvent: FrameEvent;
|
|
203
|
-
}
|
package/lib/core/Game.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { InitOptions } from "./GameActor";
|
|
2
|
-
import { GameConfig } from "./GameConfig";
|
|
3
|
-
import { SceneClass } from "./Scene";
|
|
4
|
-
/**
|
|
5
|
-
* Game is the main class that contains all the managers, scenes, objects and components. It allows to start and stop the execution of the game.
|
|
6
|
-
* @public
|
|
7
|
-
* @category Core
|
|
8
|
-
* @example
|
|
9
|
-
* ```js
|
|
10
|
-
* const game = new Game({
|
|
11
|
-
* containerNode: document.getElementById("app"),
|
|
12
|
-
* gameWidth: 1920,
|
|
13
|
-
* gameHeight: 1080,
|
|
14
|
-
* });
|
|
15
|
-
* game.addScene(GameScene, "GameScene");
|
|
16
|
-
* game.run();
|
|
17
|
-
* ```
|
|
18
|
-
* @example
|
|
19
|
-
* ```js
|
|
20
|
-
* const game = new Game({
|
|
21
|
-
* containerNode: document.getElementById("app"),
|
|
22
|
-
* gameWidth: 1920,
|
|
23
|
-
* gameHeight: 1080,
|
|
24
|
-
* debugEnabled: false,
|
|
25
|
-
* canvasColor: "#000000",
|
|
26
|
-
* physicsFramerate: 180,
|
|
27
|
-
* headless: false,
|
|
28
|
-
* spriteDefaultScale: new Vector2(1, 1),
|
|
29
|
-
* collisions: {
|
|
30
|
-
* collisionMatrix: [
|
|
31
|
-
* ["layer1", "layer2"],
|
|
32
|
-
* ["layer1", "layer3"],
|
|
33
|
-
* ],
|
|
34
|
-
* collisionMethod: CollisionMethods.SAT,
|
|
35
|
-
* collisionBroadPhaseMethod: BroadPhaseMethods.SpartialGrid,
|
|
36
|
-
* collisionArea: new Rectangle(-960, -540, 1920, 1080),
|
|
37
|
-
* }
|
|
38
|
-
* });
|
|
39
|
-
* game.addScene(GameScene, "GameScene");
|
|
40
|
-
* game.run();
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export declare class Game {
|
|
44
|
-
/** @private */
|
|
45
|
-
private readonly container;
|
|
46
|
-
/** @private */
|
|
47
|
-
private sceneManager;
|
|
48
|
-
/** @private */
|
|
49
|
-
private iterationManager;
|
|
50
|
-
/** @private */
|
|
51
|
-
private _config;
|
|
52
|
-
/** @private */
|
|
53
|
-
constructor(config: GameConfig);
|
|
54
|
-
/** @private */
|
|
55
|
-
private setupManagers;
|
|
56
|
-
/**
|
|
57
|
-
* The game configuration
|
|
58
|
-
*/
|
|
59
|
-
get config(): GameConfig;
|
|
60
|
-
/**
|
|
61
|
-
* TRUE if the game is running
|
|
62
|
-
*/
|
|
63
|
-
get running(): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Add a scene to the game
|
|
66
|
-
*
|
|
67
|
-
* @param sceneClass the class of the scene
|
|
68
|
-
* @param name The name of the scene
|
|
69
|
-
*/
|
|
70
|
-
addScene(sceneClass: SceneClass, name: string): void;
|
|
71
|
-
/**
|
|
72
|
-
* Add a scene to the game
|
|
73
|
-
*
|
|
74
|
-
* @param sceneClass the class of the scene
|
|
75
|
-
* @param name The name of the scene
|
|
76
|
-
* @param options This options will be passed to the init method
|
|
77
|
-
*/
|
|
78
|
-
addScene(sceneClass: SceneClass, name: string, options: InitOptions): void;
|
|
79
|
-
/**
|
|
80
|
-
* Add a scene to the game
|
|
81
|
-
*
|
|
82
|
-
* @param sceneClass the class of the scene
|
|
83
|
-
* @param name The name of the scene
|
|
84
|
-
* @param openingScene If this is the opening scene, set TRUE, FALSE instead
|
|
85
|
-
*/
|
|
86
|
-
addScene(sceneClass: SceneClass, name: string, openingScene: boolean): void;
|
|
87
|
-
/**
|
|
88
|
-
* Add a scene to the game
|
|
89
|
-
*
|
|
90
|
-
* @param sceneClass the class of the scene
|
|
91
|
-
* @param name The name of the scene
|
|
92
|
-
* @param options This options will be passed to the init method
|
|
93
|
-
* @param openingScene If this is the opening scene, set TRUE, FALSE instead
|
|
94
|
-
*/
|
|
95
|
-
addScene(sceneClass: SceneClass, name: string, options: InitOptions, openingScene: boolean): void;
|
|
96
|
-
/**
|
|
97
|
-
* Run the game
|
|
98
|
-
*/
|
|
99
|
-
run(): void;
|
|
100
|
-
/**
|
|
101
|
-
* Stop the game
|
|
102
|
-
*/
|
|
103
|
-
stop(): void;
|
|
104
|
-
/**
|
|
105
|
-
* Pauses the game
|
|
106
|
-
*/
|
|
107
|
-
pause(): void;
|
|
108
|
-
/**
|
|
109
|
-
* Resumes the paused game
|
|
110
|
-
*/
|
|
111
|
-
resume(): void;
|
|
112
|
-
}
|