@idosgames/module-sdk 0.3.3 → 0.4.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/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -420,6 +420,26 @@ interface EngineScene {
|
|
|
420
420
|
suspend?(): void;
|
|
421
421
|
/** Optional per-frame tick if the module opts into the host's shared loop. */
|
|
422
422
|
update?(deltaMs: number): void;
|
|
423
|
+
/**
|
|
424
|
+
* One still frame of this scene, for the platform's "share a shot of your game" button.
|
|
425
|
+
*
|
|
426
|
+
* ⚠ Implement this in the module, do not leave it to the host. A `WebGLRenderer` is created
|
|
427
|
+
* without `preserveDrawingBuffer` (the default, and the one you want — the flag costs memory and
|
|
428
|
+
* a copy every frame), which means its drawing buffer is already cleared by the time anyone else
|
|
429
|
+
* can read the canvas: `canvas.toBlob()` from outside returns a BLACK rectangle, and it does so
|
|
430
|
+
* silently. The scene is the only place that can render and read in the same turn:
|
|
431
|
+
*
|
|
432
|
+
* ```ts
|
|
433
|
+
* async capture() {
|
|
434
|
+
* this.renderer.render(this.scene, this.camera);
|
|
435
|
+
* return await new Promise<Blob | null>((r) => this.canvas.toBlob(r, "image/png"));
|
|
436
|
+
* }
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* Resolve `null` when there is nothing meaningful to show (not mounted yet, no renderer). The
|
|
440
|
+
* host falls back to reading the canvas itself, which is correct for 2D canvases.
|
|
441
|
+
*/
|
|
442
|
+
capture?(): Promise<Blob | null>;
|
|
423
443
|
/** Permanent teardown — dispose GPU resources, remove listeners. */
|
|
424
444
|
destroy(): void;
|
|
425
445
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -420,6 +420,26 @@ interface EngineScene {
|
|
|
420
420
|
suspend?(): void;
|
|
421
421
|
/** Optional per-frame tick if the module opts into the host's shared loop. */
|
|
422
422
|
update?(deltaMs: number): void;
|
|
423
|
+
/**
|
|
424
|
+
* One still frame of this scene, for the platform's "share a shot of your game" button.
|
|
425
|
+
*
|
|
426
|
+
* ⚠ Implement this in the module, do not leave it to the host. A `WebGLRenderer` is created
|
|
427
|
+
* without `preserveDrawingBuffer` (the default, and the one you want — the flag costs memory and
|
|
428
|
+
* a copy every frame), which means its drawing buffer is already cleared by the time anyone else
|
|
429
|
+
* can read the canvas: `canvas.toBlob()` from outside returns a BLACK rectangle, and it does so
|
|
430
|
+
* silently. The scene is the only place that can render and read in the same turn:
|
|
431
|
+
*
|
|
432
|
+
* ```ts
|
|
433
|
+
* async capture() {
|
|
434
|
+
* this.renderer.render(this.scene, this.camera);
|
|
435
|
+
* return await new Promise<Blob | null>((r) => this.canvas.toBlob(r, "image/png"));
|
|
436
|
+
* }
|
|
437
|
+
* ```
|
|
438
|
+
*
|
|
439
|
+
* Resolve `null` when there is nothing meaningful to show (not mounted yet, no renderer). The
|
|
440
|
+
* host falls back to reading the canvas itself, which is correct for 2D canvases.
|
|
441
|
+
*/
|
|
442
|
+
capture?(): Promise<Blob | null>;
|
|
423
443
|
/** Permanent teardown — dispose GPU resources, remove listeners. */
|
|
424
444
|
destroy(): void;
|
|
425
445
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idosgames/module-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The composable-module contract for the iDosGames host shell: Module / ModuleContext types plus tiny authoring helpers. Framework-neutral at runtime — a module can be a game (Three/Phaser), a plain app, or an AI app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"//": "@idosgames/core is a real range, not '*': a published contract must name the version of core whose IDosGamesClient/SdkEvents shapes it references. Bump in step with core (see RELEASING.md). react is an OPTIONAL peer — the contract references React's ComponentType type only (a UI panel is a React component), which is erased at build, so a runtime-only module needs no React.",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@idosgames/core": "^0.
|
|
49
|
+
"@idosgames/core": "^0.17.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^18.3.1 || ^19.0.0"
|