@combos-fun/plugin-renderer-img 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 +7 -45
- package/package.json +5 -5
package/agent-skill.md
CHANGED
|
@@ -1,59 +1,21 @@
|
|
|
1
1
|
# `@combos-fun/plugin-renderer-img` — Agent notes
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## When to read
|
|
6
|
-
|
|
7
|
-
Read whenever you need a single static image: icons, backgrounds, single-frame foregrounds.
|
|
8
|
-
|
|
9
|
-
## Public API
|
|
3
|
+
Read only for one standalone static image. For a frame inside an atlas, use `Sprite`.
|
|
10
4
|
|
|
11
5
|
```ts
|
|
12
6
|
import { Img, ImgSystem, type ImgParams } from '@combos-fun/plugin-renderer-img';
|
|
13
|
-
import { resource, RESOURCE_TYPE } from '@combos-fun/engine';
|
|
14
7
|
```
|
|
15
8
|
|
|
16
|
-
`componentName = 'Img'
|
|
17
|
-
|
|
18
|
-
### `ImgParams`
|
|
19
|
-
|
|
20
|
-
| Field | Type | Notes |
|
|
21
|
-
|-------|------|-------|
|
|
22
|
-
| `resource` | `string` | Engine resource name registered with `RESOURCE_TYPE.IMAGE` |
|
|
23
|
-
|
|
24
|
-
Side effect: importing the package registers `IMAGE` resource handlers on the engine `resource` singleton.
|
|
25
|
-
|
|
26
|
-
## Required setup
|
|
27
|
-
|
|
28
|
-
1. `RendererSystem` and `ImgSystem` registered in that order.
|
|
29
|
-
2. `resource.addResource` with `{ image: { type, url } }`; `name` matches the component's `resource`.
|
|
30
|
-
|
|
31
|
-
## Common pitfalls
|
|
32
|
-
|
|
33
|
-
| Symptom | Fix |
|
|
34
|
-
|---------|-----|
|
|
35
|
-
| Resource name not found | Ensure name matches `resource.addResource` and that loading completed (`preload: true` or wait `LOAD_EVENT.COMPLETE`) |
|
|
36
|
-
| `src.<slot>.url is required` | That slot has no url |
|
|
37
|
-
| Image at origin (0,0) | Set `Transform.position` |
|
|
38
|
-
| Wrong anchor | Set `Transform.origin: { x: 0.5, y: 0.5 }` for center anchoring |
|
|
39
|
-
| Multiple drawables on same GO | Don't stack `Img` + `Sprite` — split GOs |
|
|
40
|
-
|
|
41
|
-
## Minimal example
|
|
9
|
+
`Img.componentName = 'Img'`; `ImgSystem.systemName = 'Img'`.
|
|
42
10
|
|
|
43
11
|
```ts
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
type: RESOURCE_TYPE.IMAGE,
|
|
48
|
-
src: { image: { type: 'png', url: 'https://cdn.example/logo.png' } },
|
|
49
|
-
preload: true,
|
|
50
|
-
},
|
|
51
|
-
]);
|
|
12
|
+
interface ImgParams {
|
|
13
|
+
resource: string; // RESOURCE_TYPE.IMAGE name
|
|
14
|
+
}
|
|
52
15
|
|
|
53
|
-
const go = new GameObject('logo', { position: { x: 100, y: 100 }, size: { width: 200, height: 200 } });
|
|
54
16
|
go.addComponent(new Img({ resource: 'logo' }));
|
|
55
17
|
```
|
|
56
18
|
|
|
57
|
-
|
|
19
|
+
Importing the package registers the IMAGE instance and destroy handlers. The system reacts to `resource` changes.
|
|
58
20
|
|
|
59
|
-
`
|
|
21
|
+
Display width and height always follow `Transform.size`; intrinsic image dimensions are not adopted. Set `Transform.position`, `size`, and `origin` as needed—a zero size makes the image invisible.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-img",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "Static image rendering",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-img.esm.js",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"author": "sun668 <q947692259@gmail.com>",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"pixi.js": "^8.18.1",
|
|
38
|
-
"@combos-fun/
|
|
39
|
-
"@combos-fun/engine": "0.0.
|
|
40
|
-
"@combos-fun/
|
|
41
|
-
"@combos-fun/
|
|
38
|
+
"@combos-fun/renderer-adapter": "0.0.47",
|
|
39
|
+
"@combos-fun/engine": "0.0.47",
|
|
40
|
+
"@combos-fun/inspector-decorator": "0.0.47",
|
|
41
|
+
"@combos-fun/plugin-renderer": "0.0.47"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "node ../../scripts/build-package.mjs"
|