# `@combos-fun/renderer-adapter` — Agent notes

Pixi v8 adapter types used by `@combos-fun/plugin-renderer` and its 2D renderer plugins. This package is not a game System.

## When to read

Read only for a 2D/Pixi rendering task or when authoring a custom 2D renderer.

## Public API

| Export | Shape | Pass to `addChild` |
|---|---|---|
| `Application` | Pixi re-export | — |
| `Container`, `Graphics`, `Text`, `NinePatch` | Pixi subclasses | adapter instance |
| `Sprite` | composition | `sprite.sprite` |
| `TilingSprite` | composition | `tilingSprite.tilingSprite` |
| `SpriteAnimation` | composition | `spriteAnimation.animatedSprite` |

End users normally consume higher-level renderer plugins rather than these adapters.

## Required setup

None for ordinary game code; `plugin-renderer` loads the adapter transitively.

## Runtime behaviour

Custom 2D renderer plugins extend `Renderer`, register with `RendererSystem.rendererManager`, and use adapter display objects with `containerManager.getContainer(gameObject.id)`.

## Common pitfalls

- Do not import `pixi.js` directly in a custom 2D renderer plugin.
- A composition adapter is not itself displayable; add its inner Pixi object.
- Do not mix raw Pixi containers with adapter containers.

## Minimal example

```ts
import { Sprite } from '@combos-fun/renderer-adapter';
import { Renderer, RendererSystem } from '@combos-fun/plugin-renderer';

class MyRenderer extends Renderer {
  init() {
    this.game.getSystem(RendererSystem).rendererManager.register(this);
  }

  add(gameObject, texture) {
    const sprite = new Sprite(texture);
    this.containerManager.getContainer(gameObject.id).addChild(sprite.sprite);
  }
}
```

Subclass adapters use `container.addChild(new Graphics())` directly.

## Verification

Run `pnpm --filter @combos-fun/renderer-adapter run build`.
