melonjs 19.3.0 → 19.5.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 +19 -2
- package/build/application/application.d.ts.map +1 -1
- package/build/application/defaultApplicationSettings.d.ts +1 -0
- package/build/application/defaultApplicationSettings.d.ts.map +1 -1
- package/build/application/settings.d.ts +37 -2
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +77 -253
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend.d.ts +121 -0
- package/build/audio/backend.d.ts.map +1 -0
- package/build/audio/playback.d.ts +157 -0
- package/build/audio/playback.d.ts.map +1 -0
- package/build/audio/procedural.d.ts +105 -0
- package/build/audio/procedural.d.ts.map +1 -0
- package/build/audio/types.d.ts +205 -0
- package/build/audio/types.d.ts.map +1 -0
- package/build/index.d.ts +6 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3334 -498
- package/build/index.js.map +4 -4
- package/build/input/pointerevent.d.ts.map +1 -1
- package/build/level/tiled/TMXLayer.d.ts +72 -5
- package/build/level/tiled/TMXLayer.d.ts.map +1 -1
- package/build/level/tiled/TMXTile.d.ts +19 -1
- package/build/level/tiled/TMXTile.d.ts.map +1 -1
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts +27 -0
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/factories/shape.d.ts +1 -1
- package/build/level/tiled/factories/shape.d.ts.map +1 -1
- package/build/level/tiled/factories/tile.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts +7 -1
- package/build/level/tiled/renderer/TMXHexagonalRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts +7 -1
- package/build/level/tiled/renderer/TMXIsometricRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXObliqueRenderer.d.ts.map +1 -1
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts +7 -1
- package/build/level/tiled/renderer/TMXOrthogonalRenderer.d.ts.map +1 -1
- package/build/loader/loader.d.ts +2 -2
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/aseprite.d.ts +37 -0
- package/build/loader/parsers/aseprite.d.ts.map +1 -0
- package/build/physics/adapter.d.ts +560 -0
- package/build/physics/adapter.d.ts.map +1 -0
- package/build/physics/bounds.d.ts +18 -5
- package/build/physics/bounds.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +605 -0
- package/build/physics/builtin/body.d.ts.map +1 -0
- package/build/physics/builtin/builtin-adapter.d.ts +91 -0
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -0
- package/build/physics/builtin/detector.d.ts +167 -0
- package/build/physics/builtin/detector.d.ts.map +1 -0
- package/build/physics/builtin/quadtree.d.ts +112 -0
- package/build/physics/builtin/quadtree.d.ts.map +1 -0
- package/build/physics/builtin/raycast.d.ts +4 -0
- package/build/physics/builtin/raycast.d.ts.map +1 -0
- package/build/physics/{sat.d.ts → builtin/sat.d.ts} +7 -7
- package/build/physics/builtin/sat.d.ts.map +1 -0
- package/build/physics/world.d.ts +77 -26
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/collectable.d.ts +7 -1
- package/build/renderable/collectable.d.ts.map +1 -1
- package/build/renderable/container.d.ts +0 -13
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/imagelayer.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +78 -17
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +14 -1
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
- package/build/system/timer.d.ts +0 -5
- package/build/system/timer.d.ts.map +1 -1
- package/build/utils/function.d.ts +1 -1
- package/build/utils/function.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +0 -130
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/renderer.d.ts +126 -1
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts.map +1 -1
- package/build/video/texture/resource.d.ts +113 -0
- package/build/video/texture/resource.d.ts.map +1 -0
- package/build/video/webgl/batchers/material_batcher.d.ts +8 -1
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/effects/shine.d.ts +87 -0
- package/build/video/webgl/effects/shine.d.ts.map +1 -0
- package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts +108 -0
- package/build/video/webgl/renderers/tmxlayer/orthogonal.d.ts.map +1 -0
- package/build/video/webgl/utils/attributes.d.ts +7 -0
- package/build/video/webgl/utils/attributes.d.ts.map +1 -1
- package/build/video/webgl/utils/precision.d.ts +1 -1
- package/build/video/webgl/utils/precision.d.ts.map +1 -1
- package/build/video/webgl/utils/uniforms.d.ts +13 -0
- package/build/video/webgl/utils/uniforms.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +19 -106
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/build/physics/body.d.ts +0 -351
- package/build/physics/body.d.ts.map +0 -1
- package/build/physics/detector.d.ts +0 -72
- package/build/physics/detector.d.ts.map +0 -1
- package/build/physics/quadtree.d.ts +0 -69
- package/build/physics/quadtree.d.ts.map +0 -1
- package/build/physics/sat.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/renderable/container.js"],"names":[],"mappings":"AA4CA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;GASG;AACH;IACC;;;;;;;OAOG;IACH,gBAPW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,SACN,OAAO,EA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;IAhCA;;;;;;;;;OASG;IACH,OAHU,QAAQ,CAGqB;IAuCxC,kBAPU,MAAM,EA2Bf;IAnCD;;;;;;;;;;OAUG;IACH,cAHU,MAAM,CAKf;IAGA,4BAAoB;IAGlB,6BAAoB;IACpB,6BAAoB;IAkBvB,wBAsBC;IAED;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAOhB;IAED;;;OAGG;IACH,sBAKC;IAJA,cAGC;IAGF;;;OAGG;IACH,oBA+CC;IAED;;;;;;;;;;;;;;;OAeG;IACH,6BAmBC;IAED;;;;;OAKG;IACH,yBAHW,cAAc,GAAC,aAAa,aAC5B,QAAQ,
|
|
1
|
+
{"version":3,"file":"imagelayer.d.ts","sourceRoot":"","sources":["../../src/renderable/imagelayer.js"],"names":[],"mappings":"AAYA;;;GAGG;AAEH;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;OAgBG;IACH,eAhBW,MAAM,KACN,MAAM,YAEd;QAA4E,KAAK,EAAzE,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,MAAM;QACvC,IAAI;QACJ,CAAC;QACQ,KAAK;QACsB,MAAM;QACjC,WAAW;KAC9C,EAoDF;IAhCA;;;;;;;;;OASG;IACH,OAHU,QAAQ,CAGqB;IAuCxC,kBAPU,MAAM,EA2Bf;IAnCD;;;;;;;;;;OAUG;IACH,cAHU,MAAM,CAKf;IAGA,4BAAoB;IAGlB,6BAAoB;IACpB,6BAAoB;IAkBvB,wBAsBC;IAED;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAOhB;IAED;;;OAGG;IACH,sBAKC;IAJA,cAGC;IAGF;;;OAGG;IACH,oBA+CC;IAED;;;;;;;;;;;;;;;OAeG;IACH,6BAmBC;IAED;;;;;OAKG;IACH,yBAHW,cAAc,GAAC,aAAa,aAC5B,QAAQ,QAyElB;IAGD,0BAMC;CAWD;mBA5VkB,aAAa;8BAIL,qBAAqB"}
|
|
@@ -40,8 +40,13 @@ export default class Renderable extends Rect {
|
|
|
40
40
|
*/
|
|
41
41
|
currentTransform: Matrix3d;
|
|
42
42
|
/**
|
|
43
|
-
* the renderable
|
|
44
|
-
* @
|
|
43
|
+
* the renderable physics body — the handle returned by the
|
|
44
|
+
* active {@link PhysicsAdapter}'s `addBody` (or constructed
|
|
45
|
+
* imperatively via `new Body(...)`). Typed as the portable
|
|
46
|
+
* {@link PhysicsBody} interface; cast to the adapter-specific
|
|
47
|
+
* concrete type (`MatterAdapter.Body`, `BuiltinAdapter.Body`, or
|
|
48
|
+
* the legacy {@link Body} class) to reach native fields.
|
|
49
|
+
* @type {PhysicsBody}
|
|
45
50
|
* @example
|
|
46
51
|
* // define a new Player Class
|
|
47
52
|
* class PlayerEntity extends me.Sprite {
|
|
@@ -75,7 +80,28 @@ export default class Renderable extends Rect {
|
|
|
75
80
|
*
|
|
76
81
|
* }
|
|
77
82
|
*/
|
|
78
|
-
body:
|
|
83
|
+
body: PhysicsBody;
|
|
84
|
+
/**
|
|
85
|
+
* Declarative body definition consumed by the active
|
|
86
|
+
* {@link PhysicsAdapter} when this renderable is added to a
|
|
87
|
+
* container. **Adapter API only** — leave `undefined` if you
|
|
88
|
+
* build a body imperatively via `this.body = new Body(...)`.
|
|
89
|
+
*
|
|
90
|
+
* When set, the parent container forwards it to
|
|
91
|
+
* `world.adapter.addBody(this, this.bodyDef)`, which constructs
|
|
92
|
+
* the underlying physics body (matter, builtin SAT, …) and
|
|
93
|
+
* assigns the engine-portable wrapper to `this.body`. This is
|
|
94
|
+
* the engine-portable path: the same `bodyDef` produces an
|
|
95
|
+
* equivalent body under any adapter.
|
|
96
|
+
*
|
|
97
|
+
* Typical fields: `type` (`"static"`/`"dynamic"`/`"kinematic"`),
|
|
98
|
+
* `shapes`, `collisionType`, `collisionMask`, `restitution`,
|
|
99
|
+
* `frictionAir`, `density`, `gravityScale`, `isSensor`,
|
|
100
|
+
* `maxVelocity`, `fixedRotation`. See {@link BodyDefinition}.
|
|
101
|
+
* @type {object|undefined}
|
|
102
|
+
* @default undefined
|
|
103
|
+
*/
|
|
104
|
+
bodyDef: object | undefined;
|
|
79
105
|
/**
|
|
80
106
|
* (G)ame (U)nique (Id)entifier" <br>
|
|
81
107
|
* a GUID will be allocated for any renderable object added <br>
|
|
@@ -482,26 +508,42 @@ export default class Renderable extends Rect {
|
|
|
482
508
|
*/
|
|
483
509
|
postDraw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
484
510
|
/**
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
511
|
+
* Legacy collision callback — fires every frame this renderable body is
|
|
512
|
+
* overlapping another body. Kept for backward compatibility with code
|
|
513
|
+
* written against pre-19.5 melonJS; semantics are unchanged from the
|
|
514
|
+
* 19.4 contract.
|
|
515
|
+
*
|
|
516
|
+
* **NOTE — `onCollision` is NOT equivalent to {@link Renderable.onCollisionActive}.**
|
|
517
|
+
* The two handlers exist side by side and have intentionally different
|
|
518
|
+
* contracts:
|
|
519
|
+
*
|
|
520
|
+
* | | `onCollision` (legacy) | `onCollisionActive` (modern) |
|
|
521
|
+
* |---|---|---|
|
|
522
|
+
* | Cadence for dynamic-dynamic pairs | 2× per frame per side | 1× per frame per side |
|
|
523
|
+
* | `response.a` semantics | Fixed per pair (first body in detector call) | Always the receiver (`response.a === this`) |
|
|
524
|
+
* | `response.b` semantics | Fixed per pair | Always the partner (`response.b === other`) |
|
|
525
|
+
* | `response.normal` / `response.depth` | ✗ | ✓ — `normal.y < -0.7` = "push me up" |
|
|
526
|
+
* | `return false` to skip push-out | ✓ (honored by SAT) | ✗ — use `bodyDef.isSensor` or `setSensor` instead |
|
|
527
|
+
*
|
|
528
|
+
* If you're writing new code, prefer `onCollisionActive`. Keep
|
|
529
|
+
* `onCollision` only when its every-frame, return-false, fixed-`a`/`b`
|
|
530
|
+
* semantics are what you want.
|
|
531
|
+
*
|
|
532
|
+
* @param {import("../physics/adapter.ts").CollisionResponse} response - the collision response object
|
|
488
533
|
* @param {Renderable} other - the other renderable touching this one (a reference to response.a or response.b)
|
|
489
|
-
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
534
|
+
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected); the return value is only honored by the builtin SAT adapter.
|
|
490
535
|
* @example
|
|
491
|
-
* // collision handler
|
|
536
|
+
* // legacy collision handler — note the receiver-side check on response.a
|
|
492
537
|
* onCollision(response) {
|
|
493
538
|
* if (response.b.body.collisionType === me.collision.types.ENEMY_OBJECT) {
|
|
494
|
-
* // makes the other object solid, by substracting the overlap vector to the current position
|
|
495
539
|
* this.pos.sub(response.overlapV);
|
|
496
540
|
* this.hurt();
|
|
497
|
-
* //
|
|
498
|
-
* return false;
|
|
541
|
+
* return false; // skip the SAT push-out
|
|
499
542
|
* }
|
|
500
|
-
* // Make the object solid
|
|
501
543
|
* return true;
|
|
502
|
-
* }
|
|
544
|
+
* }
|
|
503
545
|
*/
|
|
504
|
-
onCollision(): boolean;
|
|
546
|
+
onCollision(_response: any, _other: any): boolean;
|
|
505
547
|
/**
|
|
506
548
|
* Destroy function<br>
|
|
507
549
|
* @ignore
|
|
@@ -509,14 +551,33 @@ export default class Renderable extends Rect {
|
|
|
509
551
|
destroy(...args: any[]): void;
|
|
510
552
|
/**
|
|
511
553
|
* OnDestroy Notification function<br>
|
|
512
|
-
* Called by engine before deleting the object
|
|
554
|
+
* Called by engine before deleting the object. `Stage.destroy(app)`
|
|
555
|
+
* forwards the active Application, so subclasses that wire teardown
|
|
556
|
+
* against the app object can override as `onDestroyEvent(app)`.
|
|
557
|
+
* @param {...*} _args - forwarded by `destroy(...args)`; Stage passes the Application instance
|
|
558
|
+
*/
|
|
559
|
+
onDestroyEvent(..._args: any[]): void;
|
|
560
|
+
/**
|
|
561
|
+
* Lifecycle hook fired by {@link Container} when this renderable is
|
|
562
|
+
* added to a container that is part of the active scene graph.
|
|
563
|
+
* Override to wire up input handlers, register external listeners,
|
|
564
|
+
* or grab adapter references — `this.parentApp` is guaranteed to be
|
|
565
|
+
* available here. Pair with {@link Renderable#onDeactivateEvent}.
|
|
566
|
+
* @param {...*} _args - forwarded by `Container.addChild`
|
|
567
|
+
*/
|
|
568
|
+
onActivateEvent(..._args: any[]): void;
|
|
569
|
+
/**
|
|
570
|
+
* Lifecycle hook fired by {@link Container} when this renderable is
|
|
571
|
+
* removed from its container or its container is itself removed.
|
|
572
|
+
* Override to release input handlers, unsubscribe from events, or
|
|
573
|
+
* drop adapter references. Pair with {@link Renderable#onActivateEvent}.
|
|
574
|
+
* @param {...*} _args - forwarded by `Container.removeChildNow`
|
|
513
575
|
*/
|
|
514
|
-
|
|
576
|
+
onDeactivateEvent(..._args: any[]): void;
|
|
515
577
|
}
|
|
516
578
|
import { Rect } from "./../geometries/rectangle.ts";
|
|
517
579
|
import { ObservablePoint } from "../geometries/observablePoint.ts";
|
|
518
580
|
import { Matrix3d } from "../math/matrix3d.ts";
|
|
519
|
-
import Body from "./../physics/body.js";
|
|
520
581
|
import type Container from "./container.js";
|
|
521
582
|
import type Entity from "./entity/entity.js";
|
|
522
583
|
import type { RoundRect } from "./../geometries/roundrect.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderable.d.ts","sourceRoot":"","sources":["../../src/renderable/renderable.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;IAaI;AAEJ;;;GAGG;AACH;IAkBG,iBAAmB;IAGpB;;;;;;;;;;OAUG;IACH,aAHU,eAAe,CAMvB;IAGD;;;;;;;OAOG;IACH,kBAFU,QAAQ,CAEoB;IAIvC
|
|
1
|
+
{"version":3,"file":"renderable.d.ts","sourceRoot":"","sources":["../../src/renderable/renderable.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;IAaI;AAEJ;;;GAGG;AACH;IAkBG,iBAAmB;IAGpB;;;;;;;;;;OAUG;IACH,aAHU,eAAe,CAMvB;IAGD;;;;;;;OAOG;IACH,kBAFU,QAAQ,CAEoB;IAIvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AU,CAKtB;IAED;;;;;;OAMG;IACH,aALW,MAAM,MACN,MAAM,MACN,MAAM,GACJ,UAAU,CAOtB;IAED;;;;OAIG;IAEH,WAJW,MAAM,GACJ,OAAO,CAKnB;IAED;;;;OAIG;IACH,wBAHW,OAAO,GACL,MAAM,CAwClB;IAED;;;OAGG;IACH,uBAFa,QAAQ,CAYpB;IAED;;;;;;OAMG;IACH,kBAFW,cAAc,GAAC,aAAa,QAoDtC;IAED;;;;;;;;;;;;OAYG;IAEH,eAJW,cAAc,GAAC,aAAa,aAC5B,QAAQ,QAKlB;IAED;;;;;OAKG;IACH,mBAFW,cAAc,GAAC,aAAa,QAqBtC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,0CAZa,OAAO,CAoBnB;IAkCD;;;OAGG;IACH,8BA2DC;IAED;;;;;;OAMG;IACH,yBAFc,GAAC,EAAA,QAId;IAED;;;;;;;OAOG;IACH,0BAFc,GAAC,EAAA,QAId;IAED;;;;;;OAMG;IACH,4BAFc,GAAC,EAAA,QAId;CACD;qBAhkCoB,8BAA8B;gCADnB,kCAAkC;yBAKzC,qBAAqB;2BAWpB,gBAAgB;wBADnB,oBAAoB;+BAKf,8BAA8B;6BADhC,0BAA0B;0BAF7B,yBAAyB;6BACtB,4BAA4B;6BAG1B,iCAAiC;gCAC9B,sCAAsC;+BACvC,oCAAoC"}
|
|
@@ -83,7 +83,13 @@ export default class Trigger extends Renderable {
|
|
|
83
83
|
triggerSettings: {
|
|
84
84
|
event: string;
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
bodyDef: {
|
|
87
|
+
type: string;
|
|
88
|
+
shapes: Rect[];
|
|
89
|
+
collisionType: number;
|
|
90
|
+
collisionMask: number;
|
|
91
|
+
isSensor: boolean;
|
|
92
|
+
};
|
|
87
93
|
/**
|
|
88
94
|
* @ignore
|
|
89
95
|
*/
|
|
@@ -95,6 +101,13 @@ export default class Trigger extends Renderable {
|
|
|
95
101
|
* @protected
|
|
96
102
|
*/
|
|
97
103
|
protected triggerEvent(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Fire the trigger when an entity first enters the trigger zone.
|
|
106
|
+
* Using `onCollisionStart` rather than `onCollision` so the event
|
|
107
|
+
* runs exactly once per entry — under the legacy alias this would
|
|
108
|
+
* fire every frame the entity was inside the trigger.
|
|
109
|
+
*/
|
|
110
|
+
onCollisionStart(): void;
|
|
98
111
|
}
|
|
99
112
|
import Renderable from "./renderable.js";
|
|
100
113
|
//# sourceMappingURL=trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/renderable/trigger.js"],"names":[],"mappings":"AASA;;;GAGG;AAEH;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACH,eAhDW,MAAM,KACN,MAAM,YAEd;QAA0B,KAAK;QACL,MAAM;QACqB,MAAM;QACjC,QAAQ;QACF,KAAK,GAA7B,MAAM,GAAC,KAAK;QACM,UAAU;QACD,KAAK,GAAhC,OAAO,GAAC,OAAO;QACG,KAAK;QACL,EAAE;QACQ,SAAS,GAArC,MAAM,GAAC,SAAS;QACI,QAAQ;QACT,OAAO;QACP,iBAAiB;KAC5C,
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/renderable/trigger.js"],"names":[],"mappings":"AASA;;;GAGG;AAEH;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACH,eAhDW,MAAM,KACN,MAAM,YAEd;QAA0B,KAAK;QACL,MAAM;QACqB,MAAM;QACjC,QAAQ;QACF,KAAK,GAA7B,MAAM,GAAC,KAAK;QACM,UAAU;QACD,KAAK,GAAhC,OAAO,GAAC,OAAO;QACG,KAAK;QACL,EAAE;QACQ,SAAS,GAArC,MAAM,GAAC,SAAS;QACI,QAA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* @returns the function that will be throttled
|
|
22
22
|
*/
|
|
23
|
-
export declare const throttle: (fn: () => void, wait?: number) => (...args:
|
|
23
|
+
export declare const throttle: <T extends unknown[]>(fn: (...args: T) => void, wait?: number) => (...args: T) => void;
|
|
24
24
|
//# sourceMappingURL=function.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/utils/function.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CACpB,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACrC,OAAO,EAAE,OAAO,EAChB,GAAG,IAAI,EAAE,OAAO,EAAE,UAGlB;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/utils/function.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CACpB,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACrC,OAAO,EAAE,OAAO,EAChB,GAAG,IAAI,EAAE,OAAO,EAAE,UAGlB;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,OAAO,EAAE,EAC3C,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,EACxB,OAAM,MAAY,MAKV,GAAG,MAAM,CAAC,SAkBlB,CAAC"}
|
|
@@ -88,26 +88,6 @@ export default class CanvasRenderer extends Renderer {
|
|
|
88
88
|
* let basic = renderer.createPattern(image, "no-repeat");
|
|
89
89
|
*/
|
|
90
90
|
createPattern(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame, repeat: string): CanvasPattern;
|
|
91
|
-
/**
|
|
92
|
-
* Draw an image onto the main using the canvas api
|
|
93
|
-
* @param {HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame} image - An element to draw into the context.
|
|
94
|
-
* @param {number} sx - The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
95
|
-
* @param {number} sy - The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
96
|
-
* @param {number} sw - The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
|
|
97
|
-
* @param {number} sh - The height of the sub-rectangle of the source image to draw into the destination context.
|
|
98
|
-
* @param {number} dx - The X coordinate in the destination canvas at which to place the top-left corner of the source image.
|
|
99
|
-
* @param {number} dy - The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
|
|
100
|
-
* @param {number} dw - The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
|
|
101
|
-
* @param {number} dh - The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
|
|
102
|
-
* @example
|
|
103
|
-
* // Position the image on the canvas:
|
|
104
|
-
* renderer.drawImage(image, dx, dy);
|
|
105
|
-
* // Position the image on the canvas, and specify width and height of the image:
|
|
106
|
-
* renderer.drawImage(image, dx, dy, dWidth, dHeight);
|
|
107
|
-
* // Clip the image and position the clipped part on the canvas:
|
|
108
|
-
* renderer.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
|
|
109
|
-
*/
|
|
110
|
-
drawImage(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
|
|
111
91
|
/**
|
|
112
92
|
* Draw a pattern within the given rectangle.
|
|
113
93
|
* @param {CanvasPattern} pattern - Pattern object
|
|
@@ -228,31 +208,6 @@ export default class CanvasRenderer extends Renderer {
|
|
|
228
208
|
* @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
|
|
229
209
|
*/
|
|
230
210
|
fillArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean): void;
|
|
231
|
-
/**
|
|
232
|
-
* Stroke an ellipse at the specified coordinates with given radius
|
|
233
|
-
* @param {number} x - ellipse center point x-axis
|
|
234
|
-
* @param {number} y - ellipse center point y-axis
|
|
235
|
-
* @param {number} w - horizontal radius of the ellipse
|
|
236
|
-
* @param {number} h - vertical radius of the ellipse
|
|
237
|
-
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
238
|
-
*/
|
|
239
|
-
strokeEllipse(x: number, y: number, w: number, h: number, fill?: boolean): void;
|
|
240
|
-
/**
|
|
241
|
-
* Fill an ellipse at the specified coordinates with given radius
|
|
242
|
-
* @param {number} x - ellipse center point x-axis
|
|
243
|
-
* @param {number} y - ellipse center point y-axis
|
|
244
|
-
* @param {number} w - horizontal radius of the ellipse
|
|
245
|
-
* @param {number} h - vertical radius of the ellipse
|
|
246
|
-
*/
|
|
247
|
-
fillEllipse(x: number, y: number, w: number, h: number): void;
|
|
248
|
-
/**
|
|
249
|
-
* Stroke a line of the given two points
|
|
250
|
-
* @param {number} startX - the start x coordinate
|
|
251
|
-
* @param {number} startY - the start y coordinate
|
|
252
|
-
* @param {number} endX - the end x coordinate
|
|
253
|
-
* @param {number} endY - the end y coordinate
|
|
254
|
-
*/
|
|
255
|
-
strokeLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
256
211
|
/**
|
|
257
212
|
* Fill a line of the given two points
|
|
258
213
|
* @param {number} startX - the start x coordinate
|
|
@@ -272,23 +227,6 @@ export default class CanvasRenderer extends Renderer {
|
|
|
272
227
|
* @param {Polygon} poly - the shape to draw
|
|
273
228
|
*/
|
|
274
229
|
fillPolygon(poly: Polygon): void;
|
|
275
|
-
/**
|
|
276
|
-
* Stroke a rectangle at the specified coordinates
|
|
277
|
-
* @param {number} x
|
|
278
|
-
* @param {number} y
|
|
279
|
-
* @param {number} width
|
|
280
|
-
* @param {number} height
|
|
281
|
-
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
282
|
-
*/
|
|
283
|
-
strokeRect(x: number, y: number, width: number, height: number, fill?: boolean): void;
|
|
284
|
-
/**
|
|
285
|
-
* Draw a filled rectangle at the specified coordinates
|
|
286
|
-
* @param {number} x
|
|
287
|
-
* @param {number} y
|
|
288
|
-
* @param {number} width
|
|
289
|
-
* @param {number} height
|
|
290
|
-
*/
|
|
291
|
-
fillRect(x: number, y: number, width: number, height: number): void;
|
|
292
230
|
/**
|
|
293
231
|
* Stroke a rounded rectangle at the specified coordinates
|
|
294
232
|
* @param {number} x
|
|
@@ -322,73 +260,11 @@ export default class CanvasRenderer extends Renderer {
|
|
|
322
260
|
* @param {number} height
|
|
323
261
|
*/
|
|
324
262
|
fillPoint(x: number, y: number): void;
|
|
325
|
-
/**
|
|
326
|
-
* restores the most recently saved renderer state by popping the top entry in the drawing state stack
|
|
327
|
-
* @example
|
|
328
|
-
* // Save the current state
|
|
329
|
-
* renderer.save();
|
|
330
|
-
*
|
|
331
|
-
* // apply a transform and draw a rect
|
|
332
|
-
* renderer.tranform(matrix);
|
|
333
|
-
* renderer.fillRect(10, 10, 100, 100);
|
|
334
|
-
*
|
|
335
|
-
* // Restore to the state saved by the most recent call to save()
|
|
336
|
-
* renderer.restore();
|
|
337
|
-
*/
|
|
338
|
-
restore(): void;
|
|
339
|
-
/**
|
|
340
|
-
* saves the entire state of the renderer by pushing the current state onto a stack.
|
|
341
|
-
* @example
|
|
342
|
-
* // Save the current state
|
|
343
|
-
* renderer.save();
|
|
344
|
-
*
|
|
345
|
-
* // apply a transform and draw a rect
|
|
346
|
-
* renderer.tranform(matrix);
|
|
347
|
-
* renderer.fillRect(10, 10, 100, 100);
|
|
348
|
-
*
|
|
349
|
-
* // Restore to the state saved by the most recent call to save()
|
|
350
|
-
* renderer.restore();
|
|
351
|
-
*/
|
|
352
|
-
save(): void;
|
|
353
|
-
/**
|
|
354
|
-
* adds a rotation to the transformation matrix.
|
|
355
|
-
* @param {number} angle - the rotation angle, clockwise in radians
|
|
356
|
-
* @example
|
|
357
|
-
* // Rotated rectangle
|
|
358
|
-
* renderer.rotate((45 * Math.PI) / 180);
|
|
359
|
-
* renderer.setColor("red");
|
|
360
|
-
* renderer.fillRect(10, 10, 100, 100);
|
|
361
|
-
*
|
|
362
|
-
* // Reset transformation matrix to the identity matrix
|
|
363
|
-
* renderer.setTransform(1, 0, 0, 1, 0, 0);
|
|
364
|
-
*/
|
|
365
|
-
rotate(angle: number): void;
|
|
366
|
-
/**
|
|
367
|
-
* adds a scaling transformation to the renderer units horizontally and/or vertically
|
|
368
|
-
* @param {number} x - Scaling factor in the horizontal direction. A negative value flips pixels across the vertical axis. A value of 1 results in no horizontal scaling.
|
|
369
|
-
* @param {number} y - Scaling factor in the vertical direction. A negative value flips pixels across the horizontal axis. A value of 1 results in no vertical scaling
|
|
370
|
-
*/
|
|
371
|
-
scale(x: number, y: number): void;
|
|
372
|
-
/**
|
|
373
|
-
* Set the global alpha
|
|
374
|
-
* @param {number} alpha - 0.0 to 1.0 values accepted.
|
|
375
|
-
*/
|
|
376
|
-
setGlobalAlpha(alpha: number): void;
|
|
377
263
|
/**
|
|
378
264
|
* Return the global alpha
|
|
379
265
|
* @returns {number} global alpha value
|
|
380
266
|
*/
|
|
381
267
|
getGlobalAlpha(): number;
|
|
382
|
-
/**
|
|
383
|
-
* @ignore
|
|
384
|
-
*/
|
|
385
|
-
set lineWidth(value: number);
|
|
386
|
-
/**
|
|
387
|
-
* sets or returns the thickness of lines for shape drawing
|
|
388
|
-
* @type {number}
|
|
389
|
-
* @default 1
|
|
390
|
-
*/
|
|
391
|
-
get lineWidth(): number;
|
|
392
268
|
/**
|
|
393
269
|
* @ignore
|
|
394
270
|
*/
|
|
@@ -422,12 +298,6 @@ export default class CanvasRenderer extends Renderer {
|
|
|
422
298
|
* @param {number} f - the f component to multiply the current matrix by
|
|
423
299
|
*/
|
|
424
300
|
transform(a: Matrix2d | Matrix3d | number, b: number, c: number, d: number, e: number, f: number): void;
|
|
425
|
-
/**
|
|
426
|
-
* adds a translation transformation to the current matrix.
|
|
427
|
-
* @param {number} x - Distance to move in the horizontal direction. Positive values are to the right, and negative to the left.
|
|
428
|
-
* @param {number} y - Distance to move in the vertical direction. Positive values are down, and negative are up.
|
|
429
|
-
*/
|
|
430
|
-
translate(x: number, y: number): void;
|
|
431
301
|
/**
|
|
432
302
|
* clip the given region from the original canvas. Once a region is clipped,
|
|
433
303
|
* all future drawing will be limited to the clipped region.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/canvas/canvas_renderer.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AAEH;;;GAGG;AACH;IAcE,oBAAmC;IA4CnC,8CAA4B;IAG7B;;OAEG;IACH,uBAEC;IAED;;;;;OAKG;IACH,sBAFW,QAAQ,QAclB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,oBAHW,MAAM,GACJ,MAAM,CAqClB;IAWD;;;;OAIG;IACH,mBAHW,KAAK,GAAC,MAAM,WACZ,OAAO,QAajB;IAED;;;;;;OAMG;IACH,aALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAIhB;IAED;;;;;;;;;;;OAWG;IACH,qBAVW,gBAAgB,GAAC,eAAe,GAAC,gBAAgB,GAAC,iBAAiB,GAAC,WAAW,GAAC,eAAe,GAAC,UAAU,UAC1G,MAAM,GACJ,aAAa,CAUzB;
|
|
1
|
+
{"version":3,"file":"canvas_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/canvas/canvas_renderer.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AAEH;;;GAGG;AACH;IAcE,oBAAmC;IA4CnC,8CAA4B;IAG7B;;OAEG;IACH,uBAEC;IAED;;;;;OAK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AC,OAAO,GAAC,IAAI,GAAC,OAAO,WACnC,OAAO,QAgGjB;IApFC,2CAAkC;CAgGpC;qBA3xCoB,kBAAkB;yBACd,uBAAuB;sBAV1B,uBAAuB;0BActB,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B;8BAC9B,wBAAwB"}
|
|
@@ -95,6 +95,17 @@ export default class Renderer {
|
|
|
95
95
|
currentColor: Color;
|
|
96
96
|
currentTint: Color;
|
|
97
97
|
currentScissor: Int32Array<ArrayBufferLike>;
|
|
98
|
+
/**
|
|
99
|
+
* The thickness of lines for shape drawing operations like
|
|
100
|
+
* {@link Renderer#strokeRect}, {@link Renderer#strokeEllipse}
|
|
101
|
+
* and {@link Renderer#strokeLine}. Subclasses override the
|
|
102
|
+
* storage — `CanvasRenderer` proxies it to the underlying 2D
|
|
103
|
+
* context via a getter/setter, while `WebGLRenderer` treats it
|
|
104
|
+
* as a regular field consumed by its shape-stroke routines.
|
|
105
|
+
* @type {number}
|
|
106
|
+
* @default 1
|
|
107
|
+
*/
|
|
108
|
+
lineWidth: number;
|
|
98
109
|
/**
|
|
99
110
|
* @ignore
|
|
100
111
|
*/
|
|
@@ -304,6 +315,20 @@ export default class Renderer {
|
|
|
304
315
|
* @see Light2d
|
|
305
316
|
*/
|
|
306
317
|
drawLight(light: object): void;
|
|
318
|
+
/**
|
|
319
|
+
* Draw a TMX tile layer. Default behavior:
|
|
320
|
+
* - if `layer.canvasRenderer` is set (preRender bake), blit the cached
|
|
321
|
+
* offscreen canvas in a single `drawImage` call;
|
|
322
|
+
* - otherwise delegate to the layer's TMX orientation renderer for
|
|
323
|
+
* the per-tile loop.
|
|
324
|
+
*
|
|
325
|
+
* `WebGLRenderer` overrides this to add the procedural shader fast
|
|
326
|
+
* path on top (when `layer.renderMode === "shader"`) and fall through
|
|
327
|
+
* to this base behavior for all other layers.
|
|
328
|
+
* @param {object} layer - the TMXLayer to draw
|
|
329
|
+
* @param {Rect} rect - the visible region in world coords
|
|
330
|
+
*/
|
|
331
|
+
drawTileLayer(layer: object, rect: Rect): void;
|
|
307
332
|
/**
|
|
308
333
|
* Set the current fill & stroke style color.
|
|
309
334
|
* By default, or upon reset, the value is set to #000000.
|
|
@@ -397,6 +422,106 @@ export default class Renderer {
|
|
|
397
422
|
* @returns {HTMLCanvasElement|OffscreenCanvas} a new canvas or offscreencanvas (if supported) element representing the tinted image
|
|
398
423
|
*/
|
|
399
424
|
tint(src: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas, color: Color | string, mode?: string): HTMLCanvasElement | OffscreenCanvas;
|
|
425
|
+
/**
|
|
426
|
+
* Push the current transform / alpha / clip state onto an internal
|
|
427
|
+
* stack. Pair with {@link Renderer#restore}. Implemented by subclasses.
|
|
428
|
+
*/
|
|
429
|
+
save(): void;
|
|
430
|
+
/**
|
|
431
|
+
* Pop the topmost saved state from the stack, restoring transform,
|
|
432
|
+
* alpha and clip. Pair with {@link Renderer#save}. Implemented by
|
|
433
|
+
* subclasses.
|
|
434
|
+
*/
|
|
435
|
+
restore(): void;
|
|
436
|
+
/**
|
|
437
|
+
* Translate the current transform by `(x, y)`. Implemented by subclasses.
|
|
438
|
+
* @param {number} x - horizontal translation in pixels
|
|
439
|
+
* @param {number} y - vertical translation in pixels
|
|
440
|
+
*/
|
|
441
|
+
translate(x: number, y: number): void;
|
|
442
|
+
/**
|
|
443
|
+
* Rotate the current transform by `angle` (radians). Implemented by subclasses.
|
|
444
|
+
* @param {number} angle - rotation angle in radians
|
|
445
|
+
*/
|
|
446
|
+
rotate(angle: number): void;
|
|
447
|
+
/**
|
|
448
|
+
* Scale the current transform by `(x, y)`. Implemented by subclasses.
|
|
449
|
+
* @param {number} x - horizontal scale factor
|
|
450
|
+
* @param {number} y - vertical scale factor
|
|
451
|
+
*/
|
|
452
|
+
scale(x: number, y: number): void;
|
|
453
|
+
/**
|
|
454
|
+
* Set the renderer global alpha (0..1) for subsequent draw calls.
|
|
455
|
+
* Implemented by subclasses.
|
|
456
|
+
* @param {number} alpha - opacity value in the [0..1] range
|
|
457
|
+
*/
|
|
458
|
+
setGlobalAlpha(alpha: number): void;
|
|
459
|
+
/**
|
|
460
|
+
* Fill an axis-aligned rectangle with the current color.
|
|
461
|
+
* Implemented by subclasses.
|
|
462
|
+
* @param {number} x - left edge in viewport pixels
|
|
463
|
+
* @param {number} y - top edge in viewport pixels
|
|
464
|
+
* @param {number} width - rectangle width
|
|
465
|
+
* @param {number} height - rectangle height
|
|
466
|
+
*/
|
|
467
|
+
fillRect(x: number, y: number, width: number, height: number): void;
|
|
468
|
+
/**
|
|
469
|
+
* Stroke (outline) an axis-aligned rectangle with the current color
|
|
470
|
+
* at the current {@link Renderer#lineWidth}. Implemented by subclasses.
|
|
471
|
+
* @param {number} x - left edge in viewport pixels
|
|
472
|
+
* @param {number} y - top edge in viewport pixels
|
|
473
|
+
* @param {number} width - rectangle width
|
|
474
|
+
* @param {number} height - rectangle height
|
|
475
|
+
* @param {boolean} [fill=false] - also fill the rectangle
|
|
476
|
+
*/
|
|
477
|
+
strokeRect(x: number, y: number, width: number, height: number, fill?: boolean): void;
|
|
478
|
+
/**
|
|
479
|
+
* Fill an axis-aligned ellipse with the current color.
|
|
480
|
+
* Implemented by subclasses.
|
|
481
|
+
* @param {number} x - ellipse center X in viewport pixels
|
|
482
|
+
* @param {number} y - ellipse center Y in viewport pixels
|
|
483
|
+
* @param {number} w - horizontal radius
|
|
484
|
+
* @param {number} h - vertical radius
|
|
485
|
+
*/
|
|
486
|
+
fillEllipse(x: number, y: number, w: number, h: number): void;
|
|
487
|
+
/**
|
|
488
|
+
* Stroke (outline) an axis-aligned ellipse with the current color
|
|
489
|
+
* at the current {@link Renderer#lineWidth}. Implemented by subclasses.
|
|
490
|
+
* @param {number} x - ellipse center X in viewport pixels
|
|
491
|
+
* @param {number} y - ellipse center Y in viewport pixels
|
|
492
|
+
* @param {number} w - horizontal radius
|
|
493
|
+
* @param {number} h - vertical radius
|
|
494
|
+
* @param {boolean} [fill=false] - also fill the ellipse
|
|
495
|
+
*/
|
|
496
|
+
strokeEllipse(x: number, y: number, w: number, h: number, fill?: boolean): void;
|
|
497
|
+
/**
|
|
498
|
+
* Draw a straight line between two points with the current color
|
|
499
|
+
* at the current {@link Renderer#lineWidth}. Implemented by subclasses.
|
|
500
|
+
* @param {number} startX - start X in viewport pixels
|
|
501
|
+
* @param {number} startY - start Y in viewport pixels
|
|
502
|
+
* @param {number} endX - end X in viewport pixels
|
|
503
|
+
* @param {number} endY - end Y in viewport pixels
|
|
504
|
+
*/
|
|
505
|
+
strokeLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
506
|
+
/**
|
|
507
|
+
* Draw an image or sub-image into the framebuffer.
|
|
508
|
+
* Implemented by subclasses (`CanvasRenderer` / `WebGLRenderer`).
|
|
509
|
+
*
|
|
510
|
+
* The 9-argument signature shown here is the canonical form used
|
|
511
|
+
* throughout the engine; the concrete renderers also accept the
|
|
512
|
+
* shorter `drawImage(image, dx, dy)` and `drawImage(image, dx, dy,
|
|
513
|
+
* dWidth, dHeight)` variants from the HTML Canvas2D spec.
|
|
514
|
+
* @param {HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas|VideoFrame} image - the source image
|
|
515
|
+
* @param {number} sx - source rectangle left
|
|
516
|
+
* @param {number} sy - source rectangle top
|
|
517
|
+
* @param {number} sw - source rectangle width
|
|
518
|
+
* @param {number} sh - source rectangle height
|
|
519
|
+
* @param {number} dx - destination left
|
|
520
|
+
* @param {number} dy - destination top
|
|
521
|
+
* @param {number} dw - destination width
|
|
522
|
+
* @param {number} dh - destination height
|
|
523
|
+
*/
|
|
524
|
+
drawImage(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
|
|
400
525
|
/**
|
|
401
526
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
402
527
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
@@ -457,8 +582,8 @@ import Path2D from "./../geometries/path2d.js";
|
|
|
457
582
|
import { Color } from "./../math/color.ts";
|
|
458
583
|
import RenderState from "./renderstate.js";
|
|
459
584
|
import { Matrix3d } from "../math/matrix3d.ts";
|
|
460
|
-
import { Gradient } from "./gradient.js";
|
|
461
585
|
import type { Rect } from "./../geometries/rectangle.ts";
|
|
586
|
+
import { Gradient } from "./gradient.js";
|
|
462
587
|
import type { Bounds } from "./../physics/bounds.ts";
|
|
463
588
|
import type { RoundRect } from "./../geometries/roundrect.ts";
|
|
464
589
|
import type { Polygon } from "../geometries/polygon.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/video/renderer.js"],"names":[],"mappings":"AASA;;GAEG;AAEH;;;;;;;GAOG;AAEH;;;GAGG;AACH;IACC;;OAEG;IACH,sBAFW,mBAAmB,
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/video/renderer.js"],"names":[],"mappings":"AASA;;GAEG;AAEH;;;;;;;GAOG;AAEH;;;GAGG;AACH;IACC;;OAEG;IACH,sBAFW,mBAAmB,EAqJ7B;IAlJA;;;;OAIG;IACH,cAFU,kBAAkB,CAS3B;IAED;;;;OAIG;IACH,iBAFU,MAAM,CAEO;IAEvB;;;;OAIG;IACH,oBAFU,MAAM,CAE6C;IAE7D;;;;OAIG;IACH,YAHU,QAAQ,CAGsD;IAExE;;;;OAIG;IACH,gBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,aAFU,MAAM,GAAC,SAAS,CAEE;IAE5B;;;;;;OAMG;IACH,cAHU,QAAQ,GAAC,YAAY,GAAC,SAAS,CAGZ;IAE7B;;;;;OAKG;IACH,mBAHU,gBAAgB,GAAC,IAAI,CAGF;IAE7B;;;OAGG;IACH,QAFU,MAAM,CA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;IACH,cANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;;OAQG;IACH,qBANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;OAOG;IACH,iBANW,MAAM,YACN,MAAM,gBAOhB;CACD;+BA18B8B,sCAAsC;yBAJ5C,qBAAqB;kCAOb,sCAAsC;mBAVpD,2BAA2B;sBACxB,oBAAoB;wBAKlB,kBAAkB;yBAJjB,qBAAqB;0BAYvB,8BAA8B;yBAT5B,eAAe;4BAcf,wBAAwB;+BAJrB,8BAA8B;6BAChC,0BAA0B;0BAC7B,yBAAyB;6BACtB,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvasrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/canvasrendertarget.js"],"names":[],"mappings":";AA+EA;;;;;;GAMG;AACH;IACC;;;;;;;;;;OAUG;IACH,mBAVW,MAAM,UACN,MAAM,eAEd;QAA4B,OAAO;QACN,YAAY;QACZ,WAAW;QACX,eAAe;QACf,kBAAkB;QAClB,SAAS;KACxC,EA6BA;IAzBA;;;;;;;;;;;;;;;;;;;MAAkE;IASjE,YAA+B;IAUhC,aAA0D;IAE1D,kBAAgC;IAMjC;;OAEG;IACH,4CAGC;IAUD;;;OAGG;IACH,sBAFW,OAAO,QAwBjB;IAYD;;;;;;;;OAQG;IACH,gBANW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,GACJ,SAAS,CAUrB;IAoDD;;;;OAIG;IACH,qBAFW,cAAc,GAAC,aAAa,QAatC;IALC,mBAEC;IAKH;;;;OAIG;IACH,mBAHW,cAAc,GAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"canvasrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/canvasrendertarget.js"],"names":[],"mappings":";AA+EA;;;;;;GAMG;AACH;IACC;;;;;;;;;;OAUG;IACH,mBAVW,MAAM,UACN,MAAM,eAEd;QAA4B,OAAO;QACN,YAAY;QACZ,WAAW;QACX,eAAe;QACf,kBAAkB;QAClB,SAAS;KACxC,EA6BA;IAzBA;;;;;;;;;;;;;;;;;;;MAAkE;IASjE,YAA+B;IAUhC,aAA0D;IAE1D,kBAAgC;IAMjC;;OAEG;IACH,4CAGC;IAUD;;;OAGG;IACH,sBAFW,OAAO,QAwBjB;IAYD;;;;;;;;OAQG;IACH,gBANW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,GACJ,SAAS,CAUrB;IAoDD;;;;OAIG;IACH,qBAFW,cAAc,GAAC,aAAa,QAatC;IALC,mBAEC;IAKH;;;;OAIG;IACH,mBAHW,cAAc,GAAC,aAAa,QAiCtC;CA2BD;yBAxUwB,mBAAmB;gCAIb,gCAAgC;+BACjC,8BAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/video/texture/cache.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/video/texture/cache.js"],"names":[],"mappings":";AAIA;;;GAGG;AACH;IACC;;OAEG;IACH,8CAUC;IARA,cAAwB;IAExB,qBAAgC;IAChC,sBAAuB;IACvB,qBAAsB;IACtB,oBAA0B;IAC1B,iBAAwB;IAIzB;;OAEG;IACH,cAKC;IAED;;OAEG;IACH,8BAuBC;IAED;;;;OAIG;IACH,6BAOC;IAED;;OAEG;IACH,oCAQC;IAED;;OAEG;IACH,2BAMC;IAED;;;OAGG;IACH,4BAGC;IAED;;;OAGG;IACH,yCAEC;IAED;;OAEG;IACH,yBAEC;IAED;;;OAGG;IACH,iCAwCC;IAED;;OAEG;IACH,yBAQC;IAED;;OAEG;IACH,gCAcC;CACD;8BAzM6B,+BAA+B"}
|