@combos-fun/plugin-renderer-graphics 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 +6 -31
- package/package.json +4 -4
package/agent-skill.md
CHANGED
|
@@ -1,43 +1,18 @@
|
|
|
1
1
|
# `@combos-fun/plugin-renderer-graphics` — Agent notes
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## When to read
|
|
6
|
-
|
|
7
|
-
Read for any vector shape: lines, fills, custom geometry, circles / rectangles drawn on demand.
|
|
8
|
-
|
|
9
|
-
## Public API
|
|
3
|
+
Read only for procedural 2D vectors such as paths, circles, rectangles, fills, and strokes. Prefer `Img` or `Sprite` for bitmap art.
|
|
10
4
|
|
|
11
5
|
```ts
|
|
12
6
|
import { Graphics, GraphicsSystem } from '@combos-fun/plugin-renderer-graphics';
|
|
13
7
|
```
|
|
14
8
|
|
|
15
|
-
`componentName = 'Graphics'
|
|
16
|
-
|
|
17
|
-
The `Graphics` Component owns a `graphics` field — a Pixi `Graphics` instance created in `init()`. Use the standard Pixi v8 graphics API (`rect`, `circle`, `fill`, `stroke`, `moveTo`, `lineTo`, etc.) on it.
|
|
18
|
-
|
|
19
|
-
## Required setup
|
|
9
|
+
`Graphics.componentName = 'Graphics'`; `GraphicsSystem.systemName = 'Graphics'`.
|
|
20
10
|
|
|
21
|
-
`
|
|
22
|
-
|
|
23
|
-
## Common pitfalls
|
|
24
|
-
|
|
25
|
-
| Symptom | Fix |
|
|
26
|
-
|---------|-----|
|
|
27
|
-
| Nothing drawn | Call `comp.graphics.fill(...)` / `stroke(...)` after path commands; Pixi v8 requires explicit fill/stroke |
|
|
28
|
-
| Drawing only first frame | Pixi `Graphics` is retained — calling `.clear()` then redrawing is needed for dynamic shapes |
|
|
29
|
-
| Performance regression | For static shapes prefer `Img` or `Sprite`; `Graphics` is for dynamic vector content |
|
|
30
|
-
|
|
31
|
-
## Minimal example
|
|
11
|
+
`Graphics.graphics` is a Pixi v8 `Graphics` instance created during Component init and mounted at index 0 of the GameObject container.
|
|
32
12
|
|
|
33
13
|
```ts
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
g.graphics.rect(0, 0, 200, 80).fill({ color: 0xff0000 });
|
|
14
|
+
const graphics = go.addComponent(new Graphics()).graphics;
|
|
15
|
+
graphics.rect(0, 0, 200, 80).fill({ color: 0xff0000 });
|
|
37
16
|
```
|
|
38
17
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## Verification
|
|
42
|
-
|
|
43
|
-
`pnpm --filter @combos-fun/plugin-renderer-graphics run build`.
|
|
18
|
+
Path commands alone do not paint; finish with `fill(...)` or `stroke(...)`. Geometry is retained, so dynamic drawing should call `clear()` before rebuilding the shape. Removing the Component destroys its Graphics instance.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-graphics",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "Vector / procedural shapes",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-graphics.esm.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
],
|
|
37
37
|
"author": "sun668 <q947692259@gmail.com>",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@combos-fun/renderer-adapter": "0.0.
|
|
40
|
-
"@combos-fun/engine": "0.0.
|
|
41
|
-
"@combos-fun/plugin-renderer": "0.0.
|
|
39
|
+
"@combos-fun/renderer-adapter": "0.0.47",
|
|
40
|
+
"@combos-fun/engine": "0.0.47",
|
|
41
|
+
"@combos-fun/plugin-renderer": "0.0.47"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "node ../../scripts/build-package.mjs"
|