@combos-fun/renderer-adapter 0.0.45 → 0.0.47
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/agent-skill.md +23 -42
- package/package.json +1 -1
package/agent-skill.md
CHANGED
|
@@ -1,76 +1,57 @@
|
|
|
1
1
|
# `@combos-fun/renderer-adapter` — Agent notes
|
|
2
2
|
|
|
3
|
-
Pixi v8
|
|
3
|
+
Pixi v8 adapter types used by `@combos-fun/plugin-renderer` and its 2D renderer plugins. This package is not a game System.
|
|
4
4
|
|
|
5
5
|
## When to read
|
|
6
6
|
|
|
7
|
-
Read
|
|
7
|
+
Read only for a 2D/Pixi rendering task or when authoring a custom 2D renderer.
|
|
8
8
|
|
|
9
9
|
## Public API
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
| Export | Shape | Pass to `addChild` |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `Application` | Pixi re-export | — |
|
|
14
|
+
| `Container`, `Graphics`, `Text`, `NinePatch` | Pixi subclasses | adapter instance |
|
|
15
|
+
| `Sprite` | composition | `sprite.sprite` |
|
|
16
|
+
| `TilingSprite` | composition | `tilingSprite.tilingSprite` |
|
|
17
|
+
| `SpriteAnimation` | composition | `spriteAnimation.animatedSprite` |
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|--------|-------|---------|
|
|
15
|
-
| `Application` | `pixi.js` Application | `RendererSystem` (plugin-renderer) bootstrap |
|
|
16
|
-
| `Container` | `PIXI.Container` | All container parenting via `containerManager` |
|
|
17
|
-
| `Graphics` | `PIXI.Graphics` | `plugin-renderer-graphics` |
|
|
18
|
-
| `Sprite` | `PIXI.Sprite` | `plugin-renderer-sprite`, `plugin-renderer-img` |
|
|
19
|
-
| `SpriteAnimation` | Pixi animated sprite | `plugin-renderer-sprite-animation` |
|
|
20
|
-
| `NinePatch` | nine-slice sprite | `plugin-renderer-nine-patch` |
|
|
21
|
-
| `TilingSprite` | `PIXI.TilingSprite` | `plugin-renderer-tiling-sprite` |
|
|
22
|
-
| `Text` | `PIXI.Text` | `plugin-renderer-text` |
|
|
23
|
-
|
|
24
|
-
These are **adapter classes** — plugins consume them, end users typically do not import them directly.
|
|
19
|
+
End users normally consume higher-level renderer plugins rather than these adapters.
|
|
25
20
|
|
|
26
21
|
## Required setup
|
|
27
22
|
|
|
28
|
-
None
|
|
23
|
+
None for ordinary game code; `plugin-renderer` loads the adapter transitively.
|
|
29
24
|
|
|
30
25
|
## Runtime behaviour
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
by the matching renderer plugin.
|
|
34
|
-
- All 2D rendering plugins reach Pixi via these wrappers; if you are
|
|
35
|
-
authoring a custom 2D rendering plugin, prefer extending `Renderer` from
|
|
36
|
-
`plugin-renderer` and constructing display objects via the matching adapter
|
|
37
|
-
type. Do **not** import `pixi.js` directly in plugin code.
|
|
27
|
+
Custom 2D renderer plugins extend `Renderer`, register with `RendererSystem.rendererManager`, and use adapter display objects with `containerManager.getContainer(gameObject.id)`.
|
|
38
28
|
|
|
39
29
|
## Common pitfalls
|
|
40
30
|
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
graph is not supported — `containerManager.getContainer(gameObject.id)`
|
|
45
|
-
returns the adapter type.
|
|
31
|
+
- Do not import `pixi.js` directly in a custom 2D renderer plugin.
|
|
32
|
+
- A composition adapter is not itself displayable; add its inner Pixi object.
|
|
33
|
+
- Do not mix raw Pixi containers with adapter containers.
|
|
46
34
|
|
|
47
35
|
## Minimal example
|
|
48
36
|
|
|
49
|
-
Inside a custom 2D rendering plugin's `Renderer` subclass:
|
|
50
|
-
|
|
51
37
|
```ts
|
|
52
38
|
import { Sprite } from '@combos-fun/renderer-adapter';
|
|
53
39
|
import { Renderer, RendererSystem } from '@combos-fun/plugin-renderer';
|
|
54
40
|
|
|
55
41
|
class MyRenderer extends Renderer {
|
|
56
42
|
init() {
|
|
57
|
-
this.
|
|
58
|
-
this.rendererSystem.rendererManager.register(this);
|
|
43
|
+
this.game.getSystem(RendererSystem).rendererManager.register(this);
|
|
59
44
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
changed.gameObject.id,
|
|
65
|
-
);
|
|
66
|
-
container.addChild(sprite);
|
|
67
|
-
}
|
|
45
|
+
|
|
46
|
+
add(gameObject, texture) {
|
|
47
|
+
const sprite = new Sprite(texture);
|
|
48
|
+
this.containerManager.getContainer(gameObject.id).addChild(sprite.sprite);
|
|
68
49
|
}
|
|
69
50
|
}
|
|
70
51
|
```
|
|
71
52
|
|
|
53
|
+
Subclass adapters use `container.addChild(new Graphics())` directly.
|
|
54
|
+
|
|
72
55
|
## Verification
|
|
73
56
|
|
|
74
|
-
|
|
75
|
-
- After upgrading `pixi.js`, run any example app from `examples/` to verify
|
|
76
|
-
no rendering regression.
|
|
57
|
+
Run `pnpm --filter @combos-fun/renderer-adapter run build`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/renderer-adapter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "Pixi v8 display-object adapter layer used by @combos-fun/plugin-renderer and its 2D rendering sub-plugins",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/renderer-adapter.esm.js",
|