@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.
Files changed (2) hide show
  1. package/agent-skill.md +23 -42
  2. 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 display-object adapter layer used by `@combos-fun/plugin-renderer` and its 2D rendering sub-plugins. **Not** a game `System`. It exposes a stable shape over Pixi primitives so 2D rendering plugins are not coupled to a specific Pixi version.
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 whenever a 2D rendering task touches `Container` parenting, low-level Pixi display object shape, or whenever the entry skill loads "Core" packages for any project.
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
- Wrappers re-exported from `@combos-fun/renderer-adapter`:
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
- | Export | Wraps | Used by |
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 on the user side. Adapter is a dependency of `@combos-fun/plugin-renderer` and is loaded transitively. End users install the plugin packages, not the adapter directly.
23
+ None for ordinary game code; `plugin-renderer` loads the adapter transitively.
29
24
 
30
25
  ## Runtime behaviour
31
26
 
32
- - Each wrapper instantiates a Pixi display object and exposes a thin API used
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
- - Coupling a custom 2D rendering plugin directly to `pixi.js` means a Pixi
42
- major bump can break the plugin. Use the adapter types instead.
43
- - Mixing adapter `Container` and raw `PIXI.Container` in the same scene
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.rendererSystem = this.game.getSystem(RendererSystem);
58
- this.rendererSystem.rendererManager.register(this);
43
+ this.game.getSystem(RendererSystem).rendererManager.register(this);
59
44
  }
60
- componentChanged(changed) {
61
- if (changed.type === OBSERVER_TYPE.ADD) {
62
- const sprite = new Sprite(/* ... */);
63
- const container = this.rendererSystem.containerManager.getContainer(
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
- - `pnpm --filter @combos-fun/renderer-adapter run build` should succeed.
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.45",
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",