@combos-fun/engine 0.0.41 → 0.0.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/engine",
3
- "version": "0.0.41",
3
+ "version": "0.0.44",
4
4
  "description": "ECS microkernel",
5
5
  "main": "index.js",
6
6
  "module": "dist/engine.esm.js",
@@ -45,7 +45,7 @@
45
45
  "lodash-es": "^4.17.21",
46
46
  "resource-loader": "^4.0.0-rc4",
47
47
  "sprite-timeline": "^1.10.2",
48
- "@combos-fun/inspector-decorator": "0.0.41"
48
+ "@combos-fun/inspector-decorator": "0.0.44"
49
49
  },
50
50
  "devDependencies": {
51
51
  "tsx": "^4.20.3"
@@ -1,138 +0,0 @@
1
- # Bootstrap examples (on demand)
2
-
3
- Prefer the host template bootstrap. Use these only when starting from zero without a template.
4
-
5
- ## Minimal 2D bootstrap
6
-
7
- ```ts
8
- import {
9
- Game,
10
- GameObject,
11
- resource,
12
- RESOURCE_TYPE,
13
- LOAD_EVENT,
14
- } from "@combos-fun/engine";
15
- import { RendererSystem } from "@combos-fun/plugin-renderer";
16
- import { Render, RenderSystem } from "@combos-fun/plugin-renderer-render";
17
- import { Img, ImgSystem } from "@combos-fun/plugin-renderer-img";
18
-
19
- resource.once(LOAD_EVENT.COMPLETE, () => {
20
- new Game({
21
- systems: [
22
- new RendererSystem({
23
- canvas: document.querySelector("#canvas")!,
24
- width: 750,
25
- height: 1334,
26
- }),
27
- new RenderSystem(),
28
- new ImgSystem(),
29
- ],
30
- // Safe place to wire the scene graph: every system has finished init.
31
- onSystemsBootstrapComplete: (g) => {
32
- // Transform values go through constructor params — never set them imperatively.
33
- const logo = new GameObject("logo", {
34
- position: { x: 100, y: 100 },
35
- size: { width: 200, height: 200 },
36
- origin: { x: 0.5, y: 0.5 },
37
- });
38
- logo.addComponent(new Img({ resource: "logo" }));
39
- // Render is only needed when you want to hide / fade / reorder; without it the
40
- // object is still drawn at alpha 1, zIndex 0. Requires RenderSystem registered.
41
- logo.addComponent(new Render({ zIndex: 5 }));
42
- // Use addChild — not addGameObject — so transform parent + scene are both wired.
43
- g.scene.addChild(logo);
44
- },
45
- });
46
- });
47
-
48
- resource.loadConfig([
49
- {
50
- name: "logo",
51
- type: RESOURCE_TYPE.IMAGE,
52
- src: { image: { type: "png", url: "logo.png" } },
53
- preload: true,
54
- },
55
- ]);
56
- ```
57
-
58
- ## Minimal 3D bootstrap
59
-
60
- ```ts
61
- import {
62
- Game,
63
- GameObject,
64
- resource,
65
- RESOURCE_TYPE,
66
- LOAD_EVENT,
67
- } from "@combos-fun/engine";
68
- import { Renderer3DSystem } from "@combos-fun/plugin-renderer-3d";
69
- import {
70
- Graphics3D,
71
- Graphics3DSystem,
72
- } from "@combos-fun/plugin-renderer-3d-graphics";
73
- import { Model3D, Model3DSystem } from "@combos-fun/plugin-renderer-3d-model";
74
- import { Event3D, Event3DSystem } from "@combos-fun/plugin-renderer-3d-event";
75
-
76
- resource.once(LOAD_EVENT.COMPLETE, () => {
77
- new Game({
78
- systems: [
79
- new Renderer3DSystem({
80
- canvas: document.querySelector("#canvas")!,
81
- width: 750,
82
- height: 1334,
83
- }),
84
- new Graphics3DSystem(),
85
- new Model3DSystem(),
86
- new Event3DSystem(),
87
- ],
88
- // Safe place to wire the scene graph: every system has finished init.
89
- onSystemsBootstrapComplete: (g) => {
90
- // 3D position / rotation / scale go through the component's own params
91
- // (positionX/Y/Z, rotationX/Y/Z, scaleX/Y/Z) — GameObject's TransformParams
92
- // is 2D-only (Vector2 + Size2) and is not read by 3D renderers.
93
- const box = new GameObject("box");
94
- box.addComponent(
95
- new Graphics3D({
96
- shape: "box",
97
- width: 1,
98
- height: 1,
99
- depth: 1,
100
- color: 0xff0000,
101
- positionX: 0,
102
- positionY: 1,
103
- positionZ: 0,
104
- }),
105
- );
106
- box.addComponent(new Event3D());
107
- box.getComponent(Event3D)!.on("tap", () => {
108
- /* handle */
109
- });
110
- // Use addChild — not addGameObject — so transform parent + scene are both wired.
111
- g.scene.addChild(box);
112
-
113
- const hero = new GameObject("hero");
114
- hero.addComponent(new Model3D({ resource: "hero", positionY: 0 }));
115
- g.scene.addChild(hero);
116
- },
117
- });
118
- });
119
-
120
- resource.loadConfig([
121
- {
122
- name: "hero",
123
- type: RESOURCE_TYPE.MODEL,
124
- src: { model: { type: "glb", url: "https://cdn.example/hero.glb" } },
125
- preload: true,
126
- },
127
- ]);
128
- ```
129
-
130
- ## Verification
131
-
132
- After modifying engine code:
133
-
134
- 1. `pnpm typecheck`
135
- 2. `pnpm run build` (rebuild all packages in dependency order)
136
- 3. `pnpm validate-plugin-manifests:strict`
137
- 4. Run an example app from `examples/` and verify no console errors
138
-