@combos-fun/engine 0.1.23 → 0.1.24

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ECS microkernel. New plugins: `plugin-authoring.md`.
4
4
 
5
- - `Game`, `Scene`, `GameObject`, `Component`, `System`, `resource`, `decorators`. Hierarchy: `addChild` / `parent` / `children`. 2D pose: `Transform2D`. 3D pose: `Transform3D`.
5
+ - `Game`, `Scene`, `GameObject`, `Component`, `System`, `resource`, `decorators`. Hierarchy: `addChild` / `parent` / `children`. Import `Transform2D` from `plugin-renderer`, `Transform3D` from `plugin-renderer-3d`.
6
6
  - `await game.addSystem(new XxxSystem(...))`. `Game({ systems })` awaits each `init`. `addSystem(XxxSystem, [params])` passes the tuple as one argument.
7
7
  - `@decorators.componentObserver({ Name: ['prop'] })`, then `componentObserver.clear()` in `update()`.
8
8
  - Order: `Component.update` → `Component.lateUpdate` → `System.update` → `System.lateUpdate`. `start()` runs on the first tick.
@@ -14,5 +14,15 @@ ECS microkernel. New plugins: `plugin-authoring.md`.
14
14
  - Scene: `game.scene`.
15
15
  - Component `game` is a getter (`gameObject?.scene?.game`), after the GameObject is in the scene. System `game` is set in `addSystem`.
16
16
  - `componentObserver.clear()` events may omit `gameObject`.
17
- - `resource.addResource`. Each `src` slot is a url string or `{ type, url }`. `preload: true` loads during startup. Lazy `getResource` loads on first use.
17
+ - `resource.addResource` takes an array. Use `RESOURCE_TYPE` enum values; each `src` slot must be an object with required `type` (file format). TypeScript rejects string slots and `{ url }`. `preload: true` loads during startup. Lazy `getResource` loads on first use.
18
18
  - Inspector fields: `@Field` from `@combos-fun/inspector-decorator`. Engine `IDEProp` is legacy.
19
+
20
+ ```ts
21
+ import { resource, RESOURCE_TYPE } from '@combos-fun/engine';
22
+
23
+ resource.addResource([{
24
+ name: 'hero', type: RESOURCE_TYPE.IMAGE,
25
+ src: { image: { type: 'png', url: './assets/hero.png' } },
26
+ preload: true,
27
+ }]);
28
+ ```
@@ -891,7 +891,7 @@ class Scene extends GameObject {
891
891
  }
892
892
 
893
893
  /** Generated at build from package.json */
894
- const version = "0.1.23";
894
+ const version = "0.1.24";
895
895
 
896
896
  /**
897
897
  * Sent after each `System.init` completes during `Game.addSystem`.
@@ -1269,7 +1269,10 @@ class Game extends EventEmitter__default.default {
1269
1269
  flushObservedComponents() {
1270
1270
  for (const system of this.systems) {
1271
1271
  try {
1272
- system.update?.();
1272
+ system.update?.({
1273
+ deltaTime: 0, delta: 0, time: 0, currentTime: 0,
1274
+ frameCount: 0, fps: 0,
1275
+ });
1273
1276
  }
1274
1277
  catch (e) {
1275
1278
  console.error(`${systemClassName(system.constructor)} update error`, e);
@@ -1897,7 +1900,7 @@ function probeWebGL() {
1897
1900
  return supported;
1898
1901
  }
1899
1902
  async function probeWebGPU() {
1900
- const gpu = (typeof navigator === 'undefined' ? undefined : navigator.gpu);
1903
+ const gpu = (typeof navigator !== 'undefined' && 'gpu' in navigator ? navigator.gpu : undefined);
1901
1904
  if (!gpu?.requestAdapter)
1902
1905
  return false;
1903
1906
  try {