emeraldengine 2.0.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/README.md +968 -0
- package/dist/types/imports/BitmapText.d.ts +79 -0
- package/dist/types/imports/Color.d.ts +17 -0
- package/dist/types/imports/Drawable.d.ts +157 -0
- package/dist/types/imports/Emerald.d.ts +73 -0
- package/dist/types/imports/FPSCounter.d.ts +19 -0
- package/dist/types/imports/GLUtils.d.ts +6 -0
- package/dist/types/imports/Instance.d.ts +87 -0
- package/dist/types/imports/InstancedTexture.d.ts +230 -0
- package/dist/types/imports/Physics.d.ts +139 -0
- package/dist/types/imports/Scene.d.ts +39 -0
- package/dist/types/imports/Shaders.d.ts +4 -0
- package/dist/types/imports/Shapes.d.ts +25 -0
- package/dist/types/imports/Storage.d.ts +46 -0
- package/dist/types/imports/Texture.d.ts +19 -0
- package/dist/types/imports/Time.d.ts +22 -0
- package/dist/types/imports/Transform.d.ts +41 -0
- package/dist/types/imports/components/BoxCollider.d.ts +41 -0
- package/dist/types/imports/components/BoxColliderDebug.d.ts +19 -0
- package/dist/types/imports/components/CircleCollider.d.ts +39 -0
- package/dist/types/imports/components/CircleColliderDebug.d.ts +19 -0
- package/dist/types/imports/components/Collider.d.ts +53 -0
- package/dist/types/imports/components/GameObject.d.ts +72 -0
- package/dist/types/imports/components/RigidBody.d.ts +104 -0
- package/dist/types/imports/lights/DirectionalLight.d.ts +26 -0
- package/dist/types/imports/lights/PointLight.d.ts +18 -0
- package/dist/types/imports/managers/AudioManager.d.ts +60 -0
- package/dist/types/imports/managers/CameraManager.d.ts +35 -0
- package/dist/types/imports/managers/EventManager.d.ts +187 -0
- package/dist/types/imports/managers/GLManager.d.ts +47 -0
- package/dist/types/imports/managers/IDManager.d.ts +21 -0
- package/dist/types/imports/managers/SceneManager.d.ts +22 -0
- package/dist/types/imports/particlesystem/Particle.d.ts +42 -0
- package/dist/types/imports/particlesystem/ParticleSettings.d.ts +49 -0
- package/dist/types/imports/particlesystem/Particles.d.ts +71 -0
- package/dist/types/index.d.ts +32 -0
- package/imports/BitmapText.js +245 -0
- package/imports/Color.js +18 -0
- package/imports/Drawable.js +550 -0
- package/imports/Emerald.js +459 -0
- package/imports/FPSCounter.js +43 -0
- package/imports/GLUtils.js +67 -0
- package/imports/Instance.js +187 -0
- package/imports/InstancedTexture.js +856 -0
- package/imports/Physics.js +242 -0
- package/imports/Scene.js +79 -0
- package/imports/Shaders.js +165 -0
- package/imports/Shapes.js +129 -0
- package/imports/Storage.js +63 -0
- package/imports/Texture.js +67 -0
- package/imports/Time.js +28 -0
- package/imports/Transform.js +59 -0
- package/imports/components/BoxCollider.js +67 -0
- package/imports/components/BoxColliderDebug.js +38 -0
- package/imports/components/CircleCollider.js +67 -0
- package/imports/components/CircleColliderDebug.js +36 -0
- package/imports/components/Collider.js +51 -0
- package/imports/components/GameObject.js +160 -0
- package/imports/components/RigidBody.js +169 -0
- package/imports/lights/DirectionalLight.js +68 -0
- package/imports/lights/PointLight.js +17 -0
- package/imports/managers/AudioManager.js +146 -0
- package/imports/managers/CameraManager.js +60 -0
- package/imports/managers/EventManager.js +479 -0
- package/imports/managers/GLManager.js +65 -0
- package/imports/managers/IDManager.js +32 -0
- package/imports/managers/SceneManager.js +27 -0
- package/imports/managers/ShaderManager.js +133 -0
- package/imports/particlesystem/Particle.js +75 -0
- package/imports/particlesystem/ParticleSettings.js +49 -0
- package/imports/particlesystem/Particles.js +226 -0
- package/index.js +67 -0
- package/package.json +38 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as planck from "planck";
|
|
2
|
+
/**
|
|
3
|
+
* @class Physics
|
|
4
|
+
* @description Represents the physics engine
|
|
5
|
+
* @param {number} gravity - The gravity of the physics engine
|
|
6
|
+
* @param {number} scale - The scale of the physics engine
|
|
7
|
+
* @param {number} velocityThreshold - The velocity threshold of the physics engine
|
|
8
|
+
*/
|
|
9
|
+
declare class Physics {
|
|
10
|
+
world: planck.World;
|
|
11
|
+
gravity: number;
|
|
12
|
+
scale: number;
|
|
13
|
+
constructor(gravity: number, scale: number, velocityThreshold?: number);
|
|
14
|
+
/**
|
|
15
|
+
* @method createBody
|
|
16
|
+
* @description Creates a body in the physics engine
|
|
17
|
+
* @param {string} type - The type of the body
|
|
18
|
+
* @param {Vector2} position - The position of the body
|
|
19
|
+
* @param {boolean} fixedRotation - Whether the body should have a fixed rotation
|
|
20
|
+
* @param {boolean} attachFixture - Whether the body should have a fixture
|
|
21
|
+
* @param {Vector2} fixtureSize - The size of the fixture
|
|
22
|
+
* @param {number} density - The density of the fixture
|
|
23
|
+
* @param {number} friction - The friction of the fixture
|
|
24
|
+
* @param {number} restitution - The restitution of the fixture
|
|
25
|
+
* @returns {Body} - The body
|
|
26
|
+
*/
|
|
27
|
+
createBody(type: string, position?: Vector2, fixedRotation?: boolean, attachFixture?: boolean, fixtureSize?: Vector2, density?: number, friction?: number, restitution?: number): planck.Body;
|
|
28
|
+
/**
|
|
29
|
+
* @method onCollisionEnter
|
|
30
|
+
* @description Handles the collision enter event
|
|
31
|
+
* @param {Function} callback - The callback function to handle the collision enter event
|
|
32
|
+
*/
|
|
33
|
+
onCollisionEnter(callback: (bodyA: planck.Body, bodyB: planck.Body, contact: planck.Contact) => void): void;
|
|
34
|
+
/**
|
|
35
|
+
* @method onCollisionExit
|
|
36
|
+
* @description Handles the collision exit event
|
|
37
|
+
* @param {Function} callback - The callback function to handle the collision exit event
|
|
38
|
+
*/
|
|
39
|
+
onCollisionExit(callback: (bodyA: planck.Body, bodyB: planck.Body, contact: planck.Contact) => void): void;
|
|
40
|
+
/**
|
|
41
|
+
* @method process
|
|
42
|
+
* @description Processes the physics engine
|
|
43
|
+
* @param {number} dt - The delta time
|
|
44
|
+
*/
|
|
45
|
+
process(dt: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* @method clear
|
|
48
|
+
* @description Clears the physics engine objects and resets the gravity
|
|
49
|
+
*/
|
|
50
|
+
clear(): void;
|
|
51
|
+
/**
|
|
52
|
+
* @method getGravity
|
|
53
|
+
* @description Returns the gravity of the physics engine
|
|
54
|
+
* @returns {number} - The gravity of the physics engine
|
|
55
|
+
*/
|
|
56
|
+
getGravity(): number;
|
|
57
|
+
/**
|
|
58
|
+
* @method getScale
|
|
59
|
+
* @description Returns the scale of the physics engine
|
|
60
|
+
* @returns {number} - The scale of the physics engine
|
|
61
|
+
*/
|
|
62
|
+
getScale(): number;
|
|
63
|
+
/**
|
|
64
|
+
* @method scheduleAction
|
|
65
|
+
* @description Schedules an action to be executed as soon as possible
|
|
66
|
+
* @param {Function} callback - The callback function to execute
|
|
67
|
+
*/
|
|
68
|
+
static scheduleAction(callback: () => void): void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @class Vector2
|
|
72
|
+
* @description Represents a 2D vector
|
|
73
|
+
* @param {number} x - The x coordinate of the vector
|
|
74
|
+
* @param {number} y - The y coordinate of the vector
|
|
75
|
+
*/
|
|
76
|
+
declare class Vector2 {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
constructor(x: number, y: number);
|
|
80
|
+
/**
|
|
81
|
+
* @method equals
|
|
82
|
+
* @description Checks if the vector is equal to another vector
|
|
83
|
+
* @param {Vector2} other - The other vector
|
|
84
|
+
* @returns {boolean} - True if the vector is equal to the other vector
|
|
85
|
+
*/
|
|
86
|
+
equals(other: Vector2): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* @method getX
|
|
89
|
+
* @description Returns the x coordinate of the vector
|
|
90
|
+
* @returns {number} - The x coordinate of the vector
|
|
91
|
+
*/
|
|
92
|
+
getX(): number;
|
|
93
|
+
/**
|
|
94
|
+
* @method getY
|
|
95
|
+
* @description Returns the y coordinate of the vector
|
|
96
|
+
* @returns {number} - The y coordinate of the vector
|
|
97
|
+
*/
|
|
98
|
+
getY(): number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @class Vector3
|
|
102
|
+
* @description Represents a 3D vector
|
|
103
|
+
* @param {number} x - The x coordinate of the vector
|
|
104
|
+
* @param {number} y - The y coordinate of the vector
|
|
105
|
+
* @param {number} z - The z coordinate of the vector
|
|
106
|
+
*/
|
|
107
|
+
declare class Vector3 {
|
|
108
|
+
x: number;
|
|
109
|
+
y: number;
|
|
110
|
+
z: number;
|
|
111
|
+
constructor(x: number, y: number, z: number);
|
|
112
|
+
/**
|
|
113
|
+
* @method equals
|
|
114
|
+
* @description Checks if the vector is equal to another vector
|
|
115
|
+
* @param {Vector3} other - The other vector
|
|
116
|
+
* @returns {boolean} - True if the vector is equal to the other vector
|
|
117
|
+
*/
|
|
118
|
+
equals(other: Vector3): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* @method getX
|
|
121
|
+
* @description Returns the x coordinate of the vector
|
|
122
|
+
* @returns {number} - The x coordinate of the vector
|
|
123
|
+
*/
|
|
124
|
+
getX(): number;
|
|
125
|
+
/**
|
|
126
|
+
* @method getY
|
|
127
|
+
* @description Returns the y coordinate of the vector
|
|
128
|
+
* @returns {number} - The y coordinate of the vector
|
|
129
|
+
*/
|
|
130
|
+
getY(): number;
|
|
131
|
+
/**
|
|
132
|
+
* @method getZ
|
|
133
|
+
* @description Returns the z coordinate of the vector
|
|
134
|
+
* @returns {number} - The z coordinate of the vector
|
|
135
|
+
*/
|
|
136
|
+
getZ(): number;
|
|
137
|
+
}
|
|
138
|
+
export { Physics, Vector2, Vector3 };
|
|
139
|
+
//# sourceMappingURL=Physics.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import GameObject from "./components/GameObject";
|
|
2
|
+
/**
|
|
3
|
+
* @class Scene
|
|
4
|
+
* @description Represents a scene
|
|
5
|
+
* @param {Array} objects - The objects in the scene
|
|
6
|
+
*/
|
|
7
|
+
declare class Scene {
|
|
8
|
+
objects: GameObject[];
|
|
9
|
+
constructor(objects?: GameObject[]);
|
|
10
|
+
/**
|
|
11
|
+
* @method add
|
|
12
|
+
* @description Adds an object to the scene
|
|
13
|
+
* @param {GameObject} object - The object to add
|
|
14
|
+
*/
|
|
15
|
+
add(object: GameObject): void;
|
|
16
|
+
/**
|
|
17
|
+
* @method remove
|
|
18
|
+
* @description Removes an object from the scene
|
|
19
|
+
* @param {GameObject} object - The object to remove
|
|
20
|
+
*/
|
|
21
|
+
remove(object: GameObject): void;
|
|
22
|
+
/**
|
|
23
|
+
* @method setIsActive
|
|
24
|
+
* @description Sets the active state of the scene
|
|
25
|
+
* @param {boolean} bool - The active state
|
|
26
|
+
*/
|
|
27
|
+
setIsActive(bool: boolean): void;
|
|
28
|
+
/**
|
|
29
|
+
* @method setActiveRecursive
|
|
30
|
+
* @description Sets the active state of the scene recursively
|
|
31
|
+
* @param {Object} object - The object to set the active state of
|
|
32
|
+
* @param {boolean} bool - The active state
|
|
33
|
+
*/
|
|
34
|
+
setActiveRecursive(object: GameObject, bool: boolean): void;
|
|
35
|
+
[Symbol.iterator](): Iterator<GameObject>;
|
|
36
|
+
forEach(callback: (object: GameObject) => void): void;
|
|
37
|
+
}
|
|
38
|
+
export default Scene;
|
|
39
|
+
//# sourceMappingURL=Scene.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Drawable from "./Drawable";
|
|
2
|
+
/**
|
|
3
|
+
* @class Square2D
|
|
4
|
+
* @description Represents a square 2D shape
|
|
5
|
+
*/
|
|
6
|
+
declare class Square2D extends Drawable {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @class Triangle2D
|
|
11
|
+
* @description Represents a triangle 2D shape
|
|
12
|
+
*/
|
|
13
|
+
declare class Triangle2D extends Drawable {
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @class Circle2D
|
|
18
|
+
* @description Represents a circle 2D shape
|
|
19
|
+
* @param {number} segments - The number of segments to use to draw the circle
|
|
20
|
+
*/
|
|
21
|
+
declare class Circle2D extends Drawable {
|
|
22
|
+
constructor(segments?: number);
|
|
23
|
+
}
|
|
24
|
+
export { Square2D, Triangle2D, Circle2D };
|
|
25
|
+
//# sourceMappingURL=Shapes.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class Storage
|
|
3
|
+
* @description Manages the storage of the game
|
|
4
|
+
*/
|
|
5
|
+
declare class Storage {
|
|
6
|
+
/**
|
|
7
|
+
* @method writeToLocalStorage
|
|
8
|
+
* @description Writes to local storage
|
|
9
|
+
* @param {string} key - The key to write to
|
|
10
|
+
* @param {any} value - The value to write to
|
|
11
|
+
*/
|
|
12
|
+
static writeToLocalStorage(key: string, value: any): void;
|
|
13
|
+
/**
|
|
14
|
+
* @method readFromLocalStorage
|
|
15
|
+
* @description Reads from local storage
|
|
16
|
+
* @param {string} key - The key to read from
|
|
17
|
+
* @returns {any} - The value read from local storage
|
|
18
|
+
*/
|
|
19
|
+
static readFromLocalStorage(key: string): any;
|
|
20
|
+
/**
|
|
21
|
+
* @method clearLocalStorage
|
|
22
|
+
* @description Clears local storage
|
|
23
|
+
*/
|
|
24
|
+
static clearLocalStorage(): void;
|
|
25
|
+
/**
|
|
26
|
+
* @method writeToSessionStorage
|
|
27
|
+
* @description Writes to session storage
|
|
28
|
+
* @param {string} key - The key to write to
|
|
29
|
+
* @param {any} value - The value to write to
|
|
30
|
+
*/
|
|
31
|
+
static writeToSessionStorage(key: string, value: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* @method readFromSessionStorage
|
|
34
|
+
* @description Reads from session storage
|
|
35
|
+
* @param {string} key - The key to read from
|
|
36
|
+
* @returns {any} - The value read from session storage
|
|
37
|
+
*/
|
|
38
|
+
static readFromSessionStorage(key: string): any;
|
|
39
|
+
/**
|
|
40
|
+
* @method clearSessionStorage
|
|
41
|
+
* @description Clears session storage
|
|
42
|
+
*/
|
|
43
|
+
static clearSessionStorage(): void;
|
|
44
|
+
}
|
|
45
|
+
export default Storage;
|
|
46
|
+
//# sourceMappingURL=Storage.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Drawable from "./Drawable";
|
|
2
|
+
/**
|
|
3
|
+
* @class Texture
|
|
4
|
+
* @description Represents a texture component
|
|
5
|
+
* @param {string} texturePath - The path to the texture
|
|
6
|
+
* @param {number} frameWidth - The width of the frame
|
|
7
|
+
* @param {number} frameHeight - The height of the frame
|
|
8
|
+
* @param {number} framesPerRow - The number of frames per row
|
|
9
|
+
* @param {number} totalFrames - The total number of frames
|
|
10
|
+
* @param {number} animationSpeed - The speed of the animation
|
|
11
|
+
* @param {boolean} autoPlay - Whether the animation should play automatically
|
|
12
|
+
* @param {boolean} pixelart - Whether the texture is a pixel art texture
|
|
13
|
+
* @param {boolean} useLighting - Whether the texture should react to lighting
|
|
14
|
+
*/
|
|
15
|
+
declare class Texture extends Drawable {
|
|
16
|
+
constructor(texturePath?: string, frameWidth?: number, frameHeight?: number, framesPerRow?: number, totalFrames?: number, animationSpeed?: number, autoPlay?: boolean, pixelart?: boolean, useLighting?: boolean);
|
|
17
|
+
}
|
|
18
|
+
export default Texture;
|
|
19
|
+
//# sourceMappingURL=Texture.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class Time
|
|
3
|
+
* @description Represents the time
|
|
4
|
+
* @param {number} deltaTime - The delta time
|
|
5
|
+
*/
|
|
6
|
+
declare class Time {
|
|
7
|
+
static deltaTime: number;
|
|
8
|
+
/**
|
|
9
|
+
* @method getDeltaTime
|
|
10
|
+
* @description Returns the delta time
|
|
11
|
+
* @returns {number} - The delta time
|
|
12
|
+
*/
|
|
13
|
+
static getDeltaTime(): number;
|
|
14
|
+
/**
|
|
15
|
+
* @method setDeltaTime
|
|
16
|
+
* @description Sets the delta time
|
|
17
|
+
* @param {number} deltaTime - The delta time
|
|
18
|
+
*/
|
|
19
|
+
static setDeltaTime(deltaTime: number): void;
|
|
20
|
+
}
|
|
21
|
+
export default Time;
|
|
22
|
+
//# sourceMappingURL=Time.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from "./Physics";
|
|
2
|
+
/**
|
|
3
|
+
* @class Transform
|
|
4
|
+
* @description Represents a transform
|
|
5
|
+
* @param {Vector3} position - The position of the transform
|
|
6
|
+
* @param {number} rotation - The rotation of the transform
|
|
7
|
+
* @param {Vector2} scale - The scale of the transform
|
|
8
|
+
*/
|
|
9
|
+
declare class Transform {
|
|
10
|
+
position: Vector3;
|
|
11
|
+
rotation: number;
|
|
12
|
+
scale: Vector2;
|
|
13
|
+
constructor(position: Vector3, rotation: number, scale: Vector2);
|
|
14
|
+
/**
|
|
15
|
+
* @method equals
|
|
16
|
+
* @description Checks if the transform is equal to another transform
|
|
17
|
+
* @param {Transform} other - The other transform
|
|
18
|
+
* @returns {boolean} - True if the transform is equal to the other transform
|
|
19
|
+
*/
|
|
20
|
+
equals(other: Transform): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @method getPosition
|
|
23
|
+
* @description Returns the position of the transform
|
|
24
|
+
* @returns {Vector3} - The position of the transform
|
|
25
|
+
*/
|
|
26
|
+
getPosition(): Vector3;
|
|
27
|
+
/**
|
|
28
|
+
* @method getRotation
|
|
29
|
+
* @description Returns the rotation of the transform
|
|
30
|
+
* @returns {number} - The rotation of the transform
|
|
31
|
+
*/
|
|
32
|
+
getRotation(): number;
|
|
33
|
+
/**
|
|
34
|
+
* @method getScale
|
|
35
|
+
* @description Returns the scale of the transform
|
|
36
|
+
* @returns {Vector2} - The scale of the transform
|
|
37
|
+
*/
|
|
38
|
+
getScale(): Vector2;
|
|
39
|
+
}
|
|
40
|
+
export default Transform;
|
|
41
|
+
//# sourceMappingURL=Transform.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as planck from "planck";
|
|
2
|
+
import BoxColliderDebug from "./BoxColliderDebug";
|
|
3
|
+
import Collider from "./Collider";
|
|
4
|
+
import { Vector2 } from "../Physics";
|
|
5
|
+
import RigidBody from "./RigidBody";
|
|
6
|
+
import GameObject from "./GameObject";
|
|
7
|
+
/**
|
|
8
|
+
* @class BoxCollider
|
|
9
|
+
* @extends Collider
|
|
10
|
+
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
11
|
+
* @param {Vector2} fixtureSize - The size of the collider
|
|
12
|
+
* @param {number} density - The density of the collider
|
|
13
|
+
* @param {number} friction - The friction of the collider
|
|
14
|
+
* @param {number} restitution - The restitution of the collider
|
|
15
|
+
* @param {boolean} isSensor - Whether the collider is a sensor
|
|
16
|
+
* @param {GameObject} parentObject - The parent object of the collider
|
|
17
|
+
*/
|
|
18
|
+
declare class BoxCollider extends Collider {
|
|
19
|
+
collider: planck.Fixture;
|
|
20
|
+
fixtureSize: Vector2;
|
|
21
|
+
name: string;
|
|
22
|
+
debugShape: BoxColliderDebug;
|
|
23
|
+
constructor(rigidbody: RigidBody, fixtureSize: Vector2, density: number, friction: number, restitution: number, isSensor?: boolean, parentObject?: GameObject | null);
|
|
24
|
+
/**
|
|
25
|
+
* @method showDebugShape
|
|
26
|
+
* @description Shows the debug shape of the collider
|
|
27
|
+
*/
|
|
28
|
+
showDebugShape(): void;
|
|
29
|
+
/**
|
|
30
|
+
* @method hideDebugShape
|
|
31
|
+
* @description Hides the debug shape of the collider
|
|
32
|
+
*/
|
|
33
|
+
hideDebugShape(): void;
|
|
34
|
+
/**
|
|
35
|
+
* @method getFixtureSize
|
|
36
|
+
* @description Returns the size of the collider
|
|
37
|
+
*/
|
|
38
|
+
getFixtureSize(): Vector2;
|
|
39
|
+
}
|
|
40
|
+
export default BoxCollider;
|
|
41
|
+
//# sourceMappingURL=BoxCollider.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Color from "../Color";
|
|
2
|
+
import { Physics } from "../Physics";
|
|
3
|
+
import GameObject from "./GameObject";
|
|
4
|
+
import RigidBody from "./RigidBody";
|
|
5
|
+
/**
|
|
6
|
+
* @class BoxColliderDebug
|
|
7
|
+
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
8
|
+
* @param {Color} color - The color of the collider
|
|
9
|
+
*/
|
|
10
|
+
declare class BoxColliderDebug {
|
|
11
|
+
rigidbody: RigidBody;
|
|
12
|
+
physics: Physics;
|
|
13
|
+
scale: number;
|
|
14
|
+
color: Color;
|
|
15
|
+
gameObject: GameObject;
|
|
16
|
+
constructor(rigidbody: RigidBody, color?: Color | null);
|
|
17
|
+
}
|
|
18
|
+
export default BoxColliderDebug;
|
|
19
|
+
//# sourceMappingURL=BoxColliderDebug.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as planck from "planck";
|
|
2
|
+
import CircleColliderDebug from "./CircleColliderDebug";
|
|
3
|
+
import Collider from "./Collider";
|
|
4
|
+
import RigidBody from "./RigidBody";
|
|
5
|
+
/**
|
|
6
|
+
* @class CircleCollider
|
|
7
|
+
* @extends Collider
|
|
8
|
+
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
9
|
+
* @param {number} radius - The radius of the collider
|
|
10
|
+
* @param {number} density - The density of the collider
|
|
11
|
+
* @param {number} friction - The friction of the collider
|
|
12
|
+
* @param {number} restitution - The restitution of the collider
|
|
13
|
+
* @param {boolean} isSensor - Whether the collider is a sensor
|
|
14
|
+
* @param {GameObject} parentObject - The parent object of the collider
|
|
15
|
+
*/
|
|
16
|
+
declare class CircleCollider extends Collider {
|
|
17
|
+
radius: number;
|
|
18
|
+
debugShape: CircleColliderDebug;
|
|
19
|
+
collider: planck.Fixture;
|
|
20
|
+
name: string;
|
|
21
|
+
constructor(rigidbody: RigidBody, radius: number, density: number, friction: number, restitution: number, isSensor?: boolean, parentObject?: null);
|
|
22
|
+
/**
|
|
23
|
+
* @method showDebugShape
|
|
24
|
+
* @description Shows the debug shape of the collider
|
|
25
|
+
*/
|
|
26
|
+
showDebugShape(): void;
|
|
27
|
+
/**
|
|
28
|
+
* @method hideDebugShape
|
|
29
|
+
* @description Hides the debug shape of the collider
|
|
30
|
+
*/
|
|
31
|
+
hideDebugShape(): void;
|
|
32
|
+
/**
|
|
33
|
+
* @method getRadius
|
|
34
|
+
* @description Returns the radius of the collider
|
|
35
|
+
*/
|
|
36
|
+
getRadius(): number;
|
|
37
|
+
}
|
|
38
|
+
export default CircleCollider;
|
|
39
|
+
//# sourceMappingURL=CircleCollider.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Color from "../Color";
|
|
2
|
+
import { Physics } from "../Physics";
|
|
3
|
+
import GameObject from "./GameObject";
|
|
4
|
+
import RigidBody from "./RigidBody";
|
|
5
|
+
/**
|
|
6
|
+
* @class CircleColliderDebug
|
|
7
|
+
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
8
|
+
* @param {Color} color - The color of the collider
|
|
9
|
+
*/
|
|
10
|
+
declare class CircleColliderDebug {
|
|
11
|
+
rigidbody: RigidBody;
|
|
12
|
+
physics: Physics;
|
|
13
|
+
scale: number;
|
|
14
|
+
color: Color;
|
|
15
|
+
gameObject: GameObject;
|
|
16
|
+
constructor(rigidbody: RigidBody, color?: Color | null);
|
|
17
|
+
}
|
|
18
|
+
export default CircleColliderDebug;
|
|
19
|
+
//# sourceMappingURL=CircleColliderDebug.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Vector2 } from "../Physics";
|
|
2
|
+
import GameObject from "./GameObject";
|
|
3
|
+
import RigidBody from "./RigidBody";
|
|
4
|
+
import * as planck from "planck";
|
|
5
|
+
/**
|
|
6
|
+
* @class Collider
|
|
7
|
+
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
8
|
+
* @param {boolean} isSensor - Whether the collider is a sensor
|
|
9
|
+
* @param {GameObject} parentObject - The parent object of the collider
|
|
10
|
+
*/
|
|
11
|
+
declare class Collider {
|
|
12
|
+
rigidbody: RigidBody;
|
|
13
|
+
parentObject: GameObject | null;
|
|
14
|
+
isSensor: boolean;
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
collider: planck.Fixture | null;
|
|
18
|
+
fixtureSize: Vector2 | null;
|
|
19
|
+
radius: number | null;
|
|
20
|
+
constructor(rigidbody: RigidBody, isSensor?: boolean, parentObject?: GameObject | null);
|
|
21
|
+
/**
|
|
22
|
+
* @method getRigidBody
|
|
23
|
+
* @description Returns the rigidbody of the collider
|
|
24
|
+
*/
|
|
25
|
+
getRigidBody(): RigidBody;
|
|
26
|
+
/**
|
|
27
|
+
* @method setParent
|
|
28
|
+
* @description Sets the parent object of the collider
|
|
29
|
+
*/
|
|
30
|
+
setParent(parent: GameObject): void;
|
|
31
|
+
/**
|
|
32
|
+
* @method getCollider
|
|
33
|
+
* @description Returns the collider
|
|
34
|
+
*/
|
|
35
|
+
getCollider(): planck.Fixture | null;
|
|
36
|
+
/**
|
|
37
|
+
* @method getFixtureSize
|
|
38
|
+
* @description Returns the size of the collider
|
|
39
|
+
*/
|
|
40
|
+
getFixtureSize(): Vector2 | null;
|
|
41
|
+
/**
|
|
42
|
+
* @method getRadius
|
|
43
|
+
* @description Returns the radius of the collider
|
|
44
|
+
*/
|
|
45
|
+
getRadius(): number | null;
|
|
46
|
+
/**
|
|
47
|
+
* @method getParent
|
|
48
|
+
* @description Returns the parent object of the collider
|
|
49
|
+
*/
|
|
50
|
+
getParent(): GameObject | null;
|
|
51
|
+
}
|
|
52
|
+
export default Collider;
|
|
53
|
+
//# sourceMappingURL=Collider.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from "../Physics";
|
|
2
|
+
import Transform from "../Transform";
|
|
3
|
+
import RigidBody from "./RigidBody";
|
|
4
|
+
import { mat4 } from "gl-matrix";
|
|
5
|
+
/**
|
|
6
|
+
* @class GameObject
|
|
7
|
+
* @param {string} name - The name of the game object
|
|
8
|
+
* @param {Vector3} position - The position of the game object
|
|
9
|
+
* @param {number} rotation - The rotation of the game object
|
|
10
|
+
* @param {Vector2} scale - The scale of the game object
|
|
11
|
+
*/
|
|
12
|
+
declare class GameObject {
|
|
13
|
+
name: string;
|
|
14
|
+
components: any[];
|
|
15
|
+
id: string;
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
transform: Transform;
|
|
18
|
+
opacity: number;
|
|
19
|
+
constructor(name: string, position?: Vector3, rotation?: number, scale?: Vector2);
|
|
20
|
+
/**
|
|
21
|
+
* @method addComponent
|
|
22
|
+
* @description Adds a component to the game object
|
|
23
|
+
* @param {Component} componentInstance - The component to add
|
|
24
|
+
*/
|
|
25
|
+
addComponent(componentInstance: any): void;
|
|
26
|
+
/**
|
|
27
|
+
* @method removeComponent
|
|
28
|
+
* @description Removes a component from the game object
|
|
29
|
+
* @param {Component} component - The component to remove
|
|
30
|
+
*/
|
|
31
|
+
removeComponent(component: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* @method setIsActive
|
|
34
|
+
* @description Sets the active state of the game object
|
|
35
|
+
* @param {boolean} bool - The active state
|
|
36
|
+
*/
|
|
37
|
+
setIsActive(bool: boolean): void;
|
|
38
|
+
/**
|
|
39
|
+
* @method setOpacity
|
|
40
|
+
* @description Sets the opacity of the game object (0..1)
|
|
41
|
+
* @param {number} value - The opacity value between 0 and 1
|
|
42
|
+
*/
|
|
43
|
+
setOpacity(value: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* @method getOpacity
|
|
46
|
+
* @description Gets the opacity of the game object
|
|
47
|
+
* @returns {number} - The opacity value between 0 and 1
|
|
48
|
+
*/
|
|
49
|
+
getOpacity(): number;
|
|
50
|
+
/**
|
|
51
|
+
* @method getComponent
|
|
52
|
+
* @description Returns a component from the game object
|
|
53
|
+
* @param {Component} componentType - The type of component to return
|
|
54
|
+
*/
|
|
55
|
+
getComponent(componentType: any): any;
|
|
56
|
+
/**
|
|
57
|
+
* @method getRigidBodyAtPosition
|
|
58
|
+
* @description Returns the rigidbody at a position
|
|
59
|
+
* @param {Vector2} position - The position to check
|
|
60
|
+
*/
|
|
61
|
+
getRigidBodyAtPosition(position: Vector2): RigidBody | null;
|
|
62
|
+
/**
|
|
63
|
+
* @method draw
|
|
64
|
+
* @description Draws the game object
|
|
65
|
+
* @param {Matrix4} globalViewMatrix - The global view matrix
|
|
66
|
+
* @param {WebGLUniformLocation} uniformLocation - The uniform location
|
|
67
|
+
* @param {number} currentTime - The current time
|
|
68
|
+
*/
|
|
69
|
+
draw(globalViewMatrix: mat4, uniformLocation: WebGLUniformLocation, currentTime: number): void;
|
|
70
|
+
}
|
|
71
|
+
export default GameObject;
|
|
72
|
+
//# sourceMappingURL=GameObject.d.ts.map
|