emeraldengine 2.2.1 → 3.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.
Files changed (208) hide show
  1. package/README.md +2198 -968
  2. package/dist/types/index.d.ts +75 -32
  3. package/dist/types/src/Animator.d.ts +50 -0
  4. package/dist/types/{BitmapText.d.ts → src/BitmapText.d.ts} +19 -21
  5. package/dist/types/src/Camera.d.ts +122 -0
  6. package/dist/types/src/CameraController.d.ts +107 -0
  7. package/dist/types/src/CanvasText.d.ts +91 -0
  8. package/dist/types/src/CollisionLayers.d.ts +58 -0
  9. package/dist/types/{Color.d.ts → src/Color.d.ts} +6 -6
  10. package/dist/types/src/Coroutine.d.ts +111 -0
  11. package/dist/types/src/DebugOverlay.d.ts +86 -0
  12. package/dist/types/src/Drawable.d.ts +271 -0
  13. package/dist/types/src/Easing.d.ts +22 -0
  14. package/dist/types/src/Emerald.d.ts +420 -0
  15. package/dist/types/src/EmeraldDB.d.ts +159 -0
  16. package/dist/types/{FPSCounter.d.ts → src/FPSCounter.d.ts} +1 -3
  17. package/dist/types/src/GLUtils.d.ts +4 -0
  18. package/dist/types/{Instance.d.ts → src/Instance.d.ts} +37 -15
  19. package/dist/types/{InstancedTexture.d.ts → src/InstancedTexture.d.ts} +75 -23
  20. package/dist/types/src/Interpolator.d.ts +66 -0
  21. package/dist/types/src/Material.d.ts +87 -0
  22. package/dist/types/src/MathUtils.d.ts +81 -0
  23. package/dist/types/src/ParticleEmitter.d.ts +131 -0
  24. package/dist/types/src/Physics.d.ts +337 -0
  25. package/dist/types/src/Pool.d.ts +53 -0
  26. package/dist/types/src/PostEffects.d.ts +68 -0
  27. package/dist/types/src/PostProcessor.d.ts +124 -0
  28. package/dist/types/src/RenderTarget.d.ts +56 -0
  29. package/dist/types/src/Scene.d.ts +62 -0
  30. package/dist/types/src/ScreenEffects.d.ts +111 -0
  31. package/dist/types/src/Serializer.d.ts +86 -0
  32. package/dist/types/src/Shaders.d.ts +2 -0
  33. package/dist/types/{Shapes.d.ts → src/Shapes.d.ts} +4 -6
  34. package/dist/types/src/SpatialGrid.d.ts +50 -0
  35. package/dist/types/src/SpriteBatch.d.ts +89 -0
  36. package/dist/types/src/StateMachine.d.ts +59 -0
  37. package/dist/types/src/Storage.d.ts +89 -0
  38. package/dist/types/{Texture.d.ts → src/Texture.d.ts} +3 -4
  39. package/dist/types/src/TextureAtlas.d.ts +55 -0
  40. package/dist/types/src/Tilemap.d.ts +91 -0
  41. package/dist/types/src/Time.d.ts +53 -0
  42. package/dist/types/src/Timer.d.ts +54 -0
  43. package/dist/types/src/Transform.d.ts +94 -0
  44. package/dist/types/src/Tween.d.ts +81 -0
  45. package/dist/types/src/UI.d.ts +121 -0
  46. package/dist/types/src/components/Behaviour.d.ts +71 -0
  47. package/dist/types/{components → src/components}/BoxCollider.d.ts +14 -14
  48. package/dist/types/src/components/BoxColliderDebug.d.ts +15 -0
  49. package/dist/types/{components → src/components}/CircleCollider.d.ts +14 -12
  50. package/dist/types/src/components/CircleColliderDebug.d.ts +15 -0
  51. package/dist/types/src/components/Collider.d.ts +102 -0
  52. package/dist/types/src/components/GameObject.d.ts +135 -0
  53. package/dist/types/src/components/PolygonCollider.d.ts +33 -0
  54. package/dist/types/src/components/RigidBody.d.ts +456 -0
  55. package/dist/types/src/importers/Aseprite.d.ts +79 -0
  56. package/dist/types/src/importers/ForgeLevel.d.ts +97 -0
  57. package/dist/types/src/importers/TiledMap.d.ts +62 -0
  58. package/dist/types/{lights → src/lights}/DirectionalLight.d.ts +7 -9
  59. package/dist/types/{lights → src/lights}/PointLight.d.ts +6 -9
  60. package/dist/types/src/managers/AssetManager.d.ts +116 -0
  61. package/dist/types/src/managers/AudioManager.d.ts +259 -0
  62. package/dist/types/{managers → src/managers}/CameraManager.d.ts +8 -8
  63. package/dist/types/{managers → src/managers}/EventManager.d.ts +46 -32
  64. package/dist/types/src/managers/GLManager.d.ts +84 -0
  65. package/dist/types/src/managers/GLState.d.ts +37 -0
  66. package/dist/types/src/managers/Gamepad.d.ts +102 -0
  67. package/dist/types/src/managers/IDManager.d.ts +31 -0
  68. package/dist/types/src/managers/InputManager.d.ts +381 -0
  69. package/dist/types/src/managers/NetworkManager.d.ts +93 -0
  70. package/dist/types/src/managers/RenderStats.d.ts +34 -0
  71. package/dist/types/src/managers/SceneManager.d.ts +44 -0
  72. package/dist/types/src/managers/ShaderManager.d.ts +55 -0
  73. package/dist/types/src/managers/TextureManager.d.ts +102 -0
  74. package/dist/types/src/particlesystem/Particle.d.ts +64 -0
  75. package/dist/types/{particlesystem → src/particlesystem}/ParticleSettings.d.ts +32 -24
  76. package/dist/types/{particlesystem → src/particlesystem}/Particles.d.ts +20 -12
  77. package/dist/types/src/physics/AABB.d.ts +92 -0
  78. package/dist/types/src/physics/Body.d.ts +435 -0
  79. package/dist/types/src/physics/BodyType.d.ts +6 -0
  80. package/dist/types/src/physics/BroadPhase.d.ts +210 -0
  81. package/dist/types/src/physics/Collision.d.ts +102 -0
  82. package/dist/types/src/physics/Contact.d.ts +206 -0
  83. package/dist/types/src/physics/ContactSolver.d.ts +108 -0
  84. package/dist/types/src/physics/Distance.d.ts +54 -0
  85. package/dist/types/src/physics/DistanceJoint.d.ts +90 -0
  86. package/dist/types/src/physics/Fixture.d.ts +221 -0
  87. package/dist/types/src/physics/Island.d.ts +52 -0
  88. package/dist/types/src/physics/Joint.d.ts +59 -0
  89. package/dist/types/src/physics/Math2D.d.ts +371 -0
  90. package/dist/types/src/physics/RevoluteJoint.d.ts +119 -0
  91. package/dist/types/src/physics/Settings.d.ts +22 -0
  92. package/dist/types/src/physics/Shapes.d.ts +207 -0
  93. package/dist/types/src/physics/TimeOfImpact.d.ts +22 -0
  94. package/dist/types/src/physics/World.d.ts +274 -0
  95. package/dist/types/src/physics/index.d.ts +34 -0
  96. package/index.js +78 -0
  97. package/package.json +73 -60
  98. package/src/Animator.js +95 -0
  99. package/src/BitmapText.js +6 -5
  100. package/src/Camera.js +183 -0
  101. package/src/CameraController.js +192 -0
  102. package/src/CanvasText.js +281 -0
  103. package/src/CollisionLayers.js +86 -0
  104. package/src/Color.js +26 -18
  105. package/src/Coroutine.js +259 -0
  106. package/src/DebugOverlay.js +246 -0
  107. package/src/Drawable.js +842 -582
  108. package/src/Easing.js +57 -0
  109. package/src/Emerald.js +1150 -459
  110. package/src/EmeraldDB.js +328 -0
  111. package/src/FPSCounter.js +43 -43
  112. package/src/GLUtils.js +60 -67
  113. package/src/Instance.js +41 -5
  114. package/src/InstancedTexture.js +308 -127
  115. package/src/Interpolator.js +124 -0
  116. package/src/Material.js +202 -0
  117. package/src/MathUtils.js +134 -0
  118. package/src/ParticleEmitter.js +284 -0
  119. package/src/Physics.js +431 -40
  120. package/src/Pool.js +85 -0
  121. package/src/PostEffects.js +296 -0
  122. package/src/PostProcessor.js +304 -0
  123. package/src/RenderTarget.js +134 -0
  124. package/src/Scene.js +115 -83
  125. package/src/ScreenEffects.js +266 -0
  126. package/src/Serializer.js +131 -0
  127. package/src/Shaders.js +150 -165
  128. package/src/Shapes.js +118 -129
  129. package/src/SpatialGrid.js +111 -0
  130. package/src/SpriteBatch.js +299 -0
  131. package/src/StateMachine.js +82 -0
  132. package/src/Storage.js +175 -47
  133. package/src/Texture.js +58 -67
  134. package/src/TextureAtlas.js +96 -0
  135. package/src/Tilemap.js +274 -0
  136. package/src/Time.js +51 -6
  137. package/src/Timer.js +99 -0
  138. package/src/Transform.js +100 -7
  139. package/src/Tween.js +160 -0
  140. package/src/UI.js +394 -0
  141. package/src/components/Behaviour.js +90 -0
  142. package/src/components/BoxCollider.js +29 -12
  143. package/src/components/BoxColliderDebug.js +3 -4
  144. package/src/components/CircleCollider.js +26 -12
  145. package/src/components/CircleColliderDebug.js +25 -24
  146. package/src/components/Collider.js +150 -34
  147. package/src/components/GameObject.js +130 -21
  148. package/src/components/PolygonCollider.js +55 -0
  149. package/src/components/RigidBody.js +556 -8
  150. package/src/importers/Aseprite.js +142 -0
  151. package/src/importers/ForgeLevel.js +581 -0
  152. package/src/importers/TiledMap.js +158 -0
  153. package/src/lights/DirectionalLight.js +6 -15
  154. package/src/lights/PointLight.js +4 -4
  155. package/src/managers/AssetManager.js +239 -0
  156. package/src/managers/AudioManager.js +565 -146
  157. package/src/managers/EventManager.js +488 -477
  158. package/src/managers/GLManager.js +57 -0
  159. package/src/managers/GLState.js +70 -0
  160. package/src/managers/Gamepad.js +126 -0
  161. package/src/managers/IDManager.js +24 -2
  162. package/src/managers/InputManager.js +905 -0
  163. package/src/managers/NetworkManager.js +178 -0
  164. package/src/managers/RenderStats.js +34 -0
  165. package/src/managers/SceneManager.js +30 -0
  166. package/src/managers/ShaderManager.js +0 -2
  167. package/src/managers/TextureManager.js +218 -0
  168. package/src/particlesystem/Particle.js +82 -7
  169. package/src/particlesystem/ParticleSettings.js +21 -3
  170. package/src/particlesystem/Particles.js +80 -31
  171. package/src/physics/AABB.js +207 -0
  172. package/src/physics/Body.js +862 -0
  173. package/src/physics/BodyType.js +16 -0
  174. package/src/physics/BroadPhase.js +641 -0
  175. package/src/physics/Collision.js +534 -0
  176. package/src/physics/Contact.js +500 -0
  177. package/src/physics/ContactSolver.js +526 -0
  178. package/src/physics/Distance.js +403 -0
  179. package/src/physics/DistanceJoint.js +227 -0
  180. package/src/physics/Fixture.js +346 -0
  181. package/src/physics/Island.js +203 -0
  182. package/src/physics/Joint.js +78 -0
  183. package/src/physics/Math2D.js +573 -0
  184. package/src/physics/RevoluteJoint.js +278 -0
  185. package/src/physics/Settings.js +78 -0
  186. package/src/physics/Shapes.js +549 -0
  187. package/src/physics/TimeOfImpact.js +87 -0
  188. package/src/physics/World.js +731 -0
  189. package/src/physics/index.js +79 -0
  190. package/dist/types/Drawable.d.ts +0 -157
  191. package/dist/types/Emerald.d.ts +0 -73
  192. package/dist/types/GLUtils.d.ts +0 -6
  193. package/dist/types/Physics.d.ts +0 -139
  194. package/dist/types/Scene.d.ts +0 -39
  195. package/dist/types/Shaders.d.ts +0 -4
  196. package/dist/types/Storage.d.ts +0 -46
  197. package/dist/types/Time.d.ts +0 -22
  198. package/dist/types/Transform.d.ts +0 -41
  199. package/dist/types/components/BoxColliderDebug.d.ts +0 -19
  200. package/dist/types/components/CircleColliderDebug.d.ts +0 -19
  201. package/dist/types/components/Collider.d.ts +0 -53
  202. package/dist/types/components/GameObject.d.ts +0 -72
  203. package/dist/types/components/RigidBody.d.ts +0 -104
  204. package/dist/types/managers/AudioManager.d.ts +0 -60
  205. package/dist/types/managers/GLManager.d.ts +0 -47
  206. package/dist/types/managers/IDManager.d.ts +0 -21
  207. package/dist/types/managers/SceneManager.d.ts +0 -22
  208. package/dist/types/particlesystem/Particle.d.ts +0 -42
@@ -0,0 +1,111 @@
1
+ export default Coroutine;
2
+ /**
3
+ * @class Coroutine
4
+ * @description Generator-based sequencing for time-based logic, layered on top of
5
+ * the same per-frame delta the rest of the engine uses. Write a generator that
6
+ * `yield`s instructions, and the runner advances it each frame:
7
+ *
8
+ * - `yield seconds` (a number) -> wait that many seconds
9
+ * - `yield Coroutine.waitFrames(n)` -> wait n frames
10
+ * - `yield Coroutine.waitUntil(fn)` -> wait until fn() is truthy
11
+ * - `yield Coroutine.waitWhile(fn)` -> wait while fn() is truthy
12
+ * - `yield somePromise` -> wait for the promise to resolve
13
+ * - `yield anotherCoroutine` -> wait for a nested coroutine to finish
14
+ * - `yield Coroutine.tween(...)` -> drive a value over time, then continue
15
+ *
16
+ * Coroutines are driven by `Coroutine.update(dt)` (called automatically from
17
+ * `Emerald.drawScene`, so they honor pause/slow-mo via Time.timeScale).
18
+ *
19
+ * @example
20
+ * Coroutine.start(function* () {
21
+ * door.open();
22
+ * yield 1.5; // wait 1.5s
23
+ * yield Coroutine.waitUntil(() => player.isReady);
24
+ * boss.spawn();
25
+ * });
26
+ */
27
+ declare class Coroutine {
28
+ /**
29
+ * @method start
30
+ * @description Starts a coroutine from a generator function (or an existing
31
+ * generator/iterator). Returns a handle with `cancel()` and `done`.
32
+ * @param {GeneratorFunction|Generator} gen - The generator (function) to run
33
+ * @param {...*} args - Arguments forwarded to the generator function
34
+ * @returns {Object} - A handle: { cancel(), done, isRunning() }
35
+ */
36
+ static start(gen: GeneratorFunction | Generator, ...args: any[]): any;
37
+ /**
38
+ * @method waitFrames
39
+ * @description Yieldable that waits a number of frames.
40
+ * @param {number} count - Frames to wait
41
+ */
42
+ static waitFrames(count: number): {
43
+ __coroutine: string;
44
+ count: number;
45
+ };
46
+ /**
47
+ * @method waitUntil
48
+ * @description Yieldable that blocks until the predicate returns truthy.
49
+ * @param {Function} predicate
50
+ */
51
+ static waitUntil(predicate: Function): {
52
+ __coroutine: string;
53
+ predicate: Function;
54
+ };
55
+ /**
56
+ * @method waitWhile
57
+ * @description Yieldable that blocks while the predicate returns truthy.
58
+ * @param {Function} predicate
59
+ */
60
+ static waitWhile(predicate: Function): {
61
+ __coroutine: string;
62
+ predicate: () => boolean;
63
+ };
64
+ /**
65
+ * @method tween
66
+ * @description Yieldable that interpolates from `from` to `to` over `duration`
67
+ * seconds, calling `onUpdate(value)` each frame, then resumes the coroutine.
68
+ * @param {number} from
69
+ * @param {number} to
70
+ * @param {number} duration - Seconds
71
+ * @param {Function} onUpdate - Receives the current value each step
72
+ * @param {Function} [easing] - Optional easing t -> t
73
+ */
74
+ static tween(from: number, to: number, duration: number, onUpdate: Function, easing?: Function): {
75
+ __coroutine: string;
76
+ from: number;
77
+ to: number;
78
+ duration: number;
79
+ onUpdate: Function;
80
+ easing: Function;
81
+ elapsed: number;
82
+ };
83
+ /**
84
+ * @method update
85
+ * @description Advances all running coroutines by dt seconds. Driven by
86
+ * Emerald.drawScene.
87
+ * @param {number} dt - Seconds since the last frame (time-scaled)
88
+ */
89
+ static update(dt: number): void;
90
+ /**
91
+ * @method clearAll
92
+ * @description Cancels and removes every running coroutine.
93
+ */
94
+ static clearAll(): void;
95
+ /**
96
+ * @method count
97
+ * @returns {number} - Number of currently running coroutines
98
+ */
99
+ static count(): number;
100
+ /** @private */
101
+ private static _finish;
102
+ /** @private */
103
+ private static _step;
104
+ /** @private */
105
+ private static _advance;
106
+ /** @private */
107
+ private static _interpret;
108
+ }
109
+ declare namespace Coroutine {
110
+ let _routines: any[];
111
+ }
@@ -0,0 +1,86 @@
1
+ export default DebugOverlay;
2
+ /**
3
+ * @class DebugOverlay
4
+ * @description A DOM panel that profiles the running game: FPS, frame-time stats
5
+ * with a live sparkline graph, object/camera counts, the primary camera's
6
+ * position/zoom, JS heap usage (where available), and any extra metrics you
7
+ * push. It can also toggle physics collider debug shapes on a scene.
8
+ *
9
+ * Call `update(emerald, scene)` each frame; toggle visibility with `setVisible`.
10
+ *
11
+ * @example
12
+ * const debug = new DebugOverlay();
13
+ * // each frame, after drawScene:
14
+ * debug.update(emerald, scene);
15
+ * debug.setMetric("draws", spriteBatch.drawCalls);
16
+ * debug.showColliders(scene, true); // visualize physics colliders
17
+ */
18
+ declare class DebugOverlay {
19
+ constructor(options?: {});
20
+ element: HTMLDivElement;
21
+ /** @private */
22
+ private _graph;
23
+ /** @private */
24
+ private _gctx;
25
+ /** @private */
26
+ private _text;
27
+ /** @private */
28
+ private _last;
29
+ /** @private */
30
+ private _frames;
31
+ /** @private */
32
+ private _accum;
33
+ fps: number;
34
+ /** @private */
35
+ private _frameTimes;
36
+ /** @private */
37
+ private _maxSamples;
38
+ /** @private */
39
+ private _dtMs;
40
+ /** @private */
41
+ private _minMs;
42
+ /** @private */
43
+ private _maxMs;
44
+ /** @private */
45
+ private _avgMs;
46
+ /** @private */
47
+ private _metrics;
48
+ /** @private */
49
+ private _colliderScene;
50
+ /** @private */
51
+ private _collidersShown;
52
+ /**
53
+ * @method setMetric
54
+ * @description Adds/updates a custom metric line shown in the panel.
55
+ * @param {string} key
56
+ * @param {*} value
57
+ */
58
+ setMetric(key: string, value: any): void;
59
+ /**
60
+ * @method update
61
+ * @description Updates the overlay. Pass the engine and current scene.
62
+ * @param {Emerald} emerald
63
+ * @param {Scene} scene
64
+ */
65
+ update(emerald: Emerald, scene: Scene): void;
66
+ /** @private */
67
+ private _drawGraph;
68
+ /**
69
+ * @method showColliders
70
+ * @description Toggles physics collider debug shapes for every RigidBody in a
71
+ * scene's objects (uses the lazy debug shapes on each collider).
72
+ * @param {Scene} scene
73
+ * @param {boolean} show
74
+ */
75
+ showColliders(scene: Scene, show: boolean): void;
76
+ /**
77
+ * @method setVisible
78
+ * @param {boolean} visible
79
+ */
80
+ setVisible(visible: boolean): void;
81
+ /**
82
+ * @method destroy
83
+ * @description Removes the overlay from the DOM.
84
+ */
85
+ destroy(): void;
86
+ }
@@ -0,0 +1,271 @@
1
+ export default Drawable;
2
+ /**
3
+ * @class Drawable
4
+ * @description A class that represents a drawable object
5
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context
6
+ * @param {Object} programInfo - The program information
7
+ * @param {WebGLBuffer} verticesBuffer - The vertices buffer
8
+ * @param {WebGLBuffer} texCoordBuffer - The texture coordinate buffer
9
+ * @param {Array} vertices - The vertices of the object
10
+ * @param {boolean} useTexture - Whether to use a texture
11
+ * @param {string} texturePath - The path to the texture
12
+ * @param {number} frameWidth - The width of the frame
13
+ * @param {number} frameHeight - The height of the frame
14
+ * @param {number} framesPerRow - The number of frames per row
15
+ * @param {number} totalFrames - The total number of frames
16
+ * @param {number} animationSpeed - The speed of the animation
17
+ * @param {boolean} autoplay - Whether to autoplay the animation
18
+ * @param {boolean} pixelart - Whether to use pixel art
19
+ * @param {boolean} useLighting - Whether to use lighting
20
+ */
21
+ declare class Drawable {
22
+ constructor(gl: any, programInfo: any, verticesBuffer: any, texCoordBuffer: any, vertices: any, useTexture: any, texturePath: any, frameWidth?: number, frameHeight?: number, framesPerRow?: number, totalFrames?: number, animationSpeed?: number, autoplay?: boolean, pixelart?: boolean, useLighting?: boolean);
23
+ gl: any;
24
+ programInfo: any;
25
+ id: string;
26
+ verticesBuffer: any;
27
+ texCoordBuffer: any;
28
+ vertices: any;
29
+ color: vec4;
30
+ texturePath: any;
31
+ texture: WebGLTexture;
32
+ useTexture: any;
33
+ pixelart: boolean;
34
+ /** @private */
35
+ private _disposed;
36
+ /** @private */
37
+ private _texRetained;
38
+ frameWidth: number;
39
+ frameHeight: number;
40
+ framesPerRow: number;
41
+ totalFrames: number;
42
+ currentFrame: number;
43
+ animationSpeed: number;
44
+ lastFrameTime: number;
45
+ textureWidth: number;
46
+ textureHeight: number;
47
+ isPlaying: boolean;
48
+ playOnce: boolean;
49
+ originalTexture: WebGLTexture;
50
+ mirrored: boolean;
51
+ flippedY: boolean;
52
+ /** @private */
53
+ private _pivotX;
54
+ /** @private */
55
+ private _pivotY;
56
+ /** @private */
57
+ private _hasPivot;
58
+ animationType: string;
59
+ currentAnimationArray: any[];
60
+ currentAnimationIndex: number;
61
+ shouldRevertAfterPlayingOnce: boolean;
62
+ revertAnimation: any[];
63
+ parentObject: any;
64
+ isActive: boolean;
65
+ isWireframe: boolean;
66
+ callbackFunction: () => void;
67
+ useLighting: boolean;
68
+ /** @private */
69
+ private _objectTransformMatrix;
70
+ /** @private */
71
+ private _finalTransformMatrix;
72
+ /** @private */
73
+ private _lastTexFrame;
74
+ /** @private */
75
+ private _lastMirrored;
76
+ /** @private */
77
+ private _lastFlippedY;
78
+ /** @private */
79
+ private _lastTextureWidth;
80
+ /** @private */
81
+ private _wireframeBuffer;
82
+ blendMode: string;
83
+ /** @private */
84
+ private _region;
85
+ /** @private */
86
+ private _lastRegion;
87
+ material: any;
88
+ /**
89
+ * @method _restoreGL
90
+ * @description Rebuilds this drawable's GPU resources after a WebGL
91
+ * context loss: vertex/texcoord buffers from their kept CPU copies, and a
92
+ * fresh texture pointer from the (re-uploaded) TextureManager cache.
93
+ * Called by GLManager.restoreAll(); not meant for manual use.
94
+ * @private
95
+ */
96
+ private _restoreGL;
97
+ /**
98
+ * @method setMaterial
99
+ * @description Assigns a custom Material (fragment shader) to this drawable,
100
+ * or pass null to revert to the standard shader.
101
+ * @param {Material|null} material
102
+ */
103
+ setMaterial(material: Material | null): void;
104
+ /**
105
+ * @method setBlendMode
106
+ * @description Sets the blend mode ("normal", "additive", "multiply").
107
+ * @param {string} mode - The blend mode
108
+ */
109
+ setBlendMode(mode: string): void;
110
+ /**
111
+ * @method setRegion
112
+ * @description Sets a normalized UV sub-rect (for atlas frames). Values are
113
+ * 0..1 with top-left origin. Pass nothing to clear.
114
+ */
115
+ setRegion(left: any, top: any, right: any, bottom: any): void;
116
+ /**
117
+ * @method setFlipX
118
+ * @description Horizontally mirrors the sprite (e.g. to face left/right)
119
+ * without touching the GameObject's scale.
120
+ * @param {boolean} flip
121
+ */
122
+ setFlipX(flip: boolean): void;
123
+ /**
124
+ * @method setFlipY
125
+ * @description Vertically mirrors the sprite.
126
+ * @param {boolean} flip
127
+ */
128
+ setFlipY(flip: boolean): void;
129
+ /**
130
+ * @method getFlipX
131
+ * @returns {boolean}
132
+ */
133
+ getFlipX(): boolean;
134
+ /**
135
+ * @method getFlipY
136
+ * @returns {boolean}
137
+ */
138
+ getFlipY(): boolean;
139
+ /**
140
+ * @method setPivot
141
+ * @description Sets the sprite's origin in normalized local space, where
142
+ * (0,0) is the center (default), x runs -1 (left) .. 1 (right) and y runs
143
+ * -1 (bottom) .. 1 (top). The chosen point is what sits on the GameObject's
144
+ * position and acts as the rotation/scale center. Call with no args to reset
145
+ * to centered.
146
+ * @param {number} [x=0]
147
+ * @param {number} [y=0]
148
+ */
149
+ setPivot(x?: number, y?: number): void;
150
+ /**
151
+ * @method setAnchor
152
+ * @description Convenience wrapper around setPivot using 0..1 anchor
153
+ * coordinates with a top-left origin (CSS-style): (0.5,0.5) = center,
154
+ * (0.5,1) = bottom-center, (0,0) = top-left.
155
+ * @param {number} [ax=0.5]
156
+ * @param {number} [ay=0.5]
157
+ */
158
+ setAnchor(ax?: number, ay?: number): void;
159
+ /** @private */
160
+ private _applyBlend;
161
+ /** @private */
162
+ private _restoreBlend;
163
+ /**
164
+ * @method setIsWireframe
165
+ * @description Sets the wireframe mode
166
+ * @param {boolean} bool - Whether to enable wireframe mode
167
+ */
168
+ setIsWireframe(bool: boolean): void;
169
+ /**
170
+ * @method setUseLighting
171
+ * @description Sets the lighting mode
172
+ * @param {boolean} useLighting - Whether to enable lighting reaction
173
+ */
174
+ setUseLighting(useLighting: boolean): void;
175
+ /**
176
+ * @method setIsActive
177
+ * @description Sets the active state
178
+ * @param {boolean} bool - Whether to enable the active state
179
+ */
180
+ setIsActive(bool: boolean): void;
181
+ /**
182
+ * @method setParent
183
+ * @description Sets the parent object
184
+ * @param {Object} parent - The parent object
185
+ */
186
+ setParent(parent: any): void;
187
+ /**
188
+ * @method getParent
189
+ * @description Gets the parent object
190
+ * @returns {Object} - The parent object
191
+ */
192
+ getParent(): any;
193
+ /**
194
+ * @method setColor
195
+ * @description Sets the color of the object
196
+ * @param {Color} color - The color to set
197
+ */
198
+ setColor(color: Color): void;
199
+ /**
200
+ * @method initTexture
201
+ * @description Initializes the texture
202
+ */
203
+ initTexture(): Promise<void>;
204
+ /**
205
+ * @method dispose
206
+ * @description Frees this drawable's GPU resources: its vertex/texcoord
207
+ * buffers and its reference on the shared texture (the GL texture itself is
208
+ * deleted when the last drawable using it is disposed). Call it when the
209
+ * owning object is permanently removed. GameObject.destroy() and
210
+ * Scene.remove(obj, { dispose: true }) do it for you. Safe to call twice.
211
+ */
212
+ dispose(): void;
213
+ /**
214
+ * @method updateAnimation
215
+ * @description Updates the animation
216
+ * @param {number} currentTime - The current time
217
+ */
218
+ updateAnimation(currentTime: number): void;
219
+ /**
220
+ * @method getAnimation
221
+ * @description Gets the animation
222
+ * @returns {Array} - The animation
223
+ */
224
+ getAnimation(): any[];
225
+ /**
226
+ * @method playAnimation
227
+ * @description Plays an animation
228
+ * @param {Array} animation - The animation to play
229
+ * @param {number} animationSpeed - The speed of the animation
230
+ */
231
+ playAnimation(animation: any[], animationSpeed?: number): void;
232
+ /**
233
+ * @method setFrame
234
+ * @description Sets the frame
235
+ * @param {number} frame - The frame to set
236
+ */
237
+ setFrame(frame: number): void;
238
+ /**
239
+ * @method playAnimationOnce
240
+ * @description Plays an animation once
241
+ * @param {Array} animation - The animation to play
242
+ * @param {Array} defaultAnimation - The default animation
243
+ * @param {number} animationSpeed - The speed of the animation
244
+ * @param {function} callbackFunction - The callback function
245
+ */
246
+ playAnimationOnce(animation: any[], defaultAnimation?: any[], animationSpeed?: number, callbackFunction?: Function): void;
247
+ /**
248
+ * @method stopAnimation
249
+ * @description Stops the animation
250
+ */
251
+ stopAnimation(): void;
252
+ /**
253
+ * @method draw
254
+ * @description Draws the object
255
+ * @param {mat4} globalViewMatrix - The global view matrix
256
+ * @param {WebGLUniformLocation} uniformLocation - The uniform location
257
+ * @param {number} currentTime - The current time
258
+ * @param {Object} objectTransform - The object transform
259
+ */
260
+ draw(globalViewMatrix: mat4, uniformLocation: WebGLUniformLocation, currentTime: number, objectTransform: any): void;
261
+ /**
262
+ * @method loadImage
263
+ * @description Loads an image
264
+ * @param {string} path - The path to the image
265
+ * @returns {Promise} - The promise
266
+ */
267
+ loadImage(path: string): Promise<any>;
268
+ }
269
+ import { vec4 } from "gl-matrix";
270
+ import Color from "./Color.js";
271
+ import { mat4 } from "gl-matrix";
@@ -0,0 +1,22 @@
1
+ export default Easing;
2
+ declare namespace Easing {
3
+ function linear(t: any): any;
4
+ function inQuad(t: any): number;
5
+ function outQuad(t: any): number;
6
+ function inOutQuad(t: any): number;
7
+ function inCubic(t: any): number;
8
+ function outCubic(t: any): number;
9
+ function inOutCubic(t: any): number;
10
+ function inQuart(t: any): number;
11
+ function outQuart(t: any): number;
12
+ function inOutQuart(t: any): number;
13
+ function inSine(t: any): number;
14
+ function outSine(t: any): number;
15
+ function inOutSine(t: any): number;
16
+ function inExpo(t: any): number;
17
+ function outExpo(t: any): number;
18
+ function inBack(t: any): number;
19
+ function outBack(t: any): number;
20
+ function outElastic(t: any): number;
21
+ function outBounce(t: any): number;
22
+ }