@combos-fun/plugin-renderer-text 0.0.6 → 0.0.7
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/README.md +25 -1
- package/agent-skill.md +55 -0
- package/combos-plugin.json +11 -0
- package/package.json +20 -6
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
1
|
# @combos-fun/plugin-renderer-text
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
@combos-fun/plugin-renderer-text — part of the Combos Fun engine monorepo.
|
|
4
|
+
|
|
5
|
+
Keywords: `text`, `label`, `font`, `string`, `2d`.
|
|
6
|
+
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
- Per-package agent / developer notes: [`agent-skill.md`](./agent-skill.md)
|
|
10
|
+
- Machine-readable manifest: [`combos-plugin.json`](./combos-plugin.json)
|
|
11
|
+
(validated against `schemas/combos-plugin.schema.json` in the repo
|
|
12
|
+
root)
|
|
13
|
+
- Entry skill (single source of truth for AI agents working with this
|
|
14
|
+
monorepo): `skills/combos-engine-development/SKILL.md`
|
|
15
|
+
|
|
16
|
+
When consumed from npm, the manifest and agent notes are exposed as
|
|
17
|
+
stable subpaths:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import manifest from '@combos-fun/plugin-renderer-text/plugin-manifest';
|
|
21
|
+
// or fetch the markdown directly:
|
|
22
|
+
// require.resolve('@combos-fun/plugin-renderer-text/agent-skill')
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
Internal workspace package, part of the Combos Fun engine monorepo.
|
package/agent-skill.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# `@combos-fun/plugin-renderer-text` — Agent notes
|
|
2
|
+
|
|
3
|
+
Text rendering for the 2D pipeline. Wraps Pixi v8 `Text` and auto-syncs
|
|
4
|
+
`Transform.size` so other components see the rendered text bounds.
|
|
5
|
+
|
|
6
|
+
## When to read
|
|
7
|
+
|
|
8
|
+
Read for any 2D text label, score display, dialog text, or HUD title.
|
|
9
|
+
|
|
10
|
+
## Public API
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { Text, TextSystem, type TextParams } from '@combos-fun/plugin-renderer-text';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`componentName = 'Text'`, `systemName = 'TextSystem'`.
|
|
17
|
+
|
|
18
|
+
### `TextParams`
|
|
19
|
+
|
|
20
|
+
| Field | Type | Default |
|
|
21
|
+
|-------|------|---------|
|
|
22
|
+
| `text` | `string` | — (required) |
|
|
23
|
+
| `style` | `Partial<TextStyle>` | `{ fontSize: 20 }` |
|
|
24
|
+
|
|
25
|
+
`style` accepts the full Pixi `TextStyle` surface (`fill`, `fontFamily`,
|
|
26
|
+
`fontSize`, `fontWeight`, `wordWrap`, `wordWrapWidth`, `align`, `stroke`,
|
|
27
|
+
`dropShadow`, `lineHeight`, ...).
|
|
28
|
+
|
|
29
|
+
`Transform.size` is updated automatically after rendering so layout
|
|
30
|
+
components downstream can position around the actual bounds.
|
|
31
|
+
|
|
32
|
+
## Required setup
|
|
33
|
+
|
|
34
|
+
`RendererSystem` then `TextSystem`.
|
|
35
|
+
|
|
36
|
+
## Common pitfalls
|
|
37
|
+
|
|
38
|
+
| Symptom | Fix |
|
|
39
|
+
|---------|-----|
|
|
40
|
+
| Text invisible on dark background | Set `style.fill: 0xffffff` (default fill is dark) |
|
|
41
|
+
| Wrap not working | Set `style.wordWrap: true` AND `style.wordWrapWidth: <px>` |
|
|
42
|
+
| Custom font not loading | Load the webfont before adding the component (e.g. `document.fonts.load(...)`) |
|
|
43
|
+
| Updating `text` doesn't refresh | The system observes the Component — make sure you assign via the component instance, not via Pixi internals |
|
|
44
|
+
|
|
45
|
+
## Minimal example
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const score = new GameObject('score');
|
|
49
|
+
score.addComponent(new Transform({ position: { x: 20, y: 20 } }));
|
|
50
|
+
score.addComponent(new Text({ text: 'Score: 0', style: { fontSize: 32, fill: 0xffffff } }));
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Verification
|
|
54
|
+
|
|
55
|
+
`pnpm --filter @combos-fun/plugin-renderer-text run build`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@combos-fun/plugin-renderer-text",
|
|
3
|
+
"pluginId": "renderer-text",
|
|
4
|
+
"category": "rendering",
|
|
5
|
+
"dimension": "2d",
|
|
6
|
+
"isCore": false,
|
|
7
|
+
"keywords": ["text", "label", "font", "string", "2d"],
|
|
8
|
+
"agentSkill": "./agent-skill.md",
|
|
9
|
+
"requires": ["@combos-fun/engine", "@combos-fun/plugin-renderer"],
|
|
10
|
+
"exports": ["Text", "TextSystem"]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-text",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "@combos-fun/plugin-renderer-text",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-text.esm.js",
|
|
@@ -8,8 +8,22 @@
|
|
|
8
8
|
"unpkg": "dist/CombosFun.plugin.renderer.text.min.js",
|
|
9
9
|
"files": [
|
|
10
10
|
"index.js",
|
|
11
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"agent-skill.md",
|
|
13
|
+
"combos-plugin.json"
|
|
12
14
|
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/plugin-renderer-text.esm.js",
|
|
18
|
+
"require": "./index.js",
|
|
19
|
+
"types": "./dist/plugin-renderer-text.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./plugin-manifest": "./combos-plugin.json",
|
|
22
|
+
"./agent-skill": "./agent-skill.md"
|
|
23
|
+
},
|
|
24
|
+
"combos": {
|
|
25
|
+
"pluginManifest": "./combos-plugin.json"
|
|
26
|
+
},
|
|
13
27
|
"types": "dist/plugin-renderer-text.d.ts",
|
|
14
28
|
"keywords": [
|
|
15
29
|
"combos-fun",
|
|
@@ -18,10 +32,10 @@
|
|
|
18
32
|
"author": "sun668 <q947692259@gmail.com>",
|
|
19
33
|
"dependencies": {
|
|
20
34
|
"pixi.js": "^8.18.1",
|
|
21
|
-
"@combos-fun/renderer-adapter": "0.0.
|
|
22
|
-
"@combos-fun/
|
|
23
|
-
"@combos-fun/
|
|
24
|
-
"@combos-fun/
|
|
35
|
+
"@combos-fun/renderer-adapter": "0.0.7",
|
|
36
|
+
"@combos-fun/plugin-renderer": "0.0.7",
|
|
37
|
+
"@combos-fun/inspector-decorator": "0.0.7",
|
|
38
|
+
"@combos-fun/engine": "0.0.7"
|
|
25
39
|
},
|
|
26
40
|
"scripts": {
|
|
27
41
|
"build": "node ../../scripts/build-package.mjs"
|