angry-pixel 1.1.1 → 1.1.2
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/Animator.d.ts +3 -2
- package/lib/component/AudioPlayer.d.ts +6 -4
- package/lib/component/Camera.d.ts +1 -2
- package/lib/component/RigidBody.d.ts +5 -4
- package/lib/component/Transform.d.ts +4 -5
- package/lib/component/collider/BallCollider.d.ts +3 -2
- package/lib/component/collider/BoxCollider.d.ts +3 -2
- package/lib/component/collider/Collider.d.ts +6 -1
- package/lib/component/collider/EdgeCollider.d.ts +7 -4
- package/lib/component/collider/PolygonCollider.d.ts +7 -4
- package/lib/component/collider/TilemapCollider.d.ts +3 -2
- package/lib/component/rendering/MaskRenderer.d.ts +3 -2
- package/lib/component/rendering/SpriteRenderer.d.ts +6 -5
- package/lib/component/rendering/TextRenderer.d.ts +3 -2
- package/lib/component/rendering/tilemap/CsvTilemapRenderer.d.ts +6 -6
- package/lib/component/rendering/tilemap/TiledTilemapRenderer.d.ts +10 -5
- package/lib/component/rendering/tilemap/TilemapRenderer.d.ts +9 -7
- package/lib/core/Component.d.ts +41 -86
- package/lib/core/Game.d.ts +10 -14
- package/lib/core/GameActor.d.ts +66 -0
- package/lib/core/GameObject.d.ts +53 -94
- package/lib/core/Scene.d.ts +6 -65
- package/lib/core/facades/GameObjectManagerFacade.d.ts +35 -25
- package/lib/core/facades/TimeManagerFacade.d.ts +1 -0
- package/lib/core/managers/GameObjectManager.d.ts +11 -10
- package/lib/core/managers/IterationManager copy.d.ts +42 -0
- package/lib/core/managers/IterationManager.d.ts +11 -6
- package/lib/core/managers/IterationManagerOld.d.ts +42 -0
- package/lib/core/managers/SceneManager.d.ts +2 -2
- package/lib/core/managers/TimeManager.d.ts +10 -6
- package/lib/gameObject/GameCamera.d.ts +2 -2
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/input/GamepadController.d.ts +16 -4
- package/lib/math/Utils.d.ts +8 -2
- package/lib/physics/collision/CollisionManager.d.ts +7 -3
- package/lib/physics/collision/resolver/AABBResolver.d.ts +2 -2
- package/lib/physics/collision/resolver/SatResolver.d.ts +1 -2
- package/lib/physics/rigodBody/RigidBodyData.d.ts +2 -1
- package/lib/physics/rigodBody/RigidBodyManager.d.ts +4 -1
- package/lib/rendering/renderData/TextRenderData.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EngineComponent } from "../core/Component";
|
|
2
2
|
import { SpriteRenderer } from "./rendering/SpriteRenderer";
|
|
3
3
|
import { Animation } from "./Animation";
|
|
4
|
-
|
|
4
|
+
import { InitOptions } from "../core/GameActor";
|
|
5
|
+
export interface AnimatorOptions extends InitOptions {
|
|
5
6
|
spriteRenderer: SpriteRenderer;
|
|
6
7
|
}
|
|
7
8
|
export declare class Animator extends EngineComponent {
|
|
@@ -9,7 +10,7 @@ export declare class Animator extends EngineComponent {
|
|
|
9
10
|
private spriteRenderer;
|
|
10
11
|
private animations;
|
|
11
12
|
private currentAnimation;
|
|
12
|
-
|
|
13
|
+
protected init({ spriteRenderer }: AnimatorOptions): void;
|
|
13
14
|
protected update(): void;
|
|
14
15
|
addAnimation(name: string, animation: Animation, framerate?: number): this;
|
|
15
16
|
playAnimation(name: string): void;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { EngineComponent } from "../core/Component";
|
|
2
|
-
|
|
2
|
+
import { InitOptions } from "../core/GameActor";
|
|
3
|
+
export interface AudioPlayerOptions extends InitOptions {
|
|
3
4
|
audio?: HTMLAudioElement;
|
|
4
5
|
volume?: number;
|
|
5
6
|
loop?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare class AudioPlayer extends EngineComponent {
|
|
9
|
+
readonly allowMultiple: boolean;
|
|
8
10
|
volume: number;
|
|
9
11
|
loop: boolean;
|
|
10
12
|
audio: HTMLAudioElement;
|
|
11
13
|
private clones;
|
|
12
14
|
private _playing;
|
|
13
15
|
private _paused;
|
|
14
|
-
|
|
16
|
+
protected init(options?: AudioPlayerOptions): void;
|
|
15
17
|
playAudio(audio: HTMLAudioElement, volume?: number | null): void;
|
|
16
18
|
private cloneAudio;
|
|
17
19
|
play(): void;
|
|
@@ -19,6 +21,6 @@ export declare class AudioPlayer extends EngineComponent {
|
|
|
19
21
|
pause(): void;
|
|
20
22
|
private audioEventHandler;
|
|
21
23
|
private userinputEventHandler;
|
|
22
|
-
protected
|
|
23
|
-
protected
|
|
24
|
+
protected onActiveChange(): void;
|
|
25
|
+
protected onDestroy(): void;
|
|
24
26
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CameraComponent } from "../core/Component";
|
|
2
2
|
import { Rectangle } from "../math/Rectangle";
|
|
3
3
|
export declare class Camera extends CameraComponent {
|
|
4
|
+
readonly allowMultiple: boolean;
|
|
4
5
|
private renderManager;
|
|
5
|
-
private domManager;
|
|
6
6
|
private _layers;
|
|
7
7
|
private _depth;
|
|
8
8
|
private _zoom;
|
|
@@ -11,7 +11,6 @@ export declare class Camera extends CameraComponent {
|
|
|
11
11
|
private _worldSpaceRect;
|
|
12
12
|
private canvas;
|
|
13
13
|
private cameraData;
|
|
14
|
-
constructor();
|
|
15
14
|
set layers(layers: string[]);
|
|
16
15
|
get layers(): string[];
|
|
17
16
|
set depth(depth: number);
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { EngineComponent } from "../core/Component";
|
|
2
2
|
import { Vector2 } from "../math/Vector2";
|
|
3
3
|
import { RigidBodyType } from "../physics/rigodBody/RigidBodyManager";
|
|
4
|
+
import { InitOptions } from "../core/GameActor";
|
|
4
5
|
export { RigidBodyType } from "../physics/rigodBody/RigidBodyManager";
|
|
5
|
-
export interface
|
|
6
|
+
export interface RigidBodyOptions extends InitOptions {
|
|
6
7
|
rigidBodyType: RigidBodyType;
|
|
7
|
-
layersToCollide?: string[];
|
|
8
8
|
gravity?: number;
|
|
9
9
|
}
|
|
10
10
|
export declare class RigidBody extends EngineComponent {
|
|
11
|
+
readonly allowMultiple: boolean;
|
|
11
12
|
private rigidBodyManager;
|
|
12
|
-
readonly rigidBodyType: RigidBodyType;
|
|
13
13
|
private data;
|
|
14
|
-
constructor(config: RigidBodyConfig);
|
|
15
14
|
set velocity(velocity: Vector2);
|
|
16
15
|
get velocity(): Vector2;
|
|
17
16
|
set gravity(gravity: number);
|
|
18
17
|
get gravity(): number;
|
|
18
|
+
get rigidBodyType(): RigidBodyType;
|
|
19
|
+
protected init({ rigidBodyType, gravity }: RigidBodyOptions): void;
|
|
19
20
|
protected start(): void;
|
|
20
21
|
protected update(): void;
|
|
21
22
|
private getColliders;
|
|
@@ -2,18 +2,18 @@ import { TransformComponent } from "../core/Component";
|
|
|
2
2
|
import { Rotation } from "../math/Rotation";
|
|
3
3
|
import { Vector2 } from "../math/Vector2";
|
|
4
4
|
export declare class Transform extends TransformComponent {
|
|
5
|
+
readonly allowMultiple: boolean;
|
|
6
|
+
parentScale: boolean;
|
|
7
|
+
parentRotation: boolean;
|
|
5
8
|
private _position;
|
|
6
9
|
private _scale;
|
|
7
10
|
private _rotation;
|
|
8
11
|
private _innerPosition;
|
|
9
12
|
private _parent;
|
|
10
|
-
parentScale: boolean;
|
|
11
|
-
parentRotation: boolean;
|
|
12
13
|
private cache;
|
|
13
14
|
private lastParentRadians;
|
|
14
15
|
private lastPosition;
|
|
15
16
|
private scaledInnerPosition;
|
|
16
|
-
constructor();
|
|
17
17
|
get position(): Vector2;
|
|
18
18
|
set position(position: Vector2);
|
|
19
19
|
get scale(): Vector2;
|
|
@@ -23,9 +23,8 @@ export declare class Transform extends TransformComponent {
|
|
|
23
23
|
get innerPosition(): Vector2;
|
|
24
24
|
set innerPosition(innerPosition: Vector2);
|
|
25
25
|
get parent(): Transform | null;
|
|
26
|
-
set parent(parent: Transform | null);
|
|
27
26
|
protected update(): void;
|
|
28
|
-
private
|
|
27
|
+
private setParent;
|
|
29
28
|
private setPositionFromParent;
|
|
30
29
|
private translateInnerPosition;
|
|
31
30
|
private updateScaledInnerPosition;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Collider } from "./Collider";
|
|
2
|
-
|
|
2
|
+
import { InitOptions } from "../../core/GameActor";
|
|
3
|
+
export interface BallColliderOptions extends InitOptions {
|
|
3
4
|
radius: number;
|
|
4
5
|
offsetX?: number;
|
|
5
6
|
offsetY?: number;
|
|
@@ -16,7 +17,7 @@ export declare class BallCollider extends Collider {
|
|
|
16
17
|
private realOffset;
|
|
17
18
|
private realPosition;
|
|
18
19
|
private innerPosition;
|
|
19
|
-
|
|
20
|
+
protected init(config: BallColliderOptions): void;
|
|
20
21
|
protected start(): void;
|
|
21
22
|
protected update(): void;
|
|
22
23
|
private updateRealSize;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Collider } from "./Collider";
|
|
2
2
|
import { Rotation } from "../../math/Rotation";
|
|
3
|
-
|
|
3
|
+
import { InitOptions } from "../../core/GameActor";
|
|
4
|
+
export interface BoxColliderOptions extends InitOptions {
|
|
4
5
|
width: number;
|
|
5
6
|
height: number;
|
|
6
7
|
offsetX?: number;
|
|
@@ -24,7 +25,7 @@ export declare class BoxCollider extends Collider {
|
|
|
24
25
|
private realRotation;
|
|
25
26
|
private applyRotation;
|
|
26
27
|
private innerPosition;
|
|
27
|
-
|
|
28
|
+
protected init(config: BoxColliderOptions): void;
|
|
28
29
|
protected start(): void;
|
|
29
30
|
protected update(): void;
|
|
30
31
|
private updateRealSize;
|
|
@@ -7,6 +7,10 @@ export interface CollisionData {
|
|
|
7
7
|
resolution: CollisionResolution;
|
|
8
8
|
collider: ColliderData;
|
|
9
9
|
gameObject: GameObject;
|
|
10
|
+
/**
|
|
11
|
+
* @return The GameObject to which this component belongs
|
|
12
|
+
*/
|
|
13
|
+
getGameObject: <T extends GameObject>() => T;
|
|
10
14
|
}
|
|
11
15
|
export declare abstract class Collider extends ColliderComponent {
|
|
12
16
|
protected collisionManager: CollisionManager;
|
|
@@ -18,5 +22,6 @@ export declare abstract class Collider extends ColliderComponent {
|
|
|
18
22
|
collidesWithLayer(layer: string): boolean;
|
|
19
23
|
getCollisionWithLayer(layer: string): CollisionData | null;
|
|
20
24
|
getCollisionsWithLayer(layer: string): CollisionData[];
|
|
21
|
-
|
|
25
|
+
private createCollisionData;
|
|
26
|
+
protected onActiveChange(): void;
|
|
22
27
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Collider } from "./Collider";
|
|
2
2
|
import { Vector2 } from "../../math/Vector2";
|
|
3
3
|
import { Rotation } from "../../math/Rotation";
|
|
4
|
-
|
|
4
|
+
import { GameObject } from "../../core/GameObject";
|
|
5
|
+
import { InitOptions } from "../../core/GameActor";
|
|
6
|
+
export interface EdgeColliderOptions extends InitOptions {
|
|
5
7
|
vertexModel: Vector2[];
|
|
6
8
|
offsetX?: number;
|
|
7
9
|
offsetY?: number;
|
|
@@ -11,8 +13,8 @@ export interface EdgeColliderConfig {
|
|
|
11
13
|
debug?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare class EdgeCollider extends Collider {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
debug: boolean;
|
|
17
|
+
vertexModel: Vector2[];
|
|
16
18
|
offsetX: number;
|
|
17
19
|
offsetY: number;
|
|
18
20
|
rotation: Rotation;
|
|
@@ -21,7 +23,8 @@ export declare class EdgeCollider extends Collider {
|
|
|
21
23
|
private scaledPosition;
|
|
22
24
|
private finalRotation;
|
|
23
25
|
private innerPosition;
|
|
24
|
-
constructor(
|
|
26
|
+
constructor(gameObject: GameObject, name?: string);
|
|
27
|
+
protected config(config: EdgeColliderOptions): void;
|
|
25
28
|
protected start(): void;
|
|
26
29
|
protected update(): void;
|
|
27
30
|
private updateSize;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Collider } from "./Collider";
|
|
2
2
|
import { Vector2 } from "../../math/Vector2";
|
|
3
3
|
import { Rotation } from "../../math/Rotation";
|
|
4
|
-
|
|
4
|
+
import { InitOptions } from "../../core/GameActor";
|
|
5
|
+
import { GameObject } from "../../core/GameObject";
|
|
6
|
+
export interface PolygonColliderOptions extends InitOptions {
|
|
5
7
|
vertexModel: Vector2[];
|
|
6
8
|
offsetX?: number;
|
|
7
9
|
offsetY?: number;
|
|
@@ -11,8 +13,8 @@ export interface PolygonColliderConfig {
|
|
|
11
13
|
debug?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare class PolygonCollider extends Collider {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
debug: boolean;
|
|
17
|
+
vertexModel: Vector2[];
|
|
16
18
|
offsetX: number;
|
|
17
19
|
offsetY: number;
|
|
18
20
|
rotation: Rotation;
|
|
@@ -21,7 +23,8 @@ export declare class PolygonCollider extends Collider {
|
|
|
21
23
|
private scaledPosition;
|
|
22
24
|
private finalRotation;
|
|
23
25
|
private innerPosition;
|
|
24
|
-
constructor(
|
|
26
|
+
constructor(gameObject: GameObject, name?: string);
|
|
27
|
+
protected init(config: PolygonColliderOptions): void;
|
|
25
28
|
protected start(): void;
|
|
26
29
|
protected update(): void;
|
|
27
30
|
private updateSize;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TilemapRenderer } from "../rendering/tilemap/TilemapRenderer";
|
|
2
2
|
import { Collider } from "./Collider";
|
|
3
|
-
|
|
3
|
+
import { InitOptions } from "../../core/GameActor";
|
|
4
|
+
export interface TilemapColliderOptions extends InitOptions {
|
|
4
5
|
tilemapRenderer: TilemapRenderer;
|
|
5
6
|
layer?: string;
|
|
6
7
|
debug?: boolean;
|
|
@@ -9,7 +10,7 @@ export declare class TilemapCollider extends Collider {
|
|
|
9
10
|
private tilemapRenderer;
|
|
10
11
|
private debug;
|
|
11
12
|
private cacheVertex;
|
|
12
|
-
|
|
13
|
+
protected init(config: TilemapColliderOptions): void;
|
|
13
14
|
protected start(): void;
|
|
14
15
|
private needsCollider;
|
|
15
16
|
protected update(): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RenderComponent } from "../../core/Component";
|
|
2
2
|
import { Rotation } from "../../math/Rotation";
|
|
3
3
|
import { Vector2 } from "../../math/Vector2";
|
|
4
|
-
|
|
4
|
+
import { InitOptions } from "../../core/GameActor";
|
|
5
|
+
export interface MaskRendererOptions extends InitOptions {
|
|
5
6
|
width: number;
|
|
6
7
|
height: number;
|
|
7
8
|
color: string;
|
|
@@ -22,7 +23,7 @@ export declare class MaskRenderer extends RenderComponent {
|
|
|
22
23
|
private renderData;
|
|
23
24
|
private innerPosition;
|
|
24
25
|
private scaledOffset;
|
|
25
|
-
|
|
26
|
+
protected init(config: MaskRendererOptions): void;
|
|
26
27
|
protected update(): void;
|
|
27
28
|
private calculateRenderPosition;
|
|
28
29
|
private translateRenderPosition;
|
|
@@ -2,7 +2,8 @@ import { RenderComponent } from "../../core/Component";
|
|
|
2
2
|
import { Rotation } from "../../math/Rotation";
|
|
3
3
|
import { Vector2 } from "../../math/Vector2";
|
|
4
4
|
import { Sprite } from "../Sprite";
|
|
5
|
-
|
|
5
|
+
import { InitOptions } from "../../core/GameActor";
|
|
6
|
+
export interface SpriteRendererOptions extends InitOptions {
|
|
6
7
|
sprite?: Sprite;
|
|
7
8
|
offset?: Vector2;
|
|
8
9
|
smooth?: boolean;
|
|
@@ -18,7 +19,7 @@ export interface SpriteRendererConfig {
|
|
|
18
19
|
}
|
|
19
20
|
export declare class SpriteRenderer extends RenderComponent {
|
|
20
21
|
private renderManager;
|
|
21
|
-
sprite: Sprite;
|
|
22
|
+
sprite: Sprite | null;
|
|
22
23
|
offset: Vector2;
|
|
23
24
|
flipHorizontal: boolean;
|
|
24
25
|
flipVertical: boolean;
|
|
@@ -26,16 +27,16 @@ export declare class SpriteRenderer extends RenderComponent {
|
|
|
26
27
|
smooth: boolean;
|
|
27
28
|
opacity: number;
|
|
28
29
|
private _tiled;
|
|
29
|
-
maskColor: string;
|
|
30
|
+
maskColor: string | null;
|
|
30
31
|
maskColorMix: number;
|
|
31
|
-
tintColor: string;
|
|
32
|
+
tintColor: string | null;
|
|
32
33
|
layer: string;
|
|
33
34
|
private renderData;
|
|
34
35
|
private innerPosition;
|
|
35
36
|
private cachePosition;
|
|
36
37
|
private cacheRenderPosition;
|
|
37
38
|
private scaledOffset;
|
|
38
|
-
|
|
39
|
+
protected init(config?: SpriteRendererOptions): void;
|
|
39
40
|
get tiled(): Vector2;
|
|
40
41
|
set tiled(tiled: Vector2);
|
|
41
42
|
protected update(): void;
|
|
@@ -2,7 +2,8 @@ import { RenderComponent } from "../../core/Component";
|
|
|
2
2
|
import { Orientation } from "../../rendering/renderData/TextRenderData";
|
|
3
3
|
import { Rotation } from "../../math/Rotation";
|
|
4
4
|
import { Vector2 } from "../../math/Vector2";
|
|
5
|
-
|
|
5
|
+
import { InitOptions } from "../../core/GameActor";
|
|
6
|
+
export interface TextRendererOptions extends InitOptions {
|
|
6
7
|
text: string;
|
|
7
8
|
fontFamily: string;
|
|
8
9
|
fontUrl?: string;
|
|
@@ -42,7 +43,7 @@ export declare class TextRenderer extends RenderComponent {
|
|
|
42
43
|
private renderManager;
|
|
43
44
|
private renderData;
|
|
44
45
|
private lastFrameText;
|
|
45
|
-
|
|
46
|
+
protected init(config: TextRendererOptions): void;
|
|
46
47
|
protected start(): void;
|
|
47
48
|
protected update(): void;
|
|
48
49
|
private crop;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TilemapRenderer,
|
|
2
|
-
export interface
|
|
1
|
+
import { TilemapRenderer, TilemapRendererOptions } from "./TilemapRenderer";
|
|
2
|
+
export interface CsvTilemapOptions extends TilemapRendererOptions {
|
|
3
3
|
tilemapData: string;
|
|
4
4
|
alpha?: number;
|
|
5
5
|
tintColor?: string;
|
|
6
6
|
}
|
|
7
7
|
export declare class CsvTilemapRenderer extends TilemapRenderer {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
tilemapData: string;
|
|
9
|
+
alpha: number;
|
|
10
|
+
tintColor: string;
|
|
11
|
+
protected init(config: CsvTilemapOptions): void;
|
|
12
12
|
protected processTilemap(): void;
|
|
13
13
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { TilemapRenderer,
|
|
2
|
-
export interface
|
|
1
|
+
import { TilemapRenderer, TilemapRendererOptions } from "./TilemapRenderer";
|
|
2
|
+
export interface TiledTilemapOptions extends TilemapRendererOptions {
|
|
3
3
|
tilemapData: TiledTilemap;
|
|
4
4
|
layerName?: string;
|
|
5
5
|
}
|
|
6
6
|
export declare class TiledTilemapRenderer extends TilemapRenderer {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
tiledTilemap: TiledTilemap;
|
|
8
|
+
layerName: string;
|
|
9
|
+
private tilesetTileIds;
|
|
10
|
+
protected init(config: TiledTilemapOptions): void;
|
|
10
11
|
protected processTilemap(): void;
|
|
11
12
|
private processChunk;
|
|
13
|
+
private getTilesetTileId;
|
|
12
14
|
}
|
|
13
15
|
export interface TiledTilemap {
|
|
14
16
|
width: number;
|
|
@@ -16,6 +18,9 @@ export interface TiledTilemap {
|
|
|
16
18
|
infinite: boolean;
|
|
17
19
|
layers: TiledLayer[];
|
|
18
20
|
renderorder: string;
|
|
21
|
+
tilesets: {
|
|
22
|
+
firstgid: number;
|
|
23
|
+
}[];
|
|
19
24
|
}
|
|
20
25
|
export interface TiledChunk {
|
|
21
26
|
data: number[];
|
|
@@ -5,6 +5,7 @@ import { Tileset } from "./Tileset";
|
|
|
5
5
|
import { TileData } from "./TileData";
|
|
6
6
|
import { Tile } from "./Tile";
|
|
7
7
|
import { TilemapRenderData, TileRenderData } from "../../../rendering/renderData/TilemapRenderData";
|
|
8
|
+
import { InitOptions } from "../../../core/GameActor";
|
|
8
9
|
export declare type Flip = {
|
|
9
10
|
h: boolean;
|
|
10
11
|
v: boolean;
|
|
@@ -27,7 +28,7 @@ export declare type TileToProcess = {
|
|
|
27
28
|
flip: Flip;
|
|
28
29
|
offset: Offset;
|
|
29
30
|
};
|
|
30
|
-
export interface
|
|
31
|
+
export interface TilemapRendererOptions extends InitOptions {
|
|
31
32
|
tileset: Tileset;
|
|
32
33
|
renderOrder?: RenderOrder;
|
|
33
34
|
smooth?: boolean;
|
|
@@ -35,11 +36,12 @@ export interface TilemapRendererConfig {
|
|
|
35
36
|
tileScale?: Vector2;
|
|
36
37
|
}
|
|
37
38
|
export declare abstract class TilemapRenderer extends RenderComponent {
|
|
38
|
-
readonly
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
readonly allowMultiple: boolean;
|
|
40
|
+
tileset: Tileset;
|
|
41
|
+
renderOrder: RenderOrder;
|
|
42
|
+
smooth: boolean;
|
|
43
|
+
textureCorrection: number;
|
|
44
|
+
tileScale: Vector2;
|
|
43
45
|
protected tileWidth: number;
|
|
44
46
|
protected tileHeight: number;
|
|
45
47
|
protected orientation: Vector2;
|
|
@@ -54,7 +56,7 @@ export declare abstract class TilemapRenderer extends RenderComponent {
|
|
|
54
56
|
protected _realWidth: number;
|
|
55
57
|
protected _realHeight: number;
|
|
56
58
|
private cacheV2;
|
|
57
|
-
|
|
59
|
+
protected init(config: TilemapRendererOptions): void;
|
|
58
60
|
protected start(): void;
|
|
59
61
|
protected update(): void;
|
|
60
62
|
protected abstract processTilemap(): void;
|
package/lib/core/Component.d.ts
CHANGED
|
@@ -1,130 +1,85 @@
|
|
|
1
|
-
import { GameObjectFactory, GameObjectManager } from "./managers/GameObjectManager";
|
|
2
1
|
import { GameObject } from "./GameObject";
|
|
3
2
|
import { Scene } from "./Scene";
|
|
4
3
|
import { FrameEvent } from "./managers/IterationManager";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { GameActor } from "./GameActor";
|
|
5
|
+
export declare type ComponentClass<T extends Component = Component> = new (gameObject: GameObject, name?: string) => T;
|
|
6
|
+
export declare abstract class Component extends GameActor {
|
|
7
|
+
private readonly sceneManager;
|
|
8
8
|
readonly id: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
allowMultiple: boolean;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly gameObject: GameObject;
|
|
11
|
+
readonly allowMultiple: boolean;
|
|
13
12
|
private _active;
|
|
14
|
-
|
|
15
|
-
protected get updateEvent(): FrameEvent;
|
|
13
|
+
constructor(gameObject: GameObject, name?: string);
|
|
16
14
|
get active(): boolean;
|
|
17
|
-
|
|
18
|
-
dispatch(event: FrameEvent): void;
|
|
19
|
-
/**
|
|
20
|
-
* This method is called only once.
|
|
21
|
-
* Recommended for GameObject cration.
|
|
22
|
-
*/
|
|
23
|
-
protected init(): void;
|
|
24
|
-
/**
|
|
25
|
-
* This method is called only once.
|
|
26
|
-
*/
|
|
27
|
-
protected start(): void;
|
|
28
|
-
/**
|
|
29
|
-
* This method is called on every frame.
|
|
30
|
-
*/
|
|
31
|
-
protected update(): void;
|
|
32
|
-
/**
|
|
33
|
-
* This method is called before the component is destroyed.
|
|
34
|
-
*/
|
|
35
|
-
protected destroy(): void;
|
|
15
|
+
set active(active: boolean);
|
|
36
16
|
/**
|
|
37
17
|
* This method is called when the active state changes.
|
|
38
18
|
*/
|
|
39
|
-
protected
|
|
19
|
+
protected onActiveChange(): void;
|
|
40
20
|
/**
|
|
41
21
|
* @returns The current loaded scene
|
|
42
22
|
*/
|
|
43
23
|
protected getCurrentScene<T extends Scene>(): T;
|
|
44
24
|
/**
|
|
45
|
-
* @
|
|
46
|
-
* @param name The name of the game object, this must not be used by another game object
|
|
47
|
-
* @returns The added game object
|
|
48
|
-
*/
|
|
49
|
-
protected addGameObject<T extends GameObject>(gameObjectFactory: GameObjectFactory, name: string): T;
|
|
50
|
-
/**
|
|
51
|
-
* @param name The name of the component to find
|
|
52
|
-
* @returns The found component
|
|
53
|
-
*/
|
|
54
|
-
protected getComponentByName<T extends Component>(name: string): T;
|
|
55
|
-
/**
|
|
56
|
-
* @param type The type of the component to find
|
|
57
|
-
* @returns The found component
|
|
25
|
+
* @returns The GameObject to which this component is attached
|
|
58
26
|
*/
|
|
59
|
-
protected
|
|
27
|
+
protected getGameObject<T extends GameObject>(): T;
|
|
60
28
|
/**
|
|
61
|
-
*
|
|
29
|
+
* Returns all the components in the game object.
|
|
62
30
|
* @returns The found components
|
|
63
31
|
*/
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @param name The name of the game object to find
|
|
67
|
-
* @returns The found game object
|
|
68
|
-
*/
|
|
69
|
-
protected findGameObjectByName<T extends GameObject>(name: string): T;
|
|
32
|
+
getComponents(): Component[];
|
|
70
33
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
34
|
+
* Returns all the components for the given class in the game object.
|
|
35
|
+
* @param componentClass The class of the components
|
|
36
|
+
* @returns The found components
|
|
73
37
|
*/
|
|
74
|
-
|
|
38
|
+
getComponents<T extends Component>(componentClass: ComponentClass<T>): T[];
|
|
75
39
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
40
|
+
* Returns the first component found for the given class, or undefined otherwise.
|
|
41
|
+
* @param componentClass The class of the component
|
|
42
|
+
* @returns The found component
|
|
78
43
|
*/
|
|
79
|
-
|
|
44
|
+
getComponent<T extends Component>(componentClass: ComponentClass<T>): T;
|
|
80
45
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @param name The name of the
|
|
46
|
+
* Returns the first component found for the given name, or undefined otherwise.
|
|
47
|
+
* @param name The name of the component
|
|
48
|
+
* @returns The found component
|
|
83
49
|
*/
|
|
84
|
-
|
|
50
|
+
getComponent<T extends Component>(name: string): T;
|
|
85
51
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @param
|
|
52
|
+
* Returns TRUE if the game object has a component for the given class, or FALSE otherwise
|
|
53
|
+
* @param componentClass The class of the component to find
|
|
54
|
+
* @returns boolean
|
|
88
55
|
*/
|
|
89
|
-
|
|
56
|
+
hasComponent<T extends Component>(componentClass: ComponentClass<T>): boolean;
|
|
90
57
|
/**
|
|
91
58
|
* @param name The name of the component to find
|
|
92
|
-
* @returns
|
|
93
|
-
*/
|
|
94
|
-
hasComponentOfName(name: string): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* @param type The type of the component to find
|
|
97
|
-
* @returns TRUE or FALSE
|
|
98
|
-
*/
|
|
99
|
-
hasComponentOfType(type: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* @param name The name of the component to remove
|
|
102
|
-
*/
|
|
103
|
-
removeComponentByName(name: string): void;
|
|
104
|
-
/**
|
|
105
|
-
* @param type The tyepe of the component to remove
|
|
59
|
+
* @returns boolean
|
|
106
60
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
61
|
+
hasComponent(name: string): boolean;
|
|
62
|
+
removeComponent(component: Component): void;
|
|
63
|
+
protected _destroy(): void;
|
|
109
64
|
}
|
|
110
65
|
export declare abstract class EngineComponent extends Component {
|
|
111
|
-
protected
|
|
66
|
+
protected readonly updateEvent: FrameEvent;
|
|
112
67
|
}
|
|
113
68
|
export declare abstract class ColliderComponent extends Component {
|
|
114
|
-
protected
|
|
69
|
+
protected readonly updateEvent: FrameEvent;
|
|
115
70
|
}
|
|
116
71
|
export declare abstract class PhysicsComponent extends Component {
|
|
117
|
-
protected
|
|
72
|
+
protected readonly updateEvent: FrameEvent;
|
|
118
73
|
}
|
|
119
74
|
export declare abstract class TransformComponent extends Component {
|
|
120
|
-
protected
|
|
75
|
+
protected readonly updateEvent: FrameEvent;
|
|
121
76
|
}
|
|
122
77
|
export declare abstract class PreRenderComponent extends Component {
|
|
123
|
-
protected
|
|
78
|
+
protected readonly updateEvent: FrameEvent;
|
|
124
79
|
}
|
|
125
80
|
export declare abstract class CameraComponent extends Component {
|
|
126
|
-
protected
|
|
81
|
+
protected readonly updateEvent: FrameEvent;
|
|
127
82
|
}
|
|
128
83
|
export declare abstract class RenderComponent extends Component {
|
|
129
|
-
protected
|
|
84
|
+
protected readonly updateEvent: FrameEvent;
|
|
130
85
|
}
|