@combos-fun/plugin-renderer-img 0.0.38 → 0.0.39
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 +13 -7
- package/package.json +5 -5
package/agent-skill.md
CHANGED
|
@@ -13,7 +13,7 @@ import { Img, ImgSystem, type ImgParams } from '@combos-fun/plugin-renderer-img'
|
|
|
13
13
|
import { resource, RESOURCE_TYPE } from '@combos-fun/engine';
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
`componentName = 'Img'`, `systemName = 'ImgSystem
|
|
16
|
+
`componentName = 'Img'`, `systemName = 'Img'` (class is `ImgSystem` — use `game.getSystem(ImgSystem)`, not the string).
|
|
17
17
|
|
|
18
18
|
### `ImgParams`
|
|
19
19
|
|
|
@@ -26,14 +26,14 @@ Side effect: importing the package registers `IMAGE` resource handlers on the en
|
|
|
26
26
|
## Required setup
|
|
27
27
|
|
|
28
28
|
1. `RendererSystem` and `ImgSystem` registered in that order.
|
|
29
|
-
2. `resource.addResource
|
|
30
|
-
`name` matches the component's `resource`.
|
|
29
|
+
2. `resource.addResource` with `{ image: { type, url } }`; `name` matches the component's `resource`.
|
|
31
30
|
|
|
32
31
|
## Common pitfalls
|
|
33
32
|
|
|
34
33
|
| Symptom | Fix |
|
|
35
34
|
|---------|-----|
|
|
36
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
37
|
| Image at origin (0,0) | Set `Transform.position` |
|
|
38
38
|
| Wrong anchor | Set `Transform.origin: { x: 0.5, y: 0.5 }` for center anchoring |
|
|
39
39
|
| Multiple drawables on same GO | Don't stack `Img` + `Sprite` — split GOs |
|
|
@@ -41,10 +41,16 @@ Side effect: importing the package registers `IMAGE` resource handlers on the en
|
|
|
41
41
|
## Minimal example
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
resource.addResource([
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
resource.addResource([
|
|
45
|
+
{
|
|
46
|
+
name: 'logo',
|
|
47
|
+
type: RESOURCE_TYPE.IMAGE,
|
|
48
|
+
src: { image: { type: 'png', url: 'https://cdn.example/logo.png' } },
|
|
49
|
+
preload: true,
|
|
50
|
+
},
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
const go = new GameObject('logo', { position: { x: 100, y: 100 }, size: { width: 200, height: 200 } });
|
|
48
54
|
go.addComponent(new Img({ resource: 'logo' }));
|
|
49
55
|
```
|
|
50
56
|
|
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.39",
|
|
4
4
|
"description": "Static image rendering",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-img.esm.js",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"author": "sun668 <q947692259@gmail.com>",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@combos-fun/plugin-renderer": "0.0.
|
|
38
|
-
"@combos-fun/renderer-adapter": "0.0.
|
|
39
|
-
"@combos-fun/engine": "0.0.
|
|
37
|
+
"@combos-fun/plugin-renderer": "0.0.39",
|
|
38
|
+
"@combos-fun/renderer-adapter": "0.0.39",
|
|
39
|
+
"@combos-fun/engine": "0.0.39",
|
|
40
40
|
"pixi.js": "^8.18.1",
|
|
41
|
-
"@combos-fun/inspector-decorator": "0.0.
|
|
41
|
+
"@combos-fun/inspector-decorator": "0.0.39"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "node ../../scripts/build-package.mjs"
|