melonjs 10.7.0 → 10.9.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/dist/melonjs.js +1488 -666
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +929 -202
- package/dist/melonjs.module.js +1575 -777
- package/package.json +9 -9
- package/src/camera/camera2d.js +1 -1
- package/src/entity/entity.js +6 -7
- package/src/geometries/ellipse.js +10 -11
- package/src/geometries/line.js +3 -3
- package/src/geometries/path2d.js +319 -0
- package/src/geometries/poly.js +11 -11
- package/src/geometries/rectangle.js +15 -15
- package/src/geometries/roundrect.js +164 -0
- package/src/index.js +5 -1
- package/src/input/gamepad.js +2 -2
- package/src/input/pointerevent.js +1 -1
- package/src/lang/deprecated.js +1 -1
- package/src/level/tiled/TMXLayer.js +1 -1
- package/src/level/tiled/TMXObject.js +9 -12
- package/src/level/tiled/TMXTileMap.js +23 -4
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/src/loader/loader.js +4 -4
- package/src/loader/loadingscreen.js +1 -1
- package/src/math/color.js +1 -1
- package/src/math/matrix2.js +1 -1
- package/src/math/matrix3.js +1 -1
- package/src/math/observable_vector2.js +1 -1
- package/src/math/observable_vector3.js +1 -1
- package/src/math/vector2.js +1 -1
- package/src/math/vector3.js +1 -1
- package/src/particles/emitter.js +23 -14
- package/src/particles/particle.js +3 -2
- package/src/physics/body.js +67 -51
- package/src/physics/bounds.js +8 -9
- package/src/physics/world.js +1 -1
- package/src/polyfill/index.js +1 -0
- package/src/polyfill/roundrect.js +235 -0
- package/src/renderable/collectable.js +9 -2
- package/src/renderable/colorlayer.js +1 -1
- package/src/renderable/container.js +1 -1
- package/src/renderable/imagelayer.js +1 -1
- package/src/renderable/renderable.js +2 -2
- package/src/renderable/sprite.js +2 -3
- package/src/renderable/trigger.js +10 -4
- package/src/state/stage.js +1 -1
- package/src/state/state.js +1 -1
- package/src/system/device.js +10 -8
- package/src/system/pooling.js +156 -149
- package/src/text/bitmaptext.js +1 -1
- package/src/text/text.js +1 -1
- package/src/utils/utils.js +2 -2
- package/src/video/canvas/canvas_renderer.js +83 -39
- package/src/video/renderer.js +36 -16
- package/src/video/texture.js +1 -1
- package/src/video/webgl/glshader.js +29 -193
- package/src/video/webgl/utils/attributes.js +16 -0
- package/src/video/webgl/utils/precision.js +11 -0
- package/src/video/webgl/utils/program.js +58 -0
- package/src/video/webgl/utils/string.js +16 -0
- package/src/video/webgl/utils/uniforms.js +87 -0
- package/src/video/webgl/webgl_compositor.js +1 -14
- package/src/video/webgl/webgl_renderer.js +124 -182
package/dist/melonjs.module.d.ts
CHANGED
|
@@ -233,9 +233,45 @@ export class Body {
|
|
|
233
233
|
* body.collisionType = me.collision.types.PLAYER_OBJECT;
|
|
234
234
|
*/
|
|
235
235
|
public collisionType: number;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
/**
|
|
237
|
+
* body velocity
|
|
238
|
+
* @public
|
|
239
|
+
* @type {Vector2d}
|
|
240
|
+
* @default <0,0>
|
|
241
|
+
*/
|
|
242
|
+
public vel: Vector2d;
|
|
243
|
+
/**
|
|
244
|
+
* body force or acceleration (automatically) applied to the body.
|
|
245
|
+
* when defining a force, user should also define a max velocity
|
|
246
|
+
* @public
|
|
247
|
+
* @type {Vector2d}
|
|
248
|
+
* @default <0,0>
|
|
249
|
+
* @see Body.setMaxVelocity
|
|
250
|
+
* @example
|
|
251
|
+
* // define a default maximum acceleration, initial force and friction
|
|
252
|
+
* this.body.force.set(0, 0);
|
|
253
|
+
* this.body.friction.set(0.4, 0);
|
|
254
|
+
* this.body.setMaxVelocity(3, 15);
|
|
255
|
+
*
|
|
256
|
+
* // apply a postive or negative force when pressing left of right key
|
|
257
|
+
* update(dt) {
|
|
258
|
+
* if (me.input.isKeyPressed("left")) {
|
|
259
|
+
* this.body.force.x = -this.body.maxVel.x;
|
|
260
|
+
* } else if (me.input.isKeyPressed("right")) {
|
|
261
|
+
* this.body.force.x = this.body.maxVel.x;
|
|
262
|
+
* } else {
|
|
263
|
+
* this.body.force.x = 0;
|
|
264
|
+
* }
|
|
265
|
+
* }
|
|
266
|
+
*/
|
|
267
|
+
public force: Vector2d;
|
|
268
|
+
/**
|
|
269
|
+
* body friction
|
|
270
|
+
* @public
|
|
271
|
+
* @type {Vector2d}
|
|
272
|
+
* @default <0,0>
|
|
273
|
+
*/
|
|
274
|
+
public friction: Vector2d;
|
|
239
275
|
/**
|
|
240
276
|
* the body bouciness level when colliding with other solid bodies :
|
|
241
277
|
* a value of 0 will not bounce, a value of 1 will fully rebound.
|
|
@@ -251,7 +287,13 @@ export class Body {
|
|
|
251
287
|
* @default 1
|
|
252
288
|
*/
|
|
253
289
|
public mass: number;
|
|
254
|
-
|
|
290
|
+
/**
|
|
291
|
+
* max velocity (to limit body velocity)
|
|
292
|
+
* @public
|
|
293
|
+
* @type {Vector2d}
|
|
294
|
+
* @default <490,490>
|
|
295
|
+
*/
|
|
296
|
+
public maxVel: Vector2d;
|
|
255
297
|
/**
|
|
256
298
|
* Either this body is a static body or not.
|
|
257
299
|
* A static body is completely fixed and can never change position or angle.
|
|
@@ -484,6 +526,7 @@ declare class Bounds$1 {
|
|
|
484
526
|
* @param {Vector2d[]} [vertices] an array of me.Vector2d points
|
|
485
527
|
*/
|
|
486
528
|
constructor(vertices?: Vector2d[]);
|
|
529
|
+
_center: Vector2d;
|
|
487
530
|
/**
|
|
488
531
|
* @ignore
|
|
489
532
|
*/
|
|
@@ -496,7 +539,6 @@ declare class Bounds$1 {
|
|
|
496
539
|
x: number;
|
|
497
540
|
y: number;
|
|
498
541
|
};
|
|
499
|
-
_center: Vector2d;
|
|
500
542
|
/**
|
|
501
543
|
* reset the bound
|
|
502
544
|
* @name clear
|
|
@@ -1288,6 +1330,31 @@ export class CanvasRenderer extends Renderer {
|
|
|
1288
1330
|
* @param {number} height
|
|
1289
1331
|
*/
|
|
1290
1332
|
fillRect(x: number, y: number, width: number, height: number): void;
|
|
1333
|
+
/**
|
|
1334
|
+
* Stroke a rounded rectangle at the specified coordinates
|
|
1335
|
+
* @name strokeRoundRect
|
|
1336
|
+
* @memberof CanvasRenderer.prototype
|
|
1337
|
+
* @function
|
|
1338
|
+
* @param {number} x
|
|
1339
|
+
* @param {number} y
|
|
1340
|
+
* @param {number} width
|
|
1341
|
+
* @param {number} height
|
|
1342
|
+
* @param {number} radius
|
|
1343
|
+
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
1344
|
+
*/
|
|
1345
|
+
strokeRoundRect(x: number, y: number, width: number, height: number, radius: number, fill?: boolean): void;
|
|
1346
|
+
/**
|
|
1347
|
+
* Draw a rounded filled rectangle at the specified coordinates
|
|
1348
|
+
* @name fillRoundRect
|
|
1349
|
+
* @memberof CanvasRenderer.prototype
|
|
1350
|
+
* @function
|
|
1351
|
+
* @param {number} x
|
|
1352
|
+
* @param {number} y
|
|
1353
|
+
* @param {number} width
|
|
1354
|
+
* @param {number} height
|
|
1355
|
+
* @param {number} radius
|
|
1356
|
+
*/
|
|
1357
|
+
fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
1291
1358
|
/**
|
|
1292
1359
|
* return a reference to the system 2d Context
|
|
1293
1360
|
* @name getContext
|
|
@@ -1342,13 +1409,21 @@ export class CanvasRenderer extends Renderer {
|
|
|
1342
1409
|
*/
|
|
1343
1410
|
setColor(color: Color | string): void;
|
|
1344
1411
|
/**
|
|
1345
|
-
* Set the global alpha
|
|
1412
|
+
* Set the global alpha
|
|
1346
1413
|
* @name setGlobalAlpha
|
|
1347
1414
|
* @memberof CanvasRenderer.prototype
|
|
1348
1415
|
* @function
|
|
1349
1416
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
1350
1417
|
*/
|
|
1351
1418
|
setGlobalAlpha(alpha: number): void;
|
|
1419
|
+
/**
|
|
1420
|
+
* Return the global alpha
|
|
1421
|
+
* @name getGlobalAlpha
|
|
1422
|
+
* @memberof CanvasRenderer.prototype
|
|
1423
|
+
* @function
|
|
1424
|
+
* @returns {number} global alpha value
|
|
1425
|
+
*/
|
|
1426
|
+
getGlobalAlpha(): number;
|
|
1352
1427
|
/**
|
|
1353
1428
|
* Set the line width on the context
|
|
1354
1429
|
* @name setLineWidth
|
|
@@ -2246,7 +2321,7 @@ export class Ellipse {
|
|
|
2246
2321
|
* @public
|
|
2247
2322
|
* @type {Vector2d}
|
|
2248
2323
|
* @name pos
|
|
2249
|
-
* @memberof Ellipse
|
|
2324
|
+
* @memberof Ellipse.prototype
|
|
2250
2325
|
*/
|
|
2251
2326
|
public pos: Vector2d;
|
|
2252
2327
|
/**
|
|
@@ -2259,7 +2334,7 @@ export class Ellipse {
|
|
|
2259
2334
|
* @public
|
|
2260
2335
|
* @type {number}
|
|
2261
2336
|
* @name radius
|
|
2262
|
-
* @memberof Ellipse
|
|
2337
|
+
* @memberof Ellipse.prototype
|
|
2263
2338
|
*/
|
|
2264
2339
|
public radius: number;
|
|
2265
2340
|
/**
|
|
@@ -2267,7 +2342,7 @@ export class Ellipse {
|
|
|
2267
2342
|
* @public
|
|
2268
2343
|
* @type {Vector2d}
|
|
2269
2344
|
* @name radiusV
|
|
2270
|
-
* @memberof Ellipse
|
|
2345
|
+
* @memberof Ellipse.prototype
|
|
2271
2346
|
*/
|
|
2272
2347
|
public radiusV: Vector2d;
|
|
2273
2348
|
/**
|
|
@@ -2275,7 +2350,7 @@ export class Ellipse {
|
|
|
2275
2350
|
* @public
|
|
2276
2351
|
* @type {Vector2d}
|
|
2277
2352
|
* @name radiusSq
|
|
2278
|
-
* @memberof Ellipse
|
|
2353
|
+
* @memberof Ellipse.prototype
|
|
2279
2354
|
*/
|
|
2280
2355
|
public radiusSq: Vector2d;
|
|
2281
2356
|
/**
|
|
@@ -2283,7 +2358,7 @@ export class Ellipse {
|
|
|
2283
2358
|
* @public
|
|
2284
2359
|
* @type {Vector2d}
|
|
2285
2360
|
* @name ratio
|
|
2286
|
-
* @memberof Ellipse
|
|
2361
|
+
* @memberof Ellipse.prototype
|
|
2287
2362
|
*/
|
|
2288
2363
|
public ratio: Vector2d;
|
|
2289
2364
|
shapeType: string;
|
|
@@ -2610,6 +2685,16 @@ export class GLShader {
|
|
|
2610
2685
|
* myShader.setUniform("uProjectionMatrix", this.projectionMatrix);
|
|
2611
2686
|
*/
|
|
2612
2687
|
setUniform(name: string, value: object | Float32Array): void;
|
|
2688
|
+
/**
|
|
2689
|
+
* activate the given vertex attribute for this shader
|
|
2690
|
+
* @name setVertexAttributes
|
|
2691
|
+
* @memberof GLShader
|
|
2692
|
+
* @function
|
|
2693
|
+
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
2694
|
+
* @param {object[]} attributes an array of vertex attributes
|
|
2695
|
+
* @param {number} vertexByteSize the size of a single vertex in bytes
|
|
2696
|
+
*/
|
|
2697
|
+
setVertexAttributes(gl: WebGLRenderingContext, attributes: object[], vertexByteSize: number): void;
|
|
2613
2698
|
/**
|
|
2614
2699
|
* destroy this shader objects resources (program, attributes, uniforms)
|
|
2615
2700
|
* @name destroy
|
|
@@ -4064,7 +4149,7 @@ export class Particle extends Renderable {
|
|
|
4064
4149
|
* @ignore
|
|
4065
4150
|
*/
|
|
4066
4151
|
onResetEvent(emitter: any, newInstance?: boolean): void;
|
|
4067
|
-
vel:
|
|
4152
|
+
vel: any;
|
|
4068
4153
|
image: any;
|
|
4069
4154
|
life: any;
|
|
4070
4155
|
startLife: any;
|
|
@@ -4088,33 +4173,607 @@ export class Particle extends Renderable {
|
|
|
4088
4173
|
*/
|
|
4089
4174
|
export class ParticleEmitter extends Container {
|
|
4090
4175
|
/**
|
|
4091
|
-
* @param {number} x x position of the particle emitter
|
|
4092
|
-
* @param {number} y y position of the particle emitter
|
|
4093
|
-
* @param {ParticleEmitterSettings} [settings=ParticleEmitterSettings] the settings for the particle emitter.
|
|
4094
|
-
* @example
|
|
4095
|
-
* // Create a
|
|
4096
|
-
* var emitter = new ParticleEmitter(100, 100
|
|
4097
|
-
*
|
|
4098
|
-
*
|
|
4099
|
-
*
|
|
4100
|
-
*
|
|
4101
|
-
*
|
|
4102
|
-
*
|
|
4103
|
-
*
|
|
4104
|
-
*
|
|
4105
|
-
*
|
|
4106
|
-
*
|
|
4107
|
-
* //
|
|
4108
|
-
*
|
|
4109
|
-
*
|
|
4110
|
-
* // Launch
|
|
4111
|
-
* emitter.
|
|
4112
|
-
*
|
|
4113
|
-
* //
|
|
4114
|
-
*
|
|
4115
|
-
*
|
|
4176
|
+
* @param {number} x x position of the particle emitter
|
|
4177
|
+
* @param {number} y y position of the particle emitter
|
|
4178
|
+
* @param {ParticleEmitterSettings} [settings=ParticleEmitterSettings] the settings for the particle emitter.
|
|
4179
|
+
* @example
|
|
4180
|
+
* // Create a particle emitter at position 100, 100
|
|
4181
|
+
* var emitter = new ParticleEmitter(100, 100, {
|
|
4182
|
+
* width: 16,
|
|
4183
|
+
* height : 16,
|
|
4184
|
+
* tint: "#f00",
|
|
4185
|
+
* totalParticles: 32,
|
|
4186
|
+
* angle: 0,
|
|
4187
|
+
* angleVariation: 6.283185307179586,
|
|
4188
|
+
* maxLife: 5,
|
|
4189
|
+
* speed: 3
|
|
4190
|
+
* });
|
|
4191
|
+
*
|
|
4192
|
+
* // Add the emitter to the game world
|
|
4193
|
+
* me.game.world.addChild(emitter);
|
|
4194
|
+
*
|
|
4195
|
+
* // Launch all particles one time and stop, like a explosion
|
|
4196
|
+
* emitter.burstParticles();
|
|
4197
|
+
*
|
|
4198
|
+
* // Launch constantly the particles, like a fountain
|
|
4199
|
+
* emitter.streamParticles();
|
|
4200
|
+
*
|
|
4201
|
+
* // At the end, remove emitter from the game world
|
|
4202
|
+
* // call this in onDestroyEvent function
|
|
4203
|
+
* me.game.world.removeChild(emitter);
|
|
4204
|
+
*/
|
|
4205
|
+
constructor(x: number, y: number, settings?: {
|
|
4206
|
+
/**
|
|
4207
|
+
* Width of the particle spawn area.
|
|
4208
|
+
* @type {number}
|
|
4209
|
+
* @name width
|
|
4210
|
+
* @memberof ParticleEmitterSettings
|
|
4211
|
+
* @default 1
|
|
4212
|
+
*/
|
|
4213
|
+
width: number;
|
|
4214
|
+
/**
|
|
4215
|
+
* Height of the particle spawn area
|
|
4216
|
+
* @public
|
|
4217
|
+
* @type {number}
|
|
4218
|
+
* @name height
|
|
4219
|
+
* @memberof ParticleEmitterSettings
|
|
4220
|
+
* @default 1
|
|
4221
|
+
*/
|
|
4222
|
+
height: number;
|
|
4223
|
+
/**
|
|
4224
|
+
* image used for particles texture
|
|
4225
|
+
* (by default melonJS will create an white 8x8 texture image)
|
|
4226
|
+
* @public
|
|
4227
|
+
* @type {HTMLCanvasElement}
|
|
4228
|
+
* @name image
|
|
4229
|
+
* @memberof ParticleEmitterSettings
|
|
4230
|
+
* @default undefined
|
|
4231
|
+
* @see ParticleEmitterSettings.textureSize
|
|
4232
|
+
*/
|
|
4233
|
+
image: HTMLCanvasElement;
|
|
4234
|
+
/**
|
|
4235
|
+
* default texture size used for particles if no image is specified
|
|
4236
|
+
* (by default melonJS will create an white 8x8 texture image)
|
|
4237
|
+
* @public
|
|
4238
|
+
* @type {number}
|
|
4239
|
+
* @name textureSize
|
|
4240
|
+
* @memberof ParticleEmitterSettings
|
|
4241
|
+
* @default 8
|
|
4242
|
+
* @see ParticleEmitterSettings.image
|
|
4243
|
+
*/
|
|
4244
|
+
textureSize: number;
|
|
4245
|
+
/**
|
|
4246
|
+
* tint to be applied to particles
|
|
4247
|
+
* @public
|
|
4248
|
+
* @type {string}
|
|
4249
|
+
* @name tint
|
|
4250
|
+
* @memberof ParticleEmitterSettings
|
|
4251
|
+
* @default "#fff"
|
|
4252
|
+
*/
|
|
4253
|
+
tint: string;
|
|
4254
|
+
/**
|
|
4255
|
+
* Total number of particles in the emitter
|
|
4256
|
+
* @public
|
|
4257
|
+
* @type {number}
|
|
4258
|
+
* @name totalParticles
|
|
4259
|
+
* @default 50
|
|
4260
|
+
* @memberof ParticleEmitterSettings
|
|
4261
|
+
*/
|
|
4262
|
+
totalParticles: number;
|
|
4263
|
+
/**
|
|
4264
|
+
* Start angle for particle launch in Radians
|
|
4265
|
+
* @public
|
|
4266
|
+
* @type {number}
|
|
4267
|
+
* @name angle
|
|
4268
|
+
* @default Math.PI / 2
|
|
4269
|
+
* @memberof ParticleEmitterSettings
|
|
4270
|
+
*/
|
|
4271
|
+
angle: number;
|
|
4272
|
+
/**
|
|
4273
|
+
* Variation in the start angle for particle launch in Radians.
|
|
4274
|
+
* @public
|
|
4275
|
+
* @type {number}
|
|
4276
|
+
* @name angleVariation
|
|
4277
|
+
* @default 0
|
|
4278
|
+
* @memberof ParticleEmitterSettings
|
|
4279
|
+
*/
|
|
4280
|
+
angleVariation: number;
|
|
4281
|
+
/**
|
|
4282
|
+
* Minimum time each particle lives once it is emitted in ms.
|
|
4283
|
+
* @public
|
|
4284
|
+
* @type {number}
|
|
4285
|
+
* @name minLife
|
|
4286
|
+
* @default 1000
|
|
4287
|
+
* @memberof ParticleEmitterSettings
|
|
4288
|
+
*/
|
|
4289
|
+
minLife: number;
|
|
4290
|
+
/**
|
|
4291
|
+
* Maximum time each particle lives once it is emitted in ms.
|
|
4292
|
+
* @public
|
|
4293
|
+
* @type {number}
|
|
4294
|
+
* @name maxLife
|
|
4295
|
+
* @default 3000
|
|
4296
|
+
* @memberof ParticleEmitterSettings
|
|
4297
|
+
*/
|
|
4298
|
+
maxLife: number;
|
|
4299
|
+
/**
|
|
4300
|
+
* Start speed of particles.<br>
|
|
4301
|
+
* @public
|
|
4302
|
+
* @type {number}
|
|
4303
|
+
* @name speed
|
|
4304
|
+
* @default 2
|
|
4305
|
+
* @memberof ParticleEmitterSettings
|
|
4306
|
+
*/
|
|
4307
|
+
speed: number;
|
|
4308
|
+
/**
|
|
4309
|
+
* Variation in the start speed of particles
|
|
4310
|
+
* @public
|
|
4311
|
+
* @type {number}
|
|
4312
|
+
* @name speedVariation
|
|
4313
|
+
* @default 1
|
|
4314
|
+
* @memberof ParticleEmitterSettings
|
|
4315
|
+
*/
|
|
4316
|
+
speedVariation: number;
|
|
4317
|
+
/**
|
|
4318
|
+
* Minimum start rotation for particles sprites in Radians
|
|
4319
|
+
* @public
|
|
4320
|
+
* @type {number}
|
|
4321
|
+
* @name minRotation
|
|
4322
|
+
* @default 0
|
|
4323
|
+
* @memberof ParticleEmitterSettings
|
|
4324
|
+
*/
|
|
4325
|
+
minRotation: number;
|
|
4326
|
+
/**
|
|
4327
|
+
* Maximum start rotation for particles sprites in Radians
|
|
4328
|
+
* @public
|
|
4329
|
+
* @type {number}
|
|
4330
|
+
* @name maxRotation
|
|
4331
|
+
* @default 0
|
|
4332
|
+
* @memberof ParticleEmitterSettings
|
|
4333
|
+
*/
|
|
4334
|
+
maxRotation: number;
|
|
4335
|
+
/**
|
|
4336
|
+
* Minimum start scale ratio for particles (1 = no scaling)
|
|
4337
|
+
* @public
|
|
4338
|
+
* @type {number}
|
|
4339
|
+
* @name minStartScale
|
|
4340
|
+
* @default 1
|
|
4341
|
+
* @memberof ParticleEmitterSettings
|
|
4342
|
+
*/
|
|
4343
|
+
minStartScale: number;
|
|
4344
|
+
/**
|
|
4345
|
+
* Maximum start scale ratio for particles (1 = no scaling)
|
|
4346
|
+
* @public
|
|
4347
|
+
* @type {number}
|
|
4348
|
+
* @name maxStartScale
|
|
4349
|
+
* @default 1
|
|
4350
|
+
* @memberof ParticleEmitterSettings
|
|
4351
|
+
*/
|
|
4352
|
+
maxStartScale: number;
|
|
4353
|
+
/**
|
|
4354
|
+
* Minimum end scale ratio for particles
|
|
4355
|
+
* @public
|
|
4356
|
+
* @type {number}
|
|
4357
|
+
* @name minEndScale
|
|
4358
|
+
* @default 0
|
|
4359
|
+
* @memberof ParticleEmitterSettings
|
|
4360
|
+
*/
|
|
4361
|
+
minEndScale: number;
|
|
4362
|
+
/**
|
|
4363
|
+
* Maximum end scale ratio for particles
|
|
4364
|
+
* @public
|
|
4365
|
+
* @type {number}
|
|
4366
|
+
* @name maxEndScale
|
|
4367
|
+
* @default 0
|
|
4368
|
+
* @memberof ParticleEmitterSettings
|
|
4369
|
+
*/
|
|
4370
|
+
maxEndScale: number;
|
|
4371
|
+
/**
|
|
4372
|
+
* Vertical force (Gravity) for each particle
|
|
4373
|
+
* @public
|
|
4374
|
+
* @type {number}
|
|
4375
|
+
* @name gravity
|
|
4376
|
+
* @default 0
|
|
4377
|
+
* @memberof ParticleEmitterSettings
|
|
4378
|
+
* @see game.world.gravity
|
|
4379
|
+
*/
|
|
4380
|
+
gravity: number;
|
|
4381
|
+
/**
|
|
4382
|
+
* Horizontal force (like a Wind) for each particle
|
|
4383
|
+
* @public
|
|
4384
|
+
* @type {number}
|
|
4385
|
+
* @name wind
|
|
4386
|
+
* @default 0
|
|
4387
|
+
* @memberof ParticleEmitterSettings
|
|
4388
|
+
*/
|
|
4389
|
+
wind: number;
|
|
4390
|
+
/**
|
|
4391
|
+
* Update the rotation of particle in accordance the particle trajectory.<br>
|
|
4392
|
+
* The particle sprite should aim at zero angle (draw from left to right).<br>
|
|
4393
|
+
* Override the particle minRotation and maxRotation.<br>
|
|
4394
|
+
* @public
|
|
4395
|
+
* @type {boolean}
|
|
4396
|
+
* @name followTrajectory
|
|
4397
|
+
* @default false
|
|
4398
|
+
* @memberof ParticleEmitterSettings
|
|
4399
|
+
*/
|
|
4400
|
+
followTrajectory: boolean;
|
|
4401
|
+
/**
|
|
4402
|
+
* Enable the Texture Additive by composite operation ("additive" blendMode)
|
|
4403
|
+
* @public
|
|
4404
|
+
* @type {boolean}
|
|
4405
|
+
* @name textureAdditive
|
|
4406
|
+
* @default false
|
|
4407
|
+
* @memberof ParticleEmitterSettings
|
|
4408
|
+
* @see ParticleEmitterSettings.blendMode
|
|
4409
|
+
*/
|
|
4410
|
+
textureAdditive: boolean;
|
|
4411
|
+
/**
|
|
4412
|
+
* the blend mode to be applied when rendering particles.
|
|
4413
|
+
* (note: this will superseed the `textureAdditive` setting if different than "normal")
|
|
4414
|
+
* @public
|
|
4415
|
+
* @type {string}
|
|
4416
|
+
* @name blendMode
|
|
4417
|
+
* @default normal
|
|
4418
|
+
* @memberof ParticleEmitterSettings
|
|
4419
|
+
* @see CanvasRenderer#setBlendMode
|
|
4420
|
+
* @see WebGLRenderer#setBlendMode
|
|
4421
|
+
*/
|
|
4422
|
+
blendMode: string;
|
|
4423
|
+
/**
|
|
4424
|
+
* Update particles only in the viewport, remove it when out of viewport.
|
|
4425
|
+
* @public
|
|
4426
|
+
* @type {boolean}
|
|
4427
|
+
* @name onlyInViewport
|
|
4428
|
+
* @default true
|
|
4429
|
+
* @memberof ParticleEmitterSettings
|
|
4430
|
+
*/
|
|
4431
|
+
onlyInViewport: boolean;
|
|
4432
|
+
/**
|
|
4433
|
+
* Render particles in screen space.
|
|
4434
|
+
* @public
|
|
4435
|
+
* @type {boolean}
|
|
4436
|
+
* @name floating
|
|
4437
|
+
* @default false
|
|
4438
|
+
* @memberof ParticleEmitterSettings
|
|
4439
|
+
*/
|
|
4440
|
+
floating: boolean;
|
|
4441
|
+
/**
|
|
4442
|
+
* Maximum number of particles launched each time in this emitter (used only if emitter is Stream).
|
|
4443
|
+
* @public
|
|
4444
|
+
* @type {number}
|
|
4445
|
+
* @name maxParticles
|
|
4446
|
+
* @default 10
|
|
4447
|
+
* @memberof ParticleEmitterSettings
|
|
4448
|
+
*/
|
|
4449
|
+
maxParticles: number;
|
|
4450
|
+
/**
|
|
4451
|
+
* How often a particle is emitted in ms (used only if emitter is a Stream).
|
|
4452
|
+
* @public
|
|
4453
|
+
* @type {number}
|
|
4454
|
+
* @name frequency
|
|
4455
|
+
* @default 100
|
|
4456
|
+
* @memberof ParticleEmitterSettings
|
|
4457
|
+
*/
|
|
4458
|
+
frequency: number;
|
|
4459
|
+
/**
|
|
4460
|
+
* Duration that the emitter releases particles in ms (used only if emitter is Stream).
|
|
4461
|
+
* After this period, the emitter stop the launch of particles.
|
|
4462
|
+
* @public
|
|
4463
|
+
* @type {number}
|
|
4464
|
+
* @name duration
|
|
4465
|
+
* @default Infinity
|
|
4466
|
+
* @memberof ParticleEmitterSettings
|
|
4467
|
+
*/
|
|
4468
|
+
duration: number;
|
|
4469
|
+
/**
|
|
4470
|
+
* Skip n frames after updating the particle system once.
|
|
4471
|
+
* This can be used to reduce the performance impact of emitters with many particles.
|
|
4472
|
+
* @public
|
|
4473
|
+
* @type {number}
|
|
4474
|
+
* @name framesToSkip
|
|
4475
|
+
* @default 0
|
|
4476
|
+
* @memberof ParticleEmitterSettings
|
|
4477
|
+
*/
|
|
4478
|
+
framesToSkip: number;
|
|
4479
|
+
});
|
|
4480
|
+
/**
|
|
4481
|
+
* the current (active) emitter settings
|
|
4482
|
+
* @public
|
|
4483
|
+
* @type {ParticleEmitterSettings}
|
|
4484
|
+
* @name settings
|
|
4485
|
+
* @memberof ParticleEmitter
|
|
4486
|
+
*/
|
|
4487
|
+
public settings: {
|
|
4488
|
+
/**
|
|
4489
|
+
* Width of the particle spawn area.
|
|
4490
|
+
* @type {number}
|
|
4491
|
+
* @name width
|
|
4492
|
+
* @memberof ParticleEmitterSettings
|
|
4493
|
+
* @default 1
|
|
4494
|
+
*/
|
|
4495
|
+
width: number;
|
|
4496
|
+
/**
|
|
4497
|
+
* Height of the particle spawn area
|
|
4498
|
+
* @public
|
|
4499
|
+
* @type {number}
|
|
4500
|
+
* @name height
|
|
4501
|
+
* @memberof ParticleEmitterSettings
|
|
4502
|
+
* @default 1
|
|
4503
|
+
*/
|
|
4504
|
+
height: number;
|
|
4505
|
+
/**
|
|
4506
|
+
* image used for particles texture
|
|
4507
|
+
* (by default melonJS will create an white 8x8 texture image)
|
|
4508
|
+
* @public
|
|
4509
|
+
* @type {HTMLCanvasElement}
|
|
4510
|
+
* @name image
|
|
4511
|
+
* @memberof ParticleEmitterSettings
|
|
4512
|
+
* @default undefined
|
|
4513
|
+
* @see ParticleEmitterSettings.textureSize
|
|
4514
|
+
*/
|
|
4515
|
+
image: HTMLCanvasElement;
|
|
4516
|
+
/**
|
|
4517
|
+
* default texture size used for particles if no image is specified
|
|
4518
|
+
* (by default melonJS will create an white 8x8 texture image)
|
|
4519
|
+
* @public
|
|
4520
|
+
* @type {number}
|
|
4521
|
+
* @name textureSize
|
|
4522
|
+
* @memberof ParticleEmitterSettings
|
|
4523
|
+
* @default 8
|
|
4524
|
+
* @see ParticleEmitterSettings.image
|
|
4525
|
+
*/
|
|
4526
|
+
textureSize: number;
|
|
4527
|
+
/**
|
|
4528
|
+
* tint to be applied to particles
|
|
4529
|
+
* @public
|
|
4530
|
+
* @type {string}
|
|
4531
|
+
* @name tint
|
|
4532
|
+
* @memberof ParticleEmitterSettings
|
|
4533
|
+
* @default "#fff"
|
|
4534
|
+
*/
|
|
4535
|
+
tint: string;
|
|
4536
|
+
/**
|
|
4537
|
+
* Total number of particles in the emitter
|
|
4538
|
+
* @public
|
|
4539
|
+
* @type {number}
|
|
4540
|
+
* @name totalParticles
|
|
4541
|
+
* @default 50
|
|
4542
|
+
* @memberof ParticleEmitterSettings
|
|
4543
|
+
*/
|
|
4544
|
+
totalParticles: number;
|
|
4545
|
+
/**
|
|
4546
|
+
* Start angle for particle launch in Radians
|
|
4547
|
+
* @public
|
|
4548
|
+
* @type {number}
|
|
4549
|
+
* @name angle
|
|
4550
|
+
* @default Math.PI / 2
|
|
4551
|
+
* @memberof ParticleEmitterSettings
|
|
4552
|
+
*/
|
|
4553
|
+
angle: number;
|
|
4554
|
+
/**
|
|
4555
|
+
* Variation in the start angle for particle launch in Radians.
|
|
4556
|
+
* @public
|
|
4557
|
+
* @type {number}
|
|
4558
|
+
* @name angleVariation
|
|
4559
|
+
* @default 0
|
|
4560
|
+
* @memberof ParticleEmitterSettings
|
|
4561
|
+
*/
|
|
4562
|
+
angleVariation: number;
|
|
4563
|
+
/**
|
|
4564
|
+
* Minimum time each particle lives once it is emitted in ms.
|
|
4565
|
+
* @public
|
|
4566
|
+
* @type {number}
|
|
4567
|
+
* @name minLife
|
|
4568
|
+
* @default 1000
|
|
4569
|
+
* @memberof ParticleEmitterSettings
|
|
4570
|
+
*/
|
|
4571
|
+
minLife: number;
|
|
4572
|
+
/**
|
|
4573
|
+
* Maximum time each particle lives once it is emitted in ms.
|
|
4574
|
+
* @public
|
|
4575
|
+
* @type {number}
|
|
4576
|
+
* @name maxLife
|
|
4577
|
+
* @default 3000
|
|
4578
|
+
* @memberof ParticleEmitterSettings
|
|
4579
|
+
*/
|
|
4580
|
+
maxLife: number;
|
|
4581
|
+
/**
|
|
4582
|
+
* Start speed of particles.<br>
|
|
4583
|
+
* @public
|
|
4584
|
+
* @type {number}
|
|
4585
|
+
* @name speed
|
|
4586
|
+
* @default 2
|
|
4587
|
+
* @memberof ParticleEmitterSettings
|
|
4588
|
+
*/
|
|
4589
|
+
speed: number;
|
|
4590
|
+
/**
|
|
4591
|
+
* Variation in the start speed of particles
|
|
4592
|
+
* @public
|
|
4593
|
+
* @type {number}
|
|
4594
|
+
* @name speedVariation
|
|
4595
|
+
* @default 1
|
|
4596
|
+
* @memberof ParticleEmitterSettings
|
|
4597
|
+
*/
|
|
4598
|
+
speedVariation: number;
|
|
4599
|
+
/**
|
|
4600
|
+
* Minimum start rotation for particles sprites in Radians
|
|
4601
|
+
* @public
|
|
4602
|
+
* @type {number}
|
|
4603
|
+
* @name minRotation
|
|
4604
|
+
* @default 0
|
|
4605
|
+
* @memberof ParticleEmitterSettings
|
|
4606
|
+
*/
|
|
4607
|
+
minRotation: number;
|
|
4608
|
+
/**
|
|
4609
|
+
* Maximum start rotation for particles sprites in Radians
|
|
4610
|
+
* @public
|
|
4611
|
+
* @type {number}
|
|
4612
|
+
* @name maxRotation
|
|
4613
|
+
* @default 0
|
|
4614
|
+
* @memberof ParticleEmitterSettings
|
|
4615
|
+
*/
|
|
4616
|
+
maxRotation: number;
|
|
4617
|
+
/**
|
|
4618
|
+
* Minimum start scale ratio for particles (1 = no scaling)
|
|
4619
|
+
* @public
|
|
4620
|
+
* @type {number}
|
|
4621
|
+
* @name minStartScale
|
|
4622
|
+
* @default 1
|
|
4623
|
+
* @memberof ParticleEmitterSettings
|
|
4624
|
+
*/
|
|
4625
|
+
minStartScale: number;
|
|
4626
|
+
/**
|
|
4627
|
+
* Maximum start scale ratio for particles (1 = no scaling)
|
|
4628
|
+
* @public
|
|
4629
|
+
* @type {number}
|
|
4630
|
+
* @name maxStartScale
|
|
4631
|
+
* @default 1
|
|
4632
|
+
* @memberof ParticleEmitterSettings
|
|
4633
|
+
*/
|
|
4634
|
+
maxStartScale: number;
|
|
4635
|
+
/**
|
|
4636
|
+
* Minimum end scale ratio for particles
|
|
4637
|
+
* @public
|
|
4638
|
+
* @type {number}
|
|
4639
|
+
* @name minEndScale
|
|
4640
|
+
* @default 0
|
|
4641
|
+
* @memberof ParticleEmitterSettings
|
|
4642
|
+
*/
|
|
4643
|
+
minEndScale: number;
|
|
4644
|
+
/**
|
|
4645
|
+
* Maximum end scale ratio for particles
|
|
4646
|
+
* @public
|
|
4647
|
+
* @type {number}
|
|
4648
|
+
* @name maxEndScale
|
|
4649
|
+
* @default 0
|
|
4650
|
+
* @memberof ParticleEmitterSettings
|
|
4651
|
+
*/
|
|
4652
|
+
maxEndScale: number;
|
|
4653
|
+
/**
|
|
4654
|
+
* Vertical force (Gravity) for each particle
|
|
4655
|
+
* @public
|
|
4656
|
+
* @type {number}
|
|
4657
|
+
* @name gravity
|
|
4658
|
+
* @default 0
|
|
4659
|
+
* @memberof ParticleEmitterSettings
|
|
4660
|
+
* @see game.world.gravity
|
|
4661
|
+
*/
|
|
4662
|
+
gravity: number;
|
|
4663
|
+
/**
|
|
4664
|
+
* Horizontal force (like a Wind) for each particle
|
|
4665
|
+
* @public
|
|
4666
|
+
* @type {number}
|
|
4667
|
+
* @name wind
|
|
4668
|
+
* @default 0
|
|
4669
|
+
* @memberof ParticleEmitterSettings
|
|
4670
|
+
*/
|
|
4671
|
+
wind: number;
|
|
4672
|
+
/**
|
|
4673
|
+
* Update the rotation of particle in accordance the particle trajectory.<br>
|
|
4674
|
+
* The particle sprite should aim at zero angle (draw from left to right).<br>
|
|
4675
|
+
* Override the particle minRotation and maxRotation.<br>
|
|
4676
|
+
* @public
|
|
4677
|
+
* @type {boolean}
|
|
4678
|
+
* @name followTrajectory
|
|
4679
|
+
* @default false
|
|
4680
|
+
* @memberof ParticleEmitterSettings
|
|
4681
|
+
*/
|
|
4682
|
+
followTrajectory: boolean;
|
|
4683
|
+
/**
|
|
4684
|
+
* Enable the Texture Additive by composite operation ("additive" blendMode)
|
|
4685
|
+
* @public
|
|
4686
|
+
* @type {boolean}
|
|
4687
|
+
* @name textureAdditive
|
|
4688
|
+
* @default false
|
|
4689
|
+
* @memberof ParticleEmitterSettings
|
|
4690
|
+
* @see ParticleEmitterSettings.blendMode
|
|
4691
|
+
*/
|
|
4692
|
+
textureAdditive: boolean;
|
|
4693
|
+
/**
|
|
4694
|
+
* the blend mode to be applied when rendering particles.
|
|
4695
|
+
* (note: this will superseed the `textureAdditive` setting if different than "normal")
|
|
4696
|
+
* @public
|
|
4697
|
+
* @type {string}
|
|
4698
|
+
* @name blendMode
|
|
4699
|
+
* @default normal
|
|
4700
|
+
* @memberof ParticleEmitterSettings
|
|
4701
|
+
* @see CanvasRenderer#setBlendMode
|
|
4702
|
+
* @see WebGLRenderer#setBlendMode
|
|
4703
|
+
*/
|
|
4704
|
+
blendMode: string;
|
|
4705
|
+
/**
|
|
4706
|
+
* Update particles only in the viewport, remove it when out of viewport.
|
|
4707
|
+
* @public
|
|
4708
|
+
* @type {boolean}
|
|
4709
|
+
* @name onlyInViewport
|
|
4710
|
+
* @default true
|
|
4711
|
+
* @memberof ParticleEmitterSettings
|
|
4712
|
+
*/
|
|
4713
|
+
onlyInViewport: boolean;
|
|
4714
|
+
/**
|
|
4715
|
+
* Render particles in screen space.
|
|
4716
|
+
* @public
|
|
4717
|
+
* @type {boolean}
|
|
4718
|
+
* @name floating
|
|
4719
|
+
* @default false
|
|
4720
|
+
* @memberof ParticleEmitterSettings
|
|
4721
|
+
*/
|
|
4722
|
+
floating: boolean;
|
|
4723
|
+
/**
|
|
4724
|
+
* Maximum number of particles launched each time in this emitter (used only if emitter is Stream).
|
|
4725
|
+
* @public
|
|
4726
|
+
* @type {number}
|
|
4727
|
+
* @name maxParticles
|
|
4728
|
+
* @default 10
|
|
4729
|
+
* @memberof ParticleEmitterSettings
|
|
4730
|
+
*/
|
|
4731
|
+
maxParticles: number;
|
|
4732
|
+
/**
|
|
4733
|
+
* How often a particle is emitted in ms (used only if emitter is a Stream).
|
|
4734
|
+
* @public
|
|
4735
|
+
* @type {number}
|
|
4736
|
+
* @name frequency
|
|
4737
|
+
* @default 100
|
|
4738
|
+
* @memberof ParticleEmitterSettings
|
|
4739
|
+
*/
|
|
4740
|
+
frequency: number;
|
|
4741
|
+
/**
|
|
4742
|
+
* Duration that the emitter releases particles in ms (used only if emitter is Stream).
|
|
4743
|
+
* After this period, the emitter stop the launch of particles.
|
|
4744
|
+
* @public
|
|
4745
|
+
* @type {number}
|
|
4746
|
+
* @name duration
|
|
4747
|
+
* @default Infinity
|
|
4748
|
+
* @memberof ParticleEmitterSettings
|
|
4749
|
+
*/
|
|
4750
|
+
duration: number;
|
|
4751
|
+
/**
|
|
4752
|
+
* Skip n frames after updating the particle system once.
|
|
4753
|
+
* This can be used to reduce the performance impact of emitters with many particles.
|
|
4754
|
+
* @public
|
|
4755
|
+
* @type {number}
|
|
4756
|
+
* @name framesToSkip
|
|
4757
|
+
* @default 0
|
|
4758
|
+
* @memberof ParticleEmitterSettings
|
|
4759
|
+
*/
|
|
4760
|
+
framesToSkip: number;
|
|
4761
|
+
};
|
|
4762
|
+
/** @ignore */
|
|
4763
|
+
_stream: boolean;
|
|
4764
|
+
/** @ignore */
|
|
4765
|
+
_frequencyTimer: number;
|
|
4766
|
+
/** @ignore */
|
|
4767
|
+
_durationTimer: number;
|
|
4768
|
+
/** @ignore */
|
|
4769
|
+
_enabled: boolean;
|
|
4770
|
+
_updateCount: number;
|
|
4771
|
+
_dt: number;
|
|
4772
|
+
/**
|
|
4773
|
+
* Reset the emitter with particle emitter settings.
|
|
4774
|
+
* @param {ParticleEmitterSettings} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
4116
4775
|
*/
|
|
4117
|
-
|
|
4776
|
+
reset(settings?: {
|
|
4118
4777
|
/**
|
|
4119
4778
|
* Width of the particle spawn area.
|
|
4120
4779
|
* @type {number}
|
|
@@ -4388,23 +5047,7 @@ export class ParticleEmitter extends Container {
|
|
|
4388
5047
|
* @memberof ParticleEmitterSettings
|
|
4389
5048
|
*/
|
|
4390
5049
|
framesToSkip: number;
|
|
4391
|
-
});
|
|
4392
|
-
/** @ignore */
|
|
4393
|
-
_stream: boolean;
|
|
4394
|
-
/** @ignore */
|
|
4395
|
-
_frequencyTimer: number;
|
|
4396
|
-
/** @ignore */
|
|
4397
|
-
_durationTimer: number;
|
|
4398
|
-
/** @ignore */
|
|
4399
|
-
_enabled: boolean;
|
|
4400
|
-
_updateCount: number;
|
|
4401
|
-
settings: {};
|
|
4402
|
-
_dt: number;
|
|
4403
|
-
/**
|
|
4404
|
-
* Reset the emitter with particle emitter settings.
|
|
4405
|
-
* @param {object} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
4406
|
-
*/
|
|
4407
|
-
reset(settings?: object): void;
|
|
5050
|
+
}): void;
|
|
4408
5051
|
/**
|
|
4409
5052
|
* returns a random point on the x axis within the bounds of this emitter
|
|
4410
5053
|
* @returns {number}
|
|
@@ -4762,7 +5405,7 @@ export class Polygon {
|
|
|
4762
5405
|
* @public
|
|
4763
5406
|
* @type {Vector2d}
|
|
4764
5407
|
* @name pos
|
|
4765
|
-
* @memberof Polygon
|
|
5408
|
+
* @memberof Polygon.prototype
|
|
4766
5409
|
*/
|
|
4767
5410
|
public pos: Vector2d;
|
|
4768
5411
|
/**
|
|
@@ -4770,7 +5413,7 @@ export class Polygon {
|
|
|
4770
5413
|
* @ignore
|
|
4771
5414
|
* @type {Bounds}
|
|
4772
5415
|
* @name _bounds
|
|
4773
|
-
* @memberof Polygon
|
|
5416
|
+
* @memberof Polygon.prototype
|
|
4774
5417
|
*/
|
|
4775
5418
|
_bounds: Bounds;
|
|
4776
5419
|
/**
|
|
@@ -4779,7 +5422,7 @@ export class Polygon {
|
|
|
4779
5422
|
* @public
|
|
4780
5423
|
* @type {Vector2d[]}
|
|
4781
5424
|
* @name points
|
|
4782
|
-
* @memberof Polygon
|
|
5425
|
+
* @memberof Polygon.prototype
|
|
4783
5426
|
*/
|
|
4784
5427
|
public points: Vector2d[];
|
|
4785
5428
|
/**
|
|
@@ -4924,14 +5567,14 @@ export class Polygon {
|
|
|
4924
5567
|
/**
|
|
4925
5568
|
* Shifts the Polygon to the given position vector.
|
|
4926
5569
|
* @name shift
|
|
4927
|
-
* @memberof Polygon
|
|
5570
|
+
* @memberof Polygon.prototype
|
|
4928
5571
|
* @function
|
|
4929
5572
|
* @param {Vector2d} position
|
|
4930
5573
|
*/
|
|
4931
5574
|
/**
|
|
4932
5575
|
* Shifts the Polygon to the given x, y position.
|
|
4933
5576
|
* @name shift
|
|
4934
|
-
* @memberof Polygon
|
|
5577
|
+
* @memberof Polygon.prototype
|
|
4935
5578
|
* @function
|
|
4936
5579
|
* @param {number} x
|
|
4937
5580
|
* @param {number} y
|
|
@@ -5101,7 +5744,7 @@ export class Rect extends Polygon {
|
|
|
5101
5744
|
* @public
|
|
5102
5745
|
* @type {number}
|
|
5103
5746
|
* @name left
|
|
5104
|
-
* @memberof Rect
|
|
5747
|
+
* @memberof Rect.prototype
|
|
5105
5748
|
*/
|
|
5106
5749
|
public get left(): number;
|
|
5107
5750
|
/**
|
|
@@ -5109,7 +5752,7 @@ export class Rect extends Polygon {
|
|
|
5109
5752
|
* @public
|
|
5110
5753
|
* @type {number}
|
|
5111
5754
|
* @name right
|
|
5112
|
-
* @memberof Rect
|
|
5755
|
+
* @memberof Rect.prototype
|
|
5113
5756
|
*/
|
|
5114
5757
|
public get right(): number;
|
|
5115
5758
|
/**
|
|
@@ -5117,7 +5760,7 @@ export class Rect extends Polygon {
|
|
|
5117
5760
|
* @public
|
|
5118
5761
|
* @type {number}
|
|
5119
5762
|
* @name top
|
|
5120
|
-
* @memberof Rect
|
|
5763
|
+
* @memberof Rect.prototype
|
|
5121
5764
|
*/
|
|
5122
5765
|
public get top(): number;
|
|
5123
5766
|
/**
|
|
@@ -5125,7 +5768,7 @@ export class Rect extends Polygon {
|
|
|
5125
5768
|
* @public
|
|
5126
5769
|
* @type {number}
|
|
5127
5770
|
* @name bottom
|
|
5128
|
-
* @memberof Rect
|
|
5771
|
+
* @memberof Rect.prototype
|
|
5129
5772
|
*/
|
|
5130
5773
|
public get bottom(): number;
|
|
5131
5774
|
public set width(arg: number);
|
|
@@ -5134,7 +5777,7 @@ export class Rect extends Polygon {
|
|
|
5134
5777
|
* @public
|
|
5135
5778
|
* @type {number}
|
|
5136
5779
|
* @name width
|
|
5137
|
-
* @memberof Rect
|
|
5780
|
+
* @memberof Rect.prototype
|
|
5138
5781
|
*/
|
|
5139
5782
|
public get width(): number;
|
|
5140
5783
|
public set height(arg: number);
|
|
@@ -5143,7 +5786,7 @@ export class Rect extends Polygon {
|
|
|
5143
5786
|
* @public
|
|
5144
5787
|
* @type {number}
|
|
5145
5788
|
* @name height
|
|
5146
|
-
* @memberof Rect
|
|
5789
|
+
* @memberof Rect.prototype
|
|
5147
5790
|
*/
|
|
5148
5791
|
public get height(): number;
|
|
5149
5792
|
public set centerX(arg: number);
|
|
@@ -5152,7 +5795,7 @@ export class Rect extends Polygon {
|
|
|
5152
5795
|
* @public
|
|
5153
5796
|
* @type {number}
|
|
5154
5797
|
* @name centerX
|
|
5155
|
-
* @memberof Rect
|
|
5798
|
+
* @memberof Rect.prototype
|
|
5156
5799
|
*/
|
|
5157
5800
|
public get centerX(): number;
|
|
5158
5801
|
public set centerY(arg: number);
|
|
@@ -5161,7 +5804,7 @@ export class Rect extends Polygon {
|
|
|
5161
5804
|
* @public
|
|
5162
5805
|
* @type {number}
|
|
5163
5806
|
* @name centerY
|
|
5164
|
-
* @memberof Rect
|
|
5807
|
+
* @memberof Rect.prototype
|
|
5165
5808
|
*/
|
|
5166
5809
|
public get centerY(): number;
|
|
5167
5810
|
/**
|
|
@@ -5444,7 +6087,7 @@ export class Renderable extends Rect {
|
|
|
5444
6087
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
5445
6088
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
5446
6089
|
* @public
|
|
5447
|
-
* @type {Rect|Polygon|Line|Ellipse}
|
|
6090
|
+
* @type {Rect|RoundRect|Polygon|Line|Ellipse}
|
|
5448
6091
|
* @name mask
|
|
5449
6092
|
* @default undefined
|
|
5450
6093
|
* @memberof Renderable#
|
|
@@ -5464,7 +6107,7 @@ export class Renderable extends Rect {
|
|
|
5464
6107
|
* {x: -14, y: 30}
|
|
5465
6108
|
* ]);
|
|
5466
6109
|
*/
|
|
5467
|
-
public mask: Rect | Polygon | Line | Ellipse;
|
|
6110
|
+
public mask: Rect | RoundRect | Polygon | Line | Ellipse;
|
|
5468
6111
|
/**
|
|
5469
6112
|
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
5470
6113
|
* @public
|
|
@@ -5828,11 +6471,18 @@ export class Renderer {
|
|
|
5828
6471
|
/**
|
|
5829
6472
|
* true if the current rendering context is valid
|
|
5830
6473
|
* @name isContextValid
|
|
5831
|
-
* @memberof Renderer
|
|
6474
|
+
* @memberof Renderer#
|
|
5832
6475
|
* @default true
|
|
5833
6476
|
* type {boolean}
|
|
5834
6477
|
*/
|
|
5835
6478
|
isContextValid: boolean;
|
|
6479
|
+
/**
|
|
6480
|
+
* The Path2D instance used by the renderer to draw primitives
|
|
6481
|
+
* @name path2D
|
|
6482
|
+
* @type {Path2D}
|
|
6483
|
+
* @memberof Renderer#
|
|
6484
|
+
*/
|
|
6485
|
+
path2D: Path2D;
|
|
5836
6486
|
/**
|
|
5837
6487
|
* @ignore
|
|
5838
6488
|
*/
|
|
@@ -5978,10 +6628,18 @@ export class Renderer {
|
|
|
5978
6628
|
* @name stroke
|
|
5979
6629
|
* @memberof Renderer.prototype
|
|
5980
6630
|
* @function
|
|
5981
|
-
* @param {Rect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
6631
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
5982
6632
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
5983
6633
|
*/
|
|
5984
|
-
stroke(shape: Rect | Polygon | Line | Ellipse, fill?: boolean): void;
|
|
6634
|
+
stroke(shape: Rect | RoundRect | Polygon | Line | Ellipse, fill?: boolean): void;
|
|
6635
|
+
/**
|
|
6636
|
+
* fill the given shape
|
|
6637
|
+
* @name fill
|
|
6638
|
+
* @memberof Renderer.prototype
|
|
6639
|
+
* @function
|
|
6640
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
6641
|
+
*/
|
|
6642
|
+
fill(shape: Rect | RoundRect | Polygon | Line | Ellipse): void;
|
|
5985
6643
|
/**
|
|
5986
6644
|
* tint the given image or canvas using the given color
|
|
5987
6645
|
* @name tint
|
|
@@ -5993,14 +6651,6 @@ export class Renderer {
|
|
|
5993
6651
|
* @returns {HTMLCanvasElement|OffscreenCanvas} a new canvas element representing the tinted image
|
|
5994
6652
|
*/
|
|
5995
6653
|
tint(src: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas, color: Color | string, mode?: string): HTMLCanvasElement | OffscreenCanvas;
|
|
5996
|
-
/**
|
|
5997
|
-
* fill the given shape
|
|
5998
|
-
* @name fill
|
|
5999
|
-
* @memberof Renderer.prototype
|
|
6000
|
-
* @function
|
|
6001
|
-
* @param {Rect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
6002
|
-
*/
|
|
6003
|
-
fill(shape: Rect | Polygon | Line | Ellipse): void;
|
|
6004
6654
|
/**
|
|
6005
6655
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
6006
6656
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
@@ -6008,9 +6658,9 @@ export class Renderer {
|
|
|
6008
6658
|
* @name setMask
|
|
6009
6659
|
* @memberof Renderer.prototype
|
|
6010
6660
|
* @function
|
|
6011
|
-
* @param {Rect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
6661
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
6012
6662
|
*/
|
|
6013
|
-
setMask(mask?: Rect | Polygon | Line | Ellipse): void;
|
|
6663
|
+
setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse): void;
|
|
6014
6664
|
/**
|
|
6015
6665
|
* disable (remove) the rendering mask set through setMask.
|
|
6016
6666
|
* @name clearMask
|
|
@@ -6042,6 +6692,60 @@ export class Renderer {
|
|
|
6042
6692
|
drawFont(): void;
|
|
6043
6693
|
get Texture(): typeof TextureAtlas;
|
|
6044
6694
|
}
|
|
6695
|
+
/**
|
|
6696
|
+
* @classdesc
|
|
6697
|
+
* a rectangle object with rounded corners
|
|
6698
|
+
* @augments Rect
|
|
6699
|
+
*/
|
|
6700
|
+
export class RoundRect extends Rect {
|
|
6701
|
+
/**
|
|
6702
|
+
* @param {number} x position of the rounded rectangle
|
|
6703
|
+
* @param {number} y position of the rounded rectangle
|
|
6704
|
+
* @param {number} width the rectangle width
|
|
6705
|
+
* @param {number} height the rectangle height
|
|
6706
|
+
* @param {number} [radius=20] the radius of the rounded corner
|
|
6707
|
+
*/
|
|
6708
|
+
constructor(x: number, y: number, width: number, height: number, radius?: number);
|
|
6709
|
+
public set radius(arg: number);
|
|
6710
|
+
/**
|
|
6711
|
+
* the radius of the rounded corner
|
|
6712
|
+
* @public
|
|
6713
|
+
* @type {number}
|
|
6714
|
+
* @default 20
|
|
6715
|
+
* @name radius
|
|
6716
|
+
* @memberof RoundRect.prototype
|
|
6717
|
+
*/
|
|
6718
|
+
public get radius(): number;
|
|
6719
|
+
/** @ignore */
|
|
6720
|
+
onResetEvent(x: any, y: any, w: any, h: any, radius: any): void;
|
|
6721
|
+
_radius: number;
|
|
6722
|
+
/**
|
|
6723
|
+
* copy the position, size and radius of the given rounded rectangle into this one
|
|
6724
|
+
* @name copy
|
|
6725
|
+
* @memberof RoundRect.prototype
|
|
6726
|
+
* @function
|
|
6727
|
+
* @param {RoundRect} rrect source rounded rectangle
|
|
6728
|
+
* @returns {RoundRect} new rectangle
|
|
6729
|
+
*/
|
|
6730
|
+
copy(rrect: RoundRect): RoundRect;
|
|
6731
|
+
/**
|
|
6732
|
+
* check if this RoundRect is identical to the specified one
|
|
6733
|
+
* @name equals
|
|
6734
|
+
* @memberof RoundRect.prototype
|
|
6735
|
+
* @function
|
|
6736
|
+
* @param {RoundRect} rrect
|
|
6737
|
+
* @returns {boolean} true if equals
|
|
6738
|
+
*/
|
|
6739
|
+
equals(rrect: RoundRect): boolean;
|
|
6740
|
+
/**
|
|
6741
|
+
* clone this RoundRect
|
|
6742
|
+
* @name clone
|
|
6743
|
+
* @memberof RoundRect.prototype
|
|
6744
|
+
* @function
|
|
6745
|
+
* @returns {RoundRect} new RoundRect
|
|
6746
|
+
*/
|
|
6747
|
+
clone(): RoundRect;
|
|
6748
|
+
}
|
|
6045
6749
|
/**
|
|
6046
6750
|
* @classdesc
|
|
6047
6751
|
* An object to display a fixed or animated sprite on screen.
|
|
@@ -6129,7 +6833,7 @@ export class Sprite extends Renderable {
|
|
|
6129
6833
|
current: {
|
|
6130
6834
|
name: string;
|
|
6131
6835
|
length: number;
|
|
6132
|
-
offset:
|
|
6836
|
+
offset: any;
|
|
6133
6837
|
width: number;
|
|
6134
6838
|
height: number;
|
|
6135
6839
|
angle: number;
|
|
@@ -6341,11 +7045,11 @@ export class Stage {
|
|
|
6341
7045
|
* Cameras will be renderered based on this order defined in this list.
|
|
6342
7046
|
* Only the "default" camera will be resized when the window or canvas is resized.
|
|
6343
7047
|
* @public
|
|
6344
|
-
* @type {Map}
|
|
7048
|
+
* @type {Map<Camera2d>}
|
|
6345
7049
|
* @name cameras
|
|
6346
7050
|
* @memberof Stage
|
|
6347
7051
|
*/
|
|
6348
|
-
public cameras: Map<
|
|
7052
|
+
public cameras: Map<Camera2d, any>;
|
|
6349
7053
|
/**
|
|
6350
7054
|
* The given constructor options
|
|
6351
7055
|
* @public
|
|
@@ -8795,7 +9499,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
8795
9499
|
/**
|
|
8796
9500
|
* The WebGL version used by this renderer (1 or 2)
|
|
8797
9501
|
* @name WebGLVersion
|
|
8798
|
-
* @memberof WebGLRenderer
|
|
9502
|
+
* @memberof WebGLRenderer#
|
|
8799
9503
|
* @type {number}
|
|
8800
9504
|
* @default 1
|
|
8801
9505
|
* @readonly
|
|
@@ -8804,7 +9508,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
8804
9508
|
/**
|
|
8805
9509
|
* The vendor string of the underlying graphics driver.
|
|
8806
9510
|
* @name GPUVendor
|
|
8807
|
-
* @memberof WebGLRenderer
|
|
9511
|
+
* @memberof WebGLRenderer#
|
|
8808
9512
|
* @type {string}
|
|
8809
9513
|
* @default null
|
|
8810
9514
|
* @readonly
|
|
@@ -8813,7 +9517,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
8813
9517
|
/**
|
|
8814
9518
|
* The renderer string of the underlying graphics driver.
|
|
8815
9519
|
* @name GPURenderer
|
|
8816
|
-
* @memberof WebGLRenderer
|
|
9520
|
+
* @memberof WebGLRenderer#
|
|
8817
9521
|
* @type {string}
|
|
8818
9522
|
* @default null
|
|
8819
9523
|
* @readonly
|
|
@@ -8822,7 +9526,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
8822
9526
|
/**
|
|
8823
9527
|
* The WebGL context
|
|
8824
9528
|
* @name gl
|
|
8825
|
-
* @memberof WebGLRenderer
|
|
9529
|
+
* @memberof WebGLRenderer#
|
|
8826
9530
|
* type {WebGLRenderingContext}
|
|
8827
9531
|
*/
|
|
8828
9532
|
context: WebGLRenderingContext;
|
|
@@ -8830,7 +9534,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
8830
9534
|
/**
|
|
8831
9535
|
* Maximum number of texture unit supported under the current context
|
|
8832
9536
|
* @name maxTextures
|
|
8833
|
-
* @memberof WebGLRenderer
|
|
9537
|
+
* @memberof WebGLRenderer#
|
|
8834
9538
|
* @type {number}
|
|
8835
9539
|
* @readonly
|
|
8836
9540
|
*/
|
|
@@ -8851,10 +9555,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
8851
9555
|
* @ignore
|
|
8852
9556
|
*/
|
|
8853
9557
|
_blendStack: any[];
|
|
8854
|
-
/**
|
|
8855
|
-
* @ignore
|
|
8856
|
-
*/
|
|
8857
|
-
_glPoints: Vector2d[];
|
|
8858
9558
|
/**
|
|
8859
9559
|
* The current transformation matrix used for transformations on the overall scene
|
|
8860
9560
|
* @name currentTransform
|
|
@@ -8872,10 +9572,10 @@ export class WebGLRenderer extends Renderer {
|
|
|
8872
9572
|
/**
|
|
8873
9573
|
* The list of active compositors
|
|
8874
9574
|
* @name compositors
|
|
8875
|
-
* @type {Map}
|
|
9575
|
+
* @type {Map<WebGLCompositor>}
|
|
8876
9576
|
* @memberof WebGLRenderer#
|
|
8877
9577
|
*/
|
|
8878
|
-
compositors: Map<
|
|
9578
|
+
compositors: Map<WebGLCompositor, any>;
|
|
8879
9579
|
cache: TextureCache;
|
|
8880
9580
|
/**
|
|
8881
9581
|
* set the active compositor for this renderer
|
|
@@ -9084,6 +9784,14 @@ export class WebGLRenderer extends Renderer {
|
|
|
9084
9784
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
9085
9785
|
*/
|
|
9086
9786
|
setGlobalAlpha(alpha: number): void;
|
|
9787
|
+
/**
|
|
9788
|
+
* Return the global alpha
|
|
9789
|
+
* @name getGlobalAlpha
|
|
9790
|
+
* @memberof WebGLRenderer.prototype
|
|
9791
|
+
* @function
|
|
9792
|
+
* @returns {number} global alpha value
|
|
9793
|
+
*/
|
|
9794
|
+
getGlobalAlpha(): number;
|
|
9087
9795
|
/**
|
|
9088
9796
|
* Set the current fill & stroke style color.
|
|
9089
9797
|
* By default, or upon reset, the value is set to #000000.
|
|
@@ -9127,7 +9835,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
9127
9835
|
* @param {number} end end angle in radians
|
|
9128
9836
|
* @param {boolean} [antiClockwise=false] draw arc anti-clockwise
|
|
9129
9837
|
*/
|
|
9130
|
-
fillArc(x: number, y: number, radius: number, start: number, end: number): void;
|
|
9838
|
+
fillArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean): void;
|
|
9131
9839
|
/**
|
|
9132
9840
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
9133
9841
|
* @name strokeEllipse
|
|
@@ -9213,6 +9921,31 @@ export class WebGLRenderer extends Renderer {
|
|
|
9213
9921
|
* @param {number} height
|
|
9214
9922
|
*/
|
|
9215
9923
|
fillRect(x: number, y: number, width: number, height: number): void;
|
|
9924
|
+
/**
|
|
9925
|
+
* Stroke a rounded rectangle at the specified coordinates
|
|
9926
|
+
* @name strokeRoundRect
|
|
9927
|
+
* @memberof WebGLRenderer.prototype
|
|
9928
|
+
* @function
|
|
9929
|
+
* @param {number} x
|
|
9930
|
+
* @param {number} y
|
|
9931
|
+
* @param {number} width
|
|
9932
|
+
* @param {number} height
|
|
9933
|
+
* @param {number} radius
|
|
9934
|
+
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
9935
|
+
*/
|
|
9936
|
+
strokeRoundRect(x: number, y: number, width: number, height: number, radius: number, fill?: boolean): void;
|
|
9937
|
+
/**
|
|
9938
|
+
* Draw a rounded filled rectangle at the specified coordinates
|
|
9939
|
+
* @name fillRoundRect
|
|
9940
|
+
* @memberof WebGLRenderer.prototype
|
|
9941
|
+
* @function
|
|
9942
|
+
* @param {number} x
|
|
9943
|
+
* @param {number} y
|
|
9944
|
+
* @param {number} width
|
|
9945
|
+
* @param {number} height
|
|
9946
|
+
* @param {number} radius
|
|
9947
|
+
*/
|
|
9948
|
+
fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
9216
9949
|
/**
|
|
9217
9950
|
* Reset (overrides) the renderer transformation matrix to the
|
|
9218
9951
|
* identity one, and then apply the given transformation matrix.
|
|
@@ -9306,9 +10039,9 @@ export class World extends Container {
|
|
|
9306
10039
|
* @name bodies
|
|
9307
10040
|
* @memberof World
|
|
9308
10041
|
* @public
|
|
9309
|
-
* @type {Set}
|
|
10042
|
+
* @type {Set<Body>}
|
|
9310
10043
|
*/
|
|
9311
|
-
public bodies: Set<
|
|
10044
|
+
public bodies: Set<Body>;
|
|
9312
10045
|
/**
|
|
9313
10046
|
* the instance of the game world quadtree used for broadphase
|
|
9314
10047
|
* @name broadphase
|
|
@@ -10396,16 +11129,12 @@ export var plugin: any;
|
|
|
10396
11129
|
* @namespace plugins
|
|
10397
11130
|
*/
|
|
10398
11131
|
export var plugins: {};
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
exists: typeof exists;
|
|
10406
|
-
poolable: typeof poolable;
|
|
10407
|
-
getInstanceCount: typeof getInstanceCount;
|
|
10408
|
-
}>;
|
|
11132
|
+
/**
|
|
11133
|
+
* a default global object pool instance
|
|
11134
|
+
* @public
|
|
11135
|
+
* @type {ObjectPool}
|
|
11136
|
+
*/
|
|
11137
|
+
declare var pool$1: ObjectPool;
|
|
10409
11138
|
export namespace save {
|
|
10410
11139
|
/**
|
|
10411
11140
|
* Add new keys to localStorage and set them to the given default values if they do not exist
|
|
@@ -11060,6 +11789,7 @@ declare class Bounds {
|
|
|
11060
11789
|
* @param {Vector2d[]} [vertices] an array of me.Vector2d points
|
|
11061
11790
|
*/
|
|
11062
11791
|
constructor(vertices?: Vector2d[]);
|
|
11792
|
+
_center: Vector2d;
|
|
11063
11793
|
/**
|
|
11064
11794
|
* @ignore
|
|
11065
11795
|
*/
|
|
@@ -11072,7 +11802,6 @@ declare class Bounds {
|
|
|
11072
11802
|
x: number;
|
|
11073
11803
|
y: number;
|
|
11074
11804
|
};
|
|
11075
|
-
_center: Vector2d;
|
|
11076
11805
|
/**
|
|
11077
11806
|
* reset the bound
|
|
11078
11807
|
* @name clear
|
|
@@ -12207,6 +12936,7 @@ declare function setGamepadDeadzone(value: number): void;
|
|
|
12207
12936
|
*/
|
|
12208
12937
|
declare function addMapping(id: any, mapping: any): void;
|
|
12209
12938
|
/**
|
|
12939
|
+
* @classdesc
|
|
12210
12940
|
* This object is used for object pooling - a technique that might speed up your game if used properly.<br>
|
|
12211
12941
|
* If some of your classes will be instantiated and removed a lot at a time, it is a
|
|
12212
12942
|
* good idea to add the class to this object pool. A separate pool for that class
|
|
@@ -12217,96 +12947,93 @@ declare function addMapping(id: any, mapping: any): void;
|
|
|
12217
12947
|
* which means, that on level loading the engine will try to instantiate every object
|
|
12218
12948
|
* found in the map, based on the user defined name in each Object Properties<br>
|
|
12219
12949
|
* <img src="images/object_properties.png"/><br>
|
|
12220
|
-
* @
|
|
12221
|
-
*/
|
|
12222
|
-
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
|
|
12251
|
-
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
/**
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
* @returns {number} amount of object instance
|
|
12308
|
-
*/
|
|
12309
|
-
declare function getInstanceCount(): number;
|
|
12950
|
+
* @see {@link pool} a default global instance of ObjectPool
|
|
12951
|
+
*/
|
|
12952
|
+
declare class ObjectPool {
|
|
12953
|
+
objectClass: {};
|
|
12954
|
+
instance_counter: number;
|
|
12955
|
+
/**
|
|
12956
|
+
* register an object to the pool. <br>
|
|
12957
|
+
* Pooling must be set to true if more than one such objects will be created. <br>
|
|
12958
|
+
* (Note: for an object to be poolable, it must implements a `onResetEvent` method)
|
|
12959
|
+
* @param {string} className as defined in the Name field of the Object Properties (in Tiled)
|
|
12960
|
+
* @param {object} classObj corresponding Class to be instantiated
|
|
12961
|
+
* @param {boolean} [recycling=false] enables object recycling for the specified class
|
|
12962
|
+
* @example
|
|
12963
|
+
* // implement CherryEntity
|
|
12964
|
+
* class CherryEntity extends Spritesheet {
|
|
12965
|
+
* onResetEvent() {
|
|
12966
|
+
* // reset object mutable properties
|
|
12967
|
+
* this.lifeBar = 100;
|
|
12968
|
+
* }
|
|
12969
|
+
* };
|
|
12970
|
+
* // add our users defined entities in the object pool and enable object recycling
|
|
12971
|
+
* me.pool.register("cherryentity", CherryEntity, true);
|
|
12972
|
+
*/
|
|
12973
|
+
register(className: string, classObj: object, recycling?: boolean): void;
|
|
12974
|
+
/**
|
|
12975
|
+
* Pull a new instance of the requested object (if added into the object pool)
|
|
12976
|
+
* @param {string} name as used in {@link pool.register}
|
|
12977
|
+
* @param {object} [...arguments] arguments to be passed when instantiating/reinitializing the object
|
|
12978
|
+
* @returns {object} the instance of the requested object
|
|
12979
|
+
* @example
|
|
12980
|
+
* me.pool.register("bullet", BulletEntity, true);
|
|
12981
|
+
* me.pool.register("enemy", EnemyEntity, true);
|
|
12982
|
+
* // ...
|
|
12983
|
+
* // when we need to manually create a new bullet:
|
|
12984
|
+
* var bullet = me.pool.pull("bullet", x, y, direction);
|
|
12985
|
+
* // ...
|
|
12986
|
+
* // params aren't a fixed number
|
|
12987
|
+
* // when we need new enemy we can add more params, that the object construct requires:
|
|
12988
|
+
* var enemy = me.pool.pull("enemy", x, y, direction, speed, power, life);
|
|
12989
|
+
* // ...
|
|
12990
|
+
* // when we want to destroy existing object, the remove
|
|
12991
|
+
* // function will ensure the object can then be reallocated later
|
|
12992
|
+
* me.game.world.removeChild(enemy);
|
|
12993
|
+
* me.game.world.removeChild(bullet);
|
|
12994
|
+
*/
|
|
12995
|
+
pull(name: string, ...args: any[]): object;
|
|
12996
|
+
/**
|
|
12997
|
+
* purge the object pool from any inactive object <br>
|
|
12998
|
+
* Object pooling must be enabled for this function to work<br>
|
|
12999
|
+
* note: this will trigger the garbage collector
|
|
13000
|
+
*/
|
|
13001
|
+
purge(): void;
|
|
13002
|
+
/**
|
|
13003
|
+
* Push back an object instance into the object pool <br>
|
|
13004
|
+
* Object pooling for the object class must be enabled,
|
|
13005
|
+
* and object must have been instantiated using {@link pool#pull},
|
|
13006
|
+
* otherwise this function won't work
|
|
13007
|
+
* @throws will throw an error if the object cannot be recycled
|
|
13008
|
+
* @param {object} obj instance to be recycled
|
|
13009
|
+
* @param {boolean} [throwOnError=true] throw an exception if the object cannot be recycled
|
|
13010
|
+
* @returns {boolean} true if the object was successfully recycled in the object pool
|
|
13011
|
+
*/
|
|
13012
|
+
push(obj: object, throwOnError?: boolean): boolean;
|
|
13013
|
+
/**
|
|
13014
|
+
* Check if an object with the provided name is registered
|
|
13015
|
+
* @param {string} name of the registered object class
|
|
13016
|
+
* @returns {boolean} true if the classname is registered
|
|
13017
|
+
*/
|
|
13018
|
+
exists(name: string): boolean;
|
|
13019
|
+
/**
|
|
13020
|
+
* Check if an object is poolable
|
|
13021
|
+
* (was properly registered with the recycling feature enable)
|
|
13022
|
+
* @see register
|
|
13023
|
+
* @param {object} obj object to be checked
|
|
13024
|
+
* @returns {boolean} true if the object is poolable
|
|
13025
|
+
* @example
|
|
13026
|
+
* if (!me.pool.poolable(myCherryEntity)) {
|
|
13027
|
+
* // object was not properly registered
|
|
13028
|
+
* }
|
|
13029
|
+
*/
|
|
13030
|
+
poolable(obj: object): boolean;
|
|
13031
|
+
/**
|
|
13032
|
+
* returns the amount of object instance currently in the pool
|
|
13033
|
+
* @returns {number} amount of object instance
|
|
13034
|
+
*/
|
|
13035
|
+
getInstanceCount(): number;
|
|
13036
|
+
}
|
|
12310
13037
|
declare var agentUtils: Readonly<{
|
|
12311
13038
|
__proto__: any;
|
|
12312
13039
|
prefixed: typeof prefixed;
|
|
@@ -12599,4 +13326,4 @@ declare function defer(func: Function, thisArg: object, ...args: any[]): number;
|
|
|
12599
13326
|
* @returns {Function} the function that will be throttled
|
|
12600
13327
|
*/
|
|
12601
13328
|
declare function throttle(fn: Function, delay: number, no_trailing: any): Function;
|
|
12602
|
-
export { Bounds$1 as Bounds, math as Math, device$1 as device, event$1 as event,
|
|
13329
|
+
export { Bounds$1 as Bounds, math as Math, device$1 as device, event$1 as event, pool$1 as pool, timer$1 as timer };
|