A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
docs: fix API errors, missing fields, and broken references across all documentation
esengineb1cf36275a35
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 1233ee020..352fb37a3 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -104,7 +104,7 @@ We follow a strict commit message format:### Code Style-- **C++**: See naming conventions and formatting rules in `CLAUDE.md`+- **C++**: See naming conventions and formatting rules in [`docs/CODING_STYLE.md`](docs/CODING_STYLE.md)- **TypeScript**: Strict mode, use `defineComponent()` and `defineSystem()`- **Comments**: Code should be self-documenting. Only add comments for non-obvious logic.diff --git a/SECURITY.md b/SECURITY.mdindex 263b71687..bf98698da 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -4,8 +4,9 @@| Version | Supported ||---------|-----------|-| 0.5.x | Yes |-| < 0.5 | No |+| 0.7.x | Yes |+| 0.6.x | Yes |+| < 0.6 | No |## Reporting a Vulnerabilitydiff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 50b805adf..60a3aa008 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -251,8 +251,8 @@ The SDK provides a first-class scene management system built on top of ECS resou## Future Improvements- [ ] Component groups for cache optimization-- [ ] Event/signal system-- [ ] Audio system+- [x] Event/signal system+- [x] Audio system- [x] Scene serialization- [x] Physics integration- [x] UI systemdiff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.mdindex 466149a2c..d6a3c3b0a 100644--- a/docs/CODING_STYLE.md+++ b/docs/CODING_STYLE.md@@ -131,13 +131,12 @@ std::unique_ptr<Shader> shader = std::make_unique<Shader>();### Comments```cpp-// Single-line comments for brief explanations-int count = 0; // Track entity count+// Only comment non-obvious logic — code should be self-documenting-/*- * Multi-line comments for longer explanations.- * Use these sparingly - code should be self-documenting.- */+// WebGL 1.0 does not support NPOT texture mipmaps+if (!isPowerOfTwo(width)) {+ disableMipmaps();+}/// Doxygen-style comments for public API documentation/// @param entity The entity to querydiff --git a/docs/README.md b/docs/README.mdindex 1633d0d84..083373200 100644--- a/docs/README.md+++ b/docs/README.md@@ -126,7 +126,7 @@ int main() {### GitHub Actions (Automatic)Documentation is automatically built and deployed when:-- Changes are pushed to `main` branch in `docs/`, `src/**/*.hpp`, or `include/**/*.hpp`+- Changes are pushed to `master` branch in `docs/`, `src/**/*.hpp`, or `include/**/*.hpp`- Workflow is manually triggered**Setup GitHub Pages:**diff --git a/docs/astro/astro.config.mjs b/docs/astro/astro.config.mjsindex aaf8388c8..3fb7656b0 100644--- a/docs/astro/astro.config.mjs+++ b/docs/astro/astro.config.mjs@@ -26,7 +26,7 @@ export default defineConfig({discord: 'https://discord.gg/sAX6PXZ9',},editLink: {- baseUrl: 'https://github.com/esengine/microes/edit/main/docs/astro/',+ baseUrl: 'https://github.com/esengine/microes/edit/master/docs/astro/',},customCss: ['./src/styles/custom.css',@@ -99,6 +99,9 @@ export default defineConfig({{ label: 'Geometry & Meshes', translations: { 'zh-CN': '几何体与网格' }, slug: 'guides/geometry' },{ label: 'Physics', translations: { 'zh-CN': '物理' }, slug: 'guides/physics' },{ label: 'Profiler', translations: { 'zh-CN': '性能分析' }, slug: 'guides/profiler' },+ { label: 'Debugging', translations: { 'zh-CN': '调试' }, slug: 'guides/debugging' },+ { label: 'Game View', translations: { 'zh-CN': 'Game View' }, slug: 'guides/game-view' },+ { label: 'Project Settings', translations: { 'zh-CN': '项目设置' }, slug: 'guides/project-settings' },{ label: 'Editor Extensions', translations: { 'zh-CN': '编辑器扩展' }, slug: 'guides/editor-extensions' },{ label: 'Plugins', translations: { 'zh-CN': '插件系统' }, slug: 'guides/plugins' },{ label: 'Building', translations: { 'zh-CN': '构建' }, slug: 'guides/building' },diff --git a/docs/astro/src/content/docs/core-concepts/change-detection.mdx b/docs/astro/src/content/docs/core-concepts/change-detection.mdxindex 0c06a70dd..017c9b27c 100644--- a/docs/astro/src/content/docs/core-concepts/change-detection.mdx+++ b/docs/astro/src/content/docs/core-concepts/change-detection.mdx@@ -32,7 +32,9 @@ An entity appears in an `Added` query in the frame it was spawned or the frame a`Changed()` filters a query to only yield entities where a component value was modified:```typescript-import { defineSystem, addSystem, Query, Changed, Mut, Health, Sprite } from 'esengine';+import { defineSystem, defineComponent, addSystem, Query, Changed, Mut, Sprite } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });const healthBarSystem = defineSystem([Query(Changed(Health), Mut(Sprite))],@@ -56,7 +58,9 @@ A component is marked as changed whenever `world.insert()`, `world.set()`, or `C`Removed()` is a standalone query type (not a filter on `Query`). It yields the entity IDs of entities that had a specific component removed:```typescript-import { defineSystem, addSystem, Removed, Commands, Health } from 'esengine';+import { defineSystem, defineComponent, addSystem, Removed, Commands } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });addSystem(defineSystem([Removed(Health), Commands()],@@ -80,7 +84,9 @@ Removed entries are kept in a buffer for 2 ticks, then automatically cleaned up.You can mix `Added`, `Changed`, and `Removed` in the same system:```typescript-import { defineSystem, Query, Added, Changed, Removed, Mut, Transform, Velocity, Health, Commands } from 'esengine';+import { defineSystem, defineComponent, Query, Added, Changed, Removed, Mut, Transform, Velocity, Commands, Sprite } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });defineSystem([diff --git a/docs/astro/src/content/docs/core-concepts/components.mdx b/docs/astro/src/content/docs/core-concepts/components.mdxindex e63d6a866..ef09f6976 100644--- a/docs/astro/src/content/docs/core-concepts/components.mdx+++ b/docs/astro/src/content/docs/core-concepts/components.mdx@@ -20,6 +20,9 @@ Position, rotation, and scale of an entity.| `position` | Vec3 | Local position `{ x, y, z }` || `rotation` | Quat | Quaternion `{ w, x, y, z }` || `scale` | Vec3 | Scale factor `{ x, y, z }` |+| `worldPosition` | Vec3 | Computed world position (read-only) |+| `worldRotation` | Quat | Computed world rotation (read-only) |+| `worldScale` | Vec3 | Computed world scale (read-only) |<Aside type="note">In previous versions, `LocalTransform` and `WorldTransform` were separate components. They have been unified into a single `Transform`. The old names still work as aliases but `Transform` is the recommended import.@@ -97,6 +100,7 @@ GPU-rendered text using pre-baked bitmap font atlases (BMFont format). Requires| `spacing` | number | Extra spacing between characters || `layer` | number | Render layer || `font` | number | Font handle from `assets.loadBitmapFont()` |+| `enabled` | boolean | Whether this text is rendered |### Text@@ -134,6 +138,7 @@ Clips child entities to the parent's `UIRect` bounds. Requires `UIRect` and `Tra| Property | Type | Default | Description ||----------|------|---------|-------------|| `enabled` | boolean | `true` | Whether clipping is active |+| `mode` | number | `0` | Masking technique: 0=Scissor, 1=Stencil |### Interactable@@ -142,6 +147,8 @@ Marks a UI element as interactive (receives pointer events). Requires `UIRect`.| Property | Type | Default | Description ||----------|------|---------|-------------|| `enabled` | boolean | `true` | Whether interaction is active |+| `blockRaycast` | boolean | `true` | Block raycast from reaching entities behind |+| `raycastTarget` | boolean | `true` | Whether this entity is a valid raycast hit target |### Button@@ -188,6 +195,7 @@ Physics body attached to an entity. Requires `Transform`.| `friction` | number | `0.3` | Surface friction || `restitution` | number | `0.0` | Bounciness || `isSensor` | boolean | `false` | Trigger-only (no physical response) |+| `enabled` | boolean | `true` | Enable this collider |#### CircleCollider@@ -199,6 +207,7 @@ Physics body attached to an entity. Requires `Transform`.| `friction` | number | `0.3` | Surface friction || `restitution` | number | `0.0` | Bounciness || `isSensor` | boolean | `false` | Trigger-only (no physical response) |+| `enabled` | boolean | `true` | Enable this collider |#### CapsuleCollider@@ -211,6 +220,7 @@ Physics body attached to an entity. Requires `Transform`.| `friction` | number | `0.3` | Surface friction || `restitution` | number | `0.0` | Bounciness || `isSensor` | boolean | `false` | Trigger-only (no physical response) |+| `enabled` | boolean | `true` | Enable this collider |## Component Enabled Togglediff --git a/docs/astro/src/content/docs/core-concepts/events.mdx b/docs/astro/src/content/docs/core-concepts/events.mdxindex 2f27f13bf..464f7155a 100644--- a/docs/astro/src/content/docs/core-concepts/events.mdx+++ b/docs/astro/src/content/docs/core-concepts/events.mdx@@ -28,7 +28,10 @@ const Damage = defineEvent<DamageEvent>('Damage');Use `EventWriter` as a system parameter to send events:```typescript-import { defineSystem, addSystem, EventWriter, Query, Health } from 'esengine';+import { defineSystem, defineComponent, defineTag, addSystem, EventWriter, Query } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });+const Enemy = defineTag('Enemy');addSystem(defineSystem([EventWriter(Damage), Query(Health, Enemy)],@@ -95,7 +98,11 @@ Events last exactly **1 frame**. If no system reads them, they are silently discA complete example with three decoupled systems:```typescript-import { defineEvent, defineSystem, addSystem, EventWriter, EventReader, GetWorld, Query, Mut, Commands, Health, Sprite } from 'esengine';+import { defineEvent, defineSystem, defineComponent, defineTag, addSystem, EventWriter, EventReader, GetWorld, Query, Mut, Commands, Transform } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });+const Enemy = defineTag('Enemy');+const Projectile = defineComponent('Projectile', { radius: 10, power: 25 });// 1. Define the eventinterface DamageEvent {@@ -123,7 +130,7 @@ const healthSystem = defineSystem([EventReader(Damage), GetWorld()],(events, world) => {for (const { target, amount } of events) {- const health = world.get(target, Health);+ const health = world.tryGet(target, Health);if (health) {health.current -= amount;world.set(target, Health, health);@@ -137,7 +144,7 @@ const hitVFXSystem = defineSystem([EventReader(Damage), GetWorld()],(events, world) => {for (const { target } of events) {- const transform = world.get(target, Transform);+ const transform = world.tryGet(target, Transform);if (transform) {spawnHitParticle(transform.position);}diff --git a/docs/astro/src/content/docs/core-concepts/queries.mdx b/docs/astro/src/content/docs/core-concepts/queries.mdxindex b72715075..4fe01ac56 100644--- a/docs/astro/src/content/docs/core-concepts/queries.mdx+++ b/docs/astro/src/content/docs/core-concepts/queries.mdx@@ -82,7 +82,10 @@ query.toArray(); // collect all results into an arrayUse `.with()` and `.without()` to filter entities by the presence or absence of components, without including them in the result tuple:```typescript-import { Query, Transform, Sprite, Hidden } from 'esengine';+import { Query, Mut, Transform, Sprite, defineTag } from 'esengine';++const Player = defineTag('Player');+const Hidden = defineTag('Hidden');// Match entities with Transform AND Sprite, but only those that also have PlayerdefineSystem(@@ -108,6 +111,7 @@ defineSystem(You can chain multiple `.with()` and `.without()` calls:```typescript+const Disabled = defineTag('Disabled');Query(Mut(Transform), Sprite).with(Player).without(Hidden, Disabled)```@@ -237,7 +241,9 @@ During query iteration, you **cannot** directly create or destroy entities, or iThe correct approach is to use `Commands` to defer modifications until after iteration completes:```typescript-import { defineSystem, addSystem, Commands, Query, Health } from 'esengine';+import { defineSystem, defineComponent, addSystem, Commands, Query } from 'esengine';++const Health = defineComponent('Health', { value: 100 });const despawnDead = defineSystem([Commands(), Query(Health)],diff --git a/docs/astro/src/content/docs/core-concepts/resources.mdx b/docs/astro/src/content/docs/core-concepts/resources.mdxindex 076681bc4..e2901fd1a 100644--- a/docs/astro/src/content/docs/core-concepts/resources.mdx+++ b/docs/astro/src/content/docs/core-concepts/resources.mdx@@ -27,7 +27,7 @@ defineSystem([ResMut(GameState)], (state) => {});```-`ResMut` wraps the resource value. Access the data with `.get()`, or use `.modify()`:+`ResMut` wraps the resource value. Access the data with `.get()`, replace it entirely with `.set()`, or use `.modify()` for partial updates:```typescriptdefineSystem([ResMut(GameState)], (state) => {diff --git a/docs/astro/src/content/docs/core-concepts/systems.mdx b/docs/astro/src/content/docs/core-concepts/systems.mdxindex 120bd0784..2c6ace78c 100644--- a/docs/astro/src/content/docs/core-concepts/systems.mdx+++ b/docs/astro/src/content/docs/core-concepts/systems.mdx@@ -59,12 +59,7 @@ addSystemToSchedule(Schedule.FixedUpdate, physicsSystem);<Aside type="note">The Fixed schedules (`FixedPreUpdate`, `FixedUpdate`, `FixedPostUpdate`) run at a fixed timestep of 1/60s using an accumulator. In a single frame they may execute zero or multiple times depending on the frame duration, up to a maximum of **8 iterations** per frame. Use them for physics and other deterministic logic that requires consistent time steps.- The maximum number of iterations is configurable via `RuntimeConfig`:-- ```typescript- import { RuntimeConfig } from 'esengine';- RuntimeConfig.maxFixedSteps = 8; // default- ```+ The maximum number of iterations is configurable in the editor under **Settings → Project → Runtime → Max Fixed Steps**. The build pipeline applies this setting automatically.</Aside><Aside type="note">diff --git a/docs/astro/src/content/docs/en/guides/wechat.mdx b/docs/astro/src/content/docs/en/guides/wechat.mdxdeleted file mode 100644index eb7fc911d..000000000--- a/docs/astro/src/content/docs/en/guides/wechat.mdx+++ /dev/null@@ -1,164 +0,0 @@-----title: WeChat MiniGame-description: Build and deploy ESEngine games to the WeChat MiniGame platform------import { Aside } from '@astrojs/starlight/components';--ESEngine supports building games as WeChat MiniGames. The editor handles the entire build process, producing a project directory that can be opened directly in WeChat DevTools.--## Prerequisites--Before building for WeChat MiniGame, ensure you have:--1. **WeChat DevTools** installed ([download](https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html))-2. A **WeChat MiniGame AppID** (optional for testing -- you can use `touristappid`)--## Building a WeChat MiniGame--### 1. Open the Build Panel--Open the **Build** panel from the editor toolbar and select or create a WeChat MiniGame configuration.--### 2. Configure Settings--| Setting | Description |-|---------|-------------|-| **AppID** | WeChat MiniGame AppID. Use `touristappid` for testing without a registered app. |-| **Version** | Version string (e.g. `1.0.0`) |-| **Orientation** | `Portrait` or `Landscape` |-| **Pack Mode** | `Subpackage` (recommended for most games), `Single` or `Single File` |-| **Output Directory** | Where to write the build output (e.g. `build/wechat`) |--### 3. Add Scenes--Make sure the scenes you want to include are listed in the scene list. Click **Add Current Scene** to add the scene currently open in the editor.--### 4. Click Build--Click **Build** or press `Cmd/Ctrl + B`. The editor will:--1. Collect all assets referenced by scenes-2. Pack textures into atlas pages-3. Compile materials and user scripts-4. Generate `game.js`, `game.json` and `project.config.json`-5. Copy the engine WASM files and SDK-6. Write the complete project to the output directory--Build progress is displayed in real time.--## Opening in WeChat DevTools--After a successful build:--1. Open **WeChat DevTools**-2. Click **Import Project**-3. Navigate to the build output directory (e.g. `build/wechat`)-4. The AppID will auto-fill from `project.config.json`-5. Click **Import**--Your game should load and run in the simulator.--<Aside type="tip">- After the build completes, click **Open Folder** in the editor build output panel to quickly navigate to the output directory.-</Aside>--## Build Output--The build produces the following directory structure:--```-build/wechat/- project.config.json # WeChat DevTools project configuration- game.json # MiniGame manifest (orientation, subpackages, etc.)- game.js # Entry point (engine init + user scripts)- esengine.js # WASM engine loader- esengine.wasm # Engine WASM binary- sdk.js # ESEngine SDK runtime- spine.js / spine.wasm # Spine runtime (if Spine is enabled)- physics.js / physics.wasm # Physics engine (if physics is enabled)- asset-manifest.json # Addressable asset manifest- atlas_0.png, ... # Packed texture atlas pages- scenes/ # Scene JSON files- assets/ # Game assets (textures, Spine data, etc.)-```--### What `game.js` Does--The generated `game.js` is the MiniGame entry point. It automatically handles all platform-specific initialization:--- Creates a canvas and sets the correct resolution-- Loads the WASM engine using `WXWebAssembly.instantiate()`-- Registers the WebGL context with the engine-- Loads and runs user scripts-- Loads the startup scene and starts the game loop--You should not need to modify `game.js` under normal usage.--## Platform Differences--WeChat MiniGames run in a custom JavaScript runtime that differs from standard browsers:--- **No DOM**: There is no `document` or HTML elements. The canvas is provided by `wx.createCanvas()`.-- **No dynamic execution**: `eval()` and `new Function()` are disabled. The build handles this limitation automatically.-- **Touch input only**: Input comes from the WeChat touch API. The SDK translates it to standard pointer events.-- **Custom file system**: Files are read via `wx.getFileSystemManager()` rather than HTTP fetch.--These differences are handled transparently by the build output. Your game scripts work the same way regardless of the target platform.--## Custom Extension Files--WeChat blocks access to files with unrecognized extensions by default. The build automatically generates the correct `packOptions.include` entries in `project.config.json` for all ESEngine file types (`.esmaterial`, `.esprefab`, `.atlas`, `.skel`, `.fnt`, `.bmfont`).--<Aside type="caution">- If you add custom asset types with non-standard extensions, you may need to manually add them to `packOptions.include` in the generated `project.config.json`.-</Aside>--## Troubleshooting--### "Permission denied" when reading files--This occurs when WeChat blocks access to files with unrecognized extensions. The build automatically generates `packOptions.include`, but if you have manually added new asset types, verify the extension is listed:--```json-{- "packOptions": {- "include": [- { "type": "suffix", "value": ".yourextension" }- ]- }-}-```--### "File not found"--The asset was not included in the build. Ensure one of the following:-- It is referenced by a scene or prefab (automatically included)-- Its folder has export mode set to `always` in the asset export configuration--### WebGL context errors--If you see `Failed to create WebGL context`, make sure the WeChat base library version supports WebGL 2. The build defaults `libVersion` to `3.0.0`, but verify in WeChat DevTools under **Project Settings > Base Library Version**.--### White screen--- Check the WeChat DevTools console for error messages-- Ensure scenes are listed in the build configuration-- Verify the output directory contains all expected files (especially `esengine.wasm` and `sdk.js`)--## Advanced: Customizing `game.js`--For advanced use cases (adding WeChat-specific APIs, analytics, or ad SDKs), you can modify the generated `game.js` after building. Key extension points:--- **Before scene load**: Add initialization code after `SDK.flushPendingSystems(app)` and before scene loading-- **After scene load**: Add code after `SDK.loadRuntimeScene(...)` and before `app.run()`--<Aside type="caution">- Each build will overwrite your `game.js` modifications. If you need persistent customizations, keep a copy and merge changes after rebuilding.-</Aside>--## Next Steps--- [Building & Exporting](/microes/en/guides/building/) -- Build pipeline overview-- [Playable Ads](/microes/en/guides/playable-ads/) -- Single-file HTML builds for ad networks-- [Asset Loading](/microes/en/guides/assets/) -- Asset loading APIdiff --git a/docs/astro/src/content/docs/getting-started/quick-start.mdx b/docs/astro/src/content/docs/getting-started/quick-start.mdxindex 86b131bca..f556e2f2a 100644--- a/docs/astro/src/content/docs/getting-started/quick-start.mdx+++ b/docs/astro/src/content/docs/getting-started/quick-start.mdx@@ -103,9 +103,14 @@ addSystemToSchedule(Schedule.FixedUpdate, system); // runs at fixed intervals| Schedule | When it runs ||----------|--------------|| `Startup` | Once at the beginning |-| `Update` | Every frame |+| `First` | Before PreUpdate, every frame |+| `PreUpdate` | Before Update, every frame |+| `Update` | Every frame (default) || `PostUpdate` | After Update, every frame |+| `Last` | After PostUpdate, every frame |+| `FixedPreUpdate` | Before FixedUpdate, at fixed intervals || `FixedUpdate` | At fixed time intervals |+| `FixedPostUpdate` | After FixedUpdate, at fixed intervals |### Runtime Spawningdiff --git a/docs/astro/src/content/docs/guides/audio.mdx b/docs/astro/src/content/docs/guides/audio.mdxindex 32ce19f05..c4c88b988 100644--- a/docs/astro/src/content/docs/guides/audio.mdx+++ b/docs/astro/src/content/docs/guides/audio.mdx@@ -95,6 +95,7 @@ Both `playSFX` and entity-based playback return an `AudioHandle`:| `isPlaying` | Whether audio is currently playing || `currentTime` | Current playback position in seconds || `duration` | Total duration in seconds |+| `onEnd` | Optional callback invoked when playback finishes |## Volume Controldiff --git a/docs/astro/src/content/docs/guides/bitmap-text.mdx b/docs/astro/src/content/docs/guides/bitmap-text.mdxindex 75b0cd6f1..0003b740e 100644--- a/docs/astro/src/content/docs/guides/bitmap-text.mdx+++ b/docs/astro/src/content/docs/guides/bitmap-text.mdx@@ -22,6 +22,7 @@ The `BitmapText` component renders text using pre-baked bitmap font atlases (BMF| `spacing` | number | `0` | Extra spacing between characters (pixels) || `layer` | number | `0` | Render layer for draw ordering || `font` | number | `INVALID_FONT` | Font handle returned by `assets.loadBitmapFont()` |+| `enabled` | boolean | `true` | Whether this text is rendered |## Font Formatsdiff --git a/docs/astro/src/content/docs/en/guides/debugging.mdx b/docs/astro/src/content/docs/guides/debugging.mdxsimilarity index 97%rename from docs/astro/src/content/docs/en/guides/debugging.mdxrename to docs/astro/src/content/docs/guides/debugging.mdxindex cf47c83ea..6893eb785 100644--- a/docs/astro/src/content/docs/en/guides/debugging.mdx+++ b/docs/astro/src/content/docs/guides/debugging.mdx@@ -280,6 +280,6 @@ const narrowSystem = defineSystem(## Next Steps-- [Custom Draw](/microes/en/guides/custom-draw/) -- Debug visualization with the Draw API-- [Building & Exporting](/microes/en/guides/building/) -- Build pipeline and configuration-- [Scenes](/microes/en/guides/scenes/) -- Scene loading and management+- [Custom Draw](/microes/guides/custom-draw/) -- Debug visualization with the Draw API+- [Building & Exporting](/microes/guides/building/) -- Build pipeline and configuration+- [Scenes](/microes/guides/scenes/) -- Scene loading and managementdiff --git a/docs/astro/src/content/docs/guides/geometry.mdx b/docs/astro/src/content/docs/guides/geometry.mdxindex 38ef722f2..c8138f1d7 100644--- a/docs/astro/src/content/docs/guides/geometry.mdx+++ b/docs/astro/src/content/docs/guides/geometry.mdx@@ -106,7 +106,7 @@ import { registerDrawCallback, Draw, Geometry, Material, BlendMode } from 'esengconst quad = Geometry.createQuad(100, 100);const mat = Material.create({shader: myShader,- uniforms: { u_color: { r: 1, g: 0, b: 0, a: 1 } },+ uniforms: { u_color: { x: 1, y: 0, z: 0, w: 1 } },blendMode: BlendMode.Normal,});diff --git a/docs/astro/src/content/docs/guides/materials.mdx b/docs/astro/src/content/docs/guides/materials.mdxindex b38f632c2..b6f2b045a 100644--- a/docs/astro/src/content/docs/guides/materials.mdx+++ b/docs/astro/src/content/docs/guides/materials.mdx@@ -47,7 +47,7 @@ const mat = Material.create({shader,uniforms: {u_time: 0,- u_tint: { r: 1, g: 0, b: 0, a: 1 },+ u_tint: { x: 1, y: 0, z: 0, w: 1 },},blendMode: BlendMode.Additive,});@@ -70,7 +70,7 @@ sprite.material = mat;```typescriptMaterial.setUniform(mat, 'u_time', elapsed);-Material.setUniform(mat, 'u_tint', { r: 1, g: 0.5, b: 0, a: 1 });+Material.setUniform(mat, 'u_tint', { x: 1, y: 0.5, z: 0, w: 1 });const time = Material.getUniform(mat, 'u_time');```@@ -82,7 +82,6 @@ const time = Material.getUniform(mat, 'u_time');| number | `1.5` || Vec2 | `{ x: 0.5, y: 1.0 }` || Vec3 | `{ x: 1, y: 0, z: 0 }` |-| Color | `{ r: 1, g: 1, b: 1, a: 1 }` || Vec4 | `{ x: 1, y: 1, z: 1, w: 1 }` || number[] | `[1, 2, 3, 4]` || TextureRef | `Material.tex(textureId, slot?)` |@@ -117,7 +116,7 @@ Create an instance that shares the same shader but has independent uniforms:```typescriptconst instance = Material.createInstance(sourceMat);-Material.setUniform(instance, 'u_tint', { r: 0, g: 1, b: 0, a: 1 });+Material.setUniform(instance, 'u_tint', { x: 0, y: 1, z: 0, w: 1 });```## Shader File Format (.esshader)diff --git a/docs/astro/src/content/docs/guides/plugins.mdx b/docs/astro/src/content/docs/guides/plugins.mdxindex 8ffcd3287..c8f1d4528 100644--- a/docs/astro/src/content/docs/guides/plugins.mdx+++ b/docs/astro/src/content/docs/guides/plugins.mdx@@ -16,8 +16,8 @@ When you create a project in the editor, all built-in plugins are active by defa| Plugin | What It Provides ||--------|-----------------|| Asset loading | `AssetServer` for loading textures, Spine data, prefabs, and other assets at runtime |-| Prefabs | `PrefabServer` for instantiating prefabs |-| Input | `InputState` with keyboard, mouse, and touch input -- cleared each frame |+| Prefabs | `Prefabs` resource for instantiating prefabs |+| Input | `Input` resource with keyboard, mouse, and touch input -- cleared each frame |### UI Plugins@@ -40,7 +40,6 @@ When you create a project in the editor, all built-in plugins are active by defa| Focus | `Focusable` -- keyboard focus and Tab navigation || Safe Area | `SafeArea` -- adapts layout to device safe areas (notches, rounded corners) || Layout Group | `LayoutGroup` -- grid-like layout with direction, spacing, and alignment |-| Flex Layout | `FlexContainer`, `FlexItem` -- CSS Flexbox-like automatic child arrangement |All of these are active by default in every project. You can use their components directly from the editor's component picker -- no setup required.diff --git a/docs/astro/src/content/docs/guides/profiler.mdx b/docs/astro/src/content/docs/guides/profiler.mdxindex bcf01638d..013a2227c 100644--- a/docs/astro/src/content/docs/guides/profiler.mdx+++ b/docs/astro/src/content/docs/guides/profiler.mdx@@ -78,24 +78,28 @@ addSystem(defineSystem(## Frame History-The profiler maintains a 300-frame rolling buffer for trend analysis:+`FrameHistory` is a utility class that maintains a rolling buffer for trend analysis. Create an instance and feed it data from the `Stats` resource:```typescript-import { FrameHistory } from 'esengine';+import { FrameHistory, Stats, Res, defineSystem, addSystem } from 'esengine';-const history = app.getResource(FrameHistory);+const history = new FrameHistory(300);-// Get all recorded frames-const frames = history.getAll();+addSystem(defineSystem(+ [Res(Stats)],+ (stats) => {+ history.push(stats.frameTimeMs, new Map());+ }+));// Get the most recent frame snapshotconst latest = history.getLatest();if (latest) {console.log(`Frame time: ${latest.frameTimeMs}ms`);- for (const [system, ms] of latest.systemTimings) {- console.log(` ${system}: ${ms.toFixed(2)}ms`);- }}++// Get all recorded frames+const frames = history.getAll();```## Editor Integrationdiff --git a/docs/astro/src/content/docs/guides/spine.mdx b/docs/astro/src/content/docs/guides/spine.mdxindex aca091d1e..6a6fe99f6 100644--- a/docs/astro/src/content/docs/guides/spine.mdx+++ b/docs/astro/src/content/docs/guides/spine.mdx@@ -28,6 +28,7 @@ The `SpineAnimation` component plays [Spine](http://esotericsoftware.com/) skele| `layer` | number | `0` | Render order || `skeletonScale` | number | `1.0` | Skeleton scale factor || `material` | number | `0` | Material ID |+| `enabled` | boolean | `true` | Whether this animation is rendered |## Setupdiff --git a/docs/astro/src/content/docs/guides/sprite.mdx b/docs/astro/src/content/docs/guides/sprite.mdxindex 0bed1c347..1f85362d2 100644--- a/docs/astro/src/content/docs/guides/sprite.mdx+++ b/docs/astro/src/content/docs/guides/sprite.mdx@@ -20,6 +20,7 @@ The `Sprite` component is the primary way to display 2D graphics. Add it to an e| `flipX` | boolean | `false` | Flip horizontally || `flipY` | boolean | `false` | Flip vertically || `material` | number | `0` | Material ID |+| `enabled` | boolean | `true` | Whether this sprite is rendered |## Basic Usagediff --git a/docs/astro/src/content/docs/guides/ui-interaction.mdx b/docs/astro/src/content/docs/guides/ui-interaction.mdxindex 88878f818..019f64840 100644--- a/docs/astro/src/content/docs/guides/ui-interaction.mdx+++ b/docs/astro/src/content/docs/guides/ui-interaction.mdx@@ -13,6 +13,7 @@ Marks a UI entity as interactive (receives pointer events). Required for all int|----------|------|---------|-------------|| `enabled` | boolean | `true` | Whether interaction is active || `blockRaycast` | boolean | `true` | Block events from reaching elements behind |+| `raycastTarget` | boolean | `true` | Whether this entity is a valid raycast hit target |## UIInteraction@@ -70,6 +71,7 @@ Each event object contains:| `entity` | Entity | The entity that received the event || `type` | string | Event type (see table above) || `target` | Entity | Original entity that triggered the event |+| `currentTarget` | Entity | Entity currently handling the event during bubbling |### Querying Events@@ -111,6 +113,8 @@ Enables drag-to-move on a UI element.| `dragThreshold` | number | `5` | Pixels before drag starts || `lockX` | boolean | `false` | Lock horizontal movement || `lockY` | boolean | `false` | Lock vertical movement |+| `constraintMin` | `{x, y}` \| null | `null` | Minimum position constraint |+| `constraintMax` | `{x, y}` \| null | `null` | Maximum position constraint |When dragging is active, the engine adds a `DragState` component to the entity:@@ -118,6 +122,7 @@ When dragging is active, the engine adds a `DragState` component to the entity:|----------|------|-------------|| `isDragging` | boolean | Currently dragging || `startWorldPos` | `{x, y}` | Entity position when drag started |+| `pointerStartWorld` | `{x, y}` | Pointer position in world space when drag started || `currentWorldPos` | `{x, y}` | Current world position || `deltaWorld` | `{x, y}` | Movement this frame || `totalDeltaWorld` | `{x, y}` | Total movement since drag start |diff --git a/docs/astro/src/content/docs/guides/ui-masking.mdx b/docs/astro/src/content/docs/guides/ui-masking.mdxindex 513781c33..8f521978a 100644--- a/docs/astro/src/content/docs/guides/ui-masking.mdx+++ b/docs/astro/src/content/docs/guides/ui-masking.mdx@@ -40,7 +40,7 @@ Clips all **child** entities to the parent's `UIRect` bounds. The entity with `U### Setup in Code```typescript-import { UIMask, MaskMode } from 'esengine';+import { UIMask } from 'esengine';// Create a mask containerconst panel = world.spawn();@@ -48,7 +48,8 @@ world.insert(panel, UIRect, {anchorMin: { x: 0.1, y: 0.1 },anchorMax: { x: 0.9, y: 0.9 },});-world.insert(panel, UIMask, { enabled: true, mode: MaskMode.Scissor });+// mode: 0 = Scissor, 1 = Stencil+world.insert(panel, UIMask, { enabled: true, mode: 0 });// Child content — automatically clippedconst content = world.spawn();diff --git a/docs/astro/src/content/docs/guides/ui-widgets.mdx b/docs/astro/src/content/docs/guides/ui-widgets.mdxindex 140f4f7ea..68689f21f 100644--- a/docs/astro/src/content/docs/guides/ui-widgets.mdx+++ b/docs/astro/src/content/docs/guides/ui-widgets.mdx@@ -265,6 +265,8 @@ Scrollable container with momentum and elastic bounce.| `decelerationRate` | number | `0.135` | Momentum friction || `elastic` | boolean | `true` | Bounce at edges || `wheelSensitivity` | number | `0.1` | Mouse wheel amount |+| `contentWidth` | number | `0` | Total width of scrollable content |+| `contentHeight` | number | `0` | Total height of scrollable content |## ListViewdiff --git a/docs/astro/src/content/docs/zh/core-concepts/change-detection.mdx b/docs/astro/src/content/docs/zh/core-concepts/change-detection.mdxindex cecc35769..433f86619 100644--- a/docs/astro/src/content/docs/zh/core-concepts/change-detection.mdx+++ b/docs/astro/src/content/docs/zh/core-concepts/change-detection.mdx@@ -32,7 +32,9 @@ addSystem(defineSystem(`Changed()` 过滤查询,仅返回组件值被修改过的实体:```typescript-import { defineSystem, addSystem, Query, Changed, Mut, Health, Sprite } from 'esengine';+import { defineSystem, addSystem, Query, Changed, Mut, Sprite, defineComponent } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });const healthBarSystem = defineSystem([Query(Changed(Health), Mut(Sprite))],@@ -56,7 +58,9 @@ const healthBarSystem = defineSystem(`Removed()` 是独立的查询类型(不是 `Query` 的过滤器)。它返回被移除了特定组件的实体 ID:```typescript-import { defineSystem, addSystem, Removed, Commands, Health } from 'esengine';+import { defineSystem, addSystem, Removed, Commands, defineComponent } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });addSystem(defineSystem([Removed(Health), Commands()],@@ -80,7 +84,9 @@ addSystem(defineSystem(可以在同一个系统中混合使用 `Added`、`Changed` 和 `Removed`:```typescript-import { defineSystem, Query, Added, Changed, Removed, Mut, Transform, Velocity, Health, Commands } from 'esengine';+import { defineSystem, Query, Added, Changed, Removed, Mut, Transform, Velocity, Commands, defineComponent } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });defineSystem([diff --git a/docs/astro/src/content/docs/zh/core-concepts/components.mdx b/docs/astro/src/content/docs/zh/core-concepts/components.mdxindex fdc116e6c..9aace5ef3 100644--- a/docs/astro/src/content/docs/zh/core-concepts/components.mdx+++ b/docs/astro/src/content/docs/zh/core-concepts/components.mdx@@ -20,6 +20,9 @@ import { Aside } from '@astrojs/starlight/components';| `position` | Vec3 | 局部坐标 `{ x, y, z }` || `rotation` | Quat | 四元数 `{ w, x, y, z }` || `scale` | Vec3 | 缩放因子 `{ x, y, z }` |+| `worldPosition` | Vec3 | 世界坐标(只读) |+| `worldRotation` | Quat | 世界旋转(只读) |+| `worldScale` | Vec3 | 世界缩放(只读) |<Aside type="note">在之前的版本中,`LocalTransform` 和 `WorldTransform` 是两个独立组件。现在已统一为单一的 `Transform`。旧名称仍可作为别名使用,但推荐导入 `Transform`。@@ -97,6 +100,7 @@ Spine 骨骼动画播放。需要 `Transform`。详见 [Spine 动画指南](/mic| `spacing` | number | 字符间额外间距 || `layer` | number | 渲染层级 || `font` | number | `assets.loadBitmapFont()` 返回的字体句柄 |+| `enabled` | boolean | 是否渲染该组件 |### Text@@ -134,6 +138,7 @@ UI 布局矩形。定义 UI 元素的锚点布局。| 属性 | 类型 | 默认值 | 说明 ||------|------|--------|------|| `enabled` | boolean | `true` | 是否启用裁剪 |+| `mode` | number | `0` | 遮罩模式:0=Scissor,1=Stencil |### Interactable@@ -142,6 +147,8 @@ UI 布局矩形。定义 UI 元素的锚点布局。| 属性 | 类型 | 默认值 | 说明 ||------|------|--------|------|| `enabled` | boolean | `true` | 是否启用交互 |+| `blockRaycast` | boolean | `true` | 阻止事件传递到后面的元素 |+| `raycastTarget` | boolean | `true` | 是否参与射线检测 |### Button@@ -188,6 +195,7 @@ UI 元素的按钮行为。需要 `Interactable` 和 `UIRect`。| `friction` | number | `0.3` | 表面摩擦力 || `restitution` | number | `0.0` | 弹性(弹力) || `isSensor` | boolean | `false` | 仅触发(无物理响应) |+| `enabled` | boolean | `true` | 启用碰撞体 |#### CircleCollider@@ -199,6 +207,7 @@ UI 元素的按钮行为。需要 `Interactable` 和 `UIRect`。| `friction` | number | `0.3` | 表面摩擦力 || `restitution` | number | `0.0` | 弹性(弹力) || `isSensor` | boolean | `false` | 仅触发(无物理响应) |+| `enabled` | boolean | `true` | 启用碰撞体 |#### CapsuleCollider@@ -211,6 +220,7 @@ UI 元素的按钮行为。需要 `Interactable` 和 `UIRect`。| `friction` | number | `0.3` | 表面摩擦力 || `restitution` | number | `0.0` | 弹性(弹力) || `isSensor` | boolean | `false` | 仅触发(无物理响应) |+| `enabled` | boolean | `true` | 启用碰撞体 |## 组件启用开关diff --git a/docs/astro/src/content/docs/zh/core-concepts/events.mdx b/docs/astro/src/content/docs/zh/core-concepts/events.mdxindex 874fd59c4..868b07486 100644--- a/docs/astro/src/content/docs/zh/core-concepts/events.mdx+++ b/docs/astro/src/content/docs/zh/core-concepts/events.mdx@@ -28,7 +28,10 @@ const Damage = defineEvent<DamageEvent>('Damage');使用 `EventWriter` 作为系统参数来发送事件:```typescript-import { defineSystem, addSystem, EventWriter, Query, Health } from 'esengine';+import { defineSystem, addSystem, EventWriter, Query, defineComponent, defineTag } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });+const Enemy = defineTag('Enemy');addSystem(defineSystem([EventWriter(Damage), Query(Health, Enemy)],@@ -95,7 +98,11 @@ events.toArray() // 将所有事件收集为数组一个完整的示例,包含三个解耦的系统:```typescript-import { defineEvent, defineSystem, addSystem, EventWriter, EventReader, GetWorld, Query, Mut, Commands, Health, Sprite } from 'esengine';+import { defineEvent, defineSystem, addSystem, EventWriter, EventReader, GetWorld, Query, Mut, Commands, Sprite, defineComponent, defineTag } from 'esengine';++const Health = defineComponent('Health', { current: 100, max: 100 });+const Projectile = defineComponent('Projectile', { radius: 5, power: 10 });+const Enemy = defineTag('Enemy');// 1. 定义事件interface DamageEvent {@@ -123,7 +130,7 @@ const healthSystem = defineSystem([EventReader(Damage), GetWorld()],(events, world) => {for (const { target, amount } of events) {- const health = world.get(target, Health);+ const health = world.tryGet(target, Health);if (health) {health.current -= amount;world.set(target, Health, health);@@ -137,7 +144,7 @@ const hitVFXSystem = defineSystem([EventReader(Damage), GetWorld()],(events, world) => {for (const { target } of events) {- const transform = world.get(target, Transform);+ const transform = world.tryGet(target, Transform);if (transform) {spawnHitParticle(transform.position);}diff --git a/docs/astro/src/content/docs/zh/core-concepts/queries.mdx b/docs/astro/src/content/docs/zh/core-concepts/queries.mdxindex 76a23b6fb..33465e282 100644--- a/docs/astro/src/content/docs/zh/core-concepts/queries.mdx+++ b/docs/astro/src/content/docs/zh/core-concepts/queries.mdx@@ -82,7 +82,10 @@ query.toArray(); // 将所有结果收集到数组中使用 `.with()` 和 `.without()` 按组件的有无过滤实体,且不将这些组件包含在结果元组中:```typescript-import { Query, Transform, Sprite, Hidden } from 'esengine';+import { Query, Transform, Sprite, defineTag } from 'esengine';++const Hidden = defineTag('Hidden');+const Disabled = defineTag('Disabled');// 匹配有 Transform 和 Sprite 的实体,但只要同时有 Player 的defineSystem(@@ -237,7 +240,9 @@ addSystem(defineSystem(正确做法是使用 `Commands` 将修改延迟到迭代结束后执行:```typescript-import { defineSystem, addSystem, Commands, Query, Health } from 'esengine';+import { defineSystem, addSystem, Commands, Query, defineComponent } from 'esengine';++const Health = defineComponent('Health', { value: 100 });const despawnDead = defineSystem([Commands(), Query(Health)],diff --git a/docs/astro/src/content/docs/zh/core-concepts/resources.mdx b/docs/astro/src/content/docs/zh/core-concepts/resources.mdxindex e0818a758..60cce57d5 100644--- a/docs/astro/src/content/docs/zh/core-concepts/resources.mdx+++ b/docs/astro/src/content/docs/zh/core-concepts/resources.mdx@@ -27,7 +27,7 @@ defineSystem([ResMut(GameState)], (state) => {});```-`ResMut` 包装了资源值。用 `.get()` 访问数据,或使用 `.modify()`:+`ResMut` 包装了资源值。用 `.get()` 访问数据,用 `.set()` 替换整个值,或使用 `.modify()`:```typescriptdefineSystem([ResMut(GameState)], (state) => {diff --git a/docs/astro/src/content/docs/zh/core-concepts/systems.mdx b/docs/astro/src/content/docs/zh/core-concepts/systems.mdxindex dfa509b65..7c39ac494 100644--- a/docs/astro/src/content/docs/zh/core-concepts/systems.mdx+++ b/docs/astro/src/content/docs/zh/core-concepts/systems.mdx@@ -59,12 +59,7 @@ addSystemToSchedule(Schedule.FixedUpdate, physicsSystem);<Aside type="note">Fixed 系列调度(`FixedPreUpdate`、`FixedUpdate`、`FixedPostUpdate`)以 1/60s 固定步长运行,使用累加器驱动。一帧内可能执行零次或多次,取决于帧时长,每帧最多执行 **8 次迭代**。适用于物理等需要一致时间步的确定性逻辑。- 最大迭代次数可通过 `RuntimeConfig` 配置:-- ```typescript- import { RuntimeConfig } from 'esengine';- RuntimeConfig.maxFixedSteps = 8; // 默认值- ```+ 最大迭代次数可在编辑器中配置:**Settings → Project → Runtime → Max Fixed Steps**。构建时自动应用。</Aside><Aside type="note">diff --git a/docs/astro/src/content/docs/zh/getting-started/quick-start.mdx b/docs/astro/src/content/docs/zh/getting-started/quick-start.mdxindex f56314298..9ee60f9ff 100644--- a/docs/astro/src/content/docs/zh/getting-started/quick-start.mdx+++ b/docs/astro/src/content/docs/zh/getting-started/quick-start.mdx@@ -103,9 +103,14 @@ addSystemToSchedule(Schedule.FixedUpdate, system); // 固定间隔运行| Schedule | 运行时机 ||----------|----------|| `Startup` | 启动时运行一次 |+| `First` | 每帧最先运行 |+| `FixedPreUpdate` | 固定间隔,FixedUpdate 之前 |+| `FixedUpdate` | 固定时间间隔运行 |+| `FixedPostUpdate` | 固定间隔,FixedUpdate 之后 |+| `PreUpdate` | 每帧 Update 之前 || `Update` | 每帧运行 || `PostUpdate` | 每帧 Update 之后 |-| `FixedUpdate` | 固定时间间隔运行 |+| `Last` | 每帧最后运行 |### 运行时创建实体diff --git a/docs/astro/src/content/docs/zh/guides/audio.mdx b/docs/astro/src/content/docs/zh/guides/audio.mdxindex 736e67ba6..2b5315c0e 100644--- a/docs/astro/src/content/docs/zh/guides/audio.mdx+++ b/docs/astro/src/content/docs/zh/guides/audio.mdx@@ -92,6 +92,7 @@ Audio.stopAll();| `setPan(p)` | 设置立体声声像(-1 左, 0 中, 1 右) || `setLoop(l)` | 启用/禁用循环 || `setPlaybackRate(r)` | 设置播放速度 |+| `onEnd(cb)` | 注册播放结束回调 || `isPlaying` | 是否正在播放 || `currentTime` | 当前播放位置(秒) || `duration` | 总时长(秒) |diff --git a/docs/astro/src/content/docs/zh/guides/bitmap-text.mdx b/docs/astro/src/content/docs/zh/guides/bitmap-text.mdxindex 93042ab57..a4b2d3c9a 100644--- a/docs/astro/src/content/docs/zh/guides/bitmap-text.mdx+++ b/docs/astro/src/content/docs/zh/guides/bitmap-text.mdx@@ -22,6 +22,7 @@ import { Aside } from '@astrojs/starlight/components';| `spacing` | number | `0` | 字符间额外间距(像素) || `layer` | number | `0` | 渲染层级,用于绘制排序 || `font` | number | `INVALID_FONT` | `assets.loadBitmapFont()` 返回的字体句柄 |+| `enabled` | boolean | `true` | 是否渲染文本 |## 字体格式diff --git a/docs/astro/src/content/docs/zh/guides/geometry.mdx b/docs/astro/src/content/docs/zh/guides/geometry.mdxindex fa36c9598..e09d076a6 100644--- a/docs/astro/src/content/docs/zh/guides/geometry.mdx+++ b/docs/astro/src/content/docs/zh/guides/geometry.mdx@@ -106,7 +106,7 @@ import { registerDrawCallback, Draw, Geometry, Material, BlendMode } from 'esengconst quad = Geometry.createQuad(100, 100);const mat = Material.create({shader: myShader,- uniforms: { u_color: { r: 1, g: 0, b: 0, a: 1 } },+ uniforms: { u_color: { x: 1, y: 0, z: 0, w: 1 } },blendMode: BlendMode.Normal,});diff --git a/docs/astro/src/content/docs/zh/guides/materials.mdx b/docs/astro/src/content/docs/zh/guides/materials.mdxindex 6be2a36b4..85e02c904 100644--- a/docs/astro/src/content/docs/zh/guides/materials.mdx+++ b/docs/astro/src/content/docs/zh/guides/materials.mdx@@ -47,7 +47,7 @@ const mat = Material.create({shader,uniforms: {u_time: 0,- u_tint: { r: 1, g: 0, b: 0, a: 1 },+ u_tint: { x: 1, y: 0, z: 0, w: 1 },},blendMode: BlendMode.Additive,});@@ -70,7 +70,7 @@ sprite.material = mat;```typescriptMaterial.setUniform(mat, 'u_time', elapsed);-Material.setUniform(mat, 'u_tint', { r: 1, g: 0.5, b: 0, a: 1 });+Material.setUniform(mat, 'u_tint', { x: 1, y: 0.5, z: 0, w: 1 });const time = Material.getUniform(mat, 'u_time');```@@ -82,7 +82,6 @@ const time = Material.getUniform(mat, 'u_time');| number | `1.5` || Vec2 | `{ x: 0.5, y: 1.0 }` || Vec3 | `{ x: 1, y: 0, z: 0 }` |-| Color | `{ r: 1, g: 1, b: 1, a: 1 }` || Vec4 | `{ x: 1, y: 1, z: 1, w: 1 }` || number[] | `[1, 2, 3, 4]` || TextureRef | `Material.tex(textureId, slot?)` |@@ -117,7 +116,7 @@ const mode = Material.getBlendMode(mat);```typescriptconst instance = Material.createInstance(sourceMat);-Material.setUniform(instance, 'u_tint', { r: 0, g: 1, b: 0, a: 1 });+Material.setUniform(instance, 'u_tint', { x: 0, y: 1, z: 0, w: 1 });```## 着色器文件格式(.esshader)diff --git a/docs/astro/src/content/docs/zh/guides/plugins.mdx b/docs/astro/src/content/docs/zh/guides/plugins.mdxindex 913d1d62a..72e70e8bd 100644--- a/docs/astro/src/content/docs/zh/guides/plugins.mdx+++ b/docs/astro/src/content/docs/zh/guides/plugins.mdx@@ -16,8 +16,8 @@ import { Aside } from '@astrojs/starlight/components';| 插件 | 提供的功能 ||------|-----------|| 资源加载 | `AssetServer`,用于在运行时加载纹理、Spine 数据、预制体等资源 |-| 预制体 | `PrefabServer`,用于实例化预制体 |-| 输入 | `InputState`,包含键盘、鼠标和触摸输入——每帧末尾清除 |+| 预制体 | `Prefabs`,用于实例化预制体 |+| 输入 | `Input`,包含键盘、鼠标和触摸输入——每帧末尾清除 |### UI 插件@@ -40,7 +40,6 @@ import { Aside } from '@astrojs/starlight/components';| 焦点 | `Focusable` — 键盘焦点和 Tab 导航 || 安全区域 | `SafeArea` — 适配设备安全区域(刘海、圆角) || 布局组 | `LayoutGroup` — 带方向、间距和对齐的网格式布局 |-| 弹性布局 | `FlexContainer`、`FlexItem` — 类 CSS Flexbox 的自动子元素排列 |以上插件在每个项目中默认激活。你可以直接从编辑器的组件选择器中使用它们的组件——无需任何设置。diff --git a/docs/astro/src/content/docs/zh/guides/spine.mdx b/docs/astro/src/content/docs/zh/guides/spine.mdxindex ff2aa8b24..c6931b845 100644--- a/docs/astro/src/content/docs/zh/guides/spine.mdx+++ b/docs/astro/src/content/docs/zh/guides/spine.mdx@@ -28,6 +28,7 @@ import { Aside } from '@astrojs/starlight/components';| `layer` | number | `0` | 渲染顺序 || `skeletonScale` | number | `1.0` | 骨骼缩放因子 || `material` | number | `0` | 材质 ID |+| `enabled` | boolean | `true` | 是否渲染骨骼动画 |## 设置步骤diff --git a/docs/astro/src/content/docs/zh/guides/sprite.mdx b/docs/astro/src/content/docs/zh/guides/sprite.mdxindex 743a4f6ab..85d508c47 100644--- a/docs/astro/src/content/docs/zh/guides/sprite.mdx+++ b/docs/astro/src/content/docs/zh/guides/sprite.mdx@@ -20,6 +20,7 @@ import { Aside } from '@astrojs/starlight/components';| `flipX` | boolean | `false` | 水平翻转 || `flipY` | boolean | `false` | 垂直翻转 || `material` | number | `0` | 材质 ID |+| `enabled` | boolean | `true` | 是否渲染精灵 |## 基本用法diff --git a/docs/astro/src/content/docs/zh/guides/ui-interaction.mdx b/docs/astro/src/content/docs/zh/guides/ui-interaction.mdxindex 51ea694a5..4ec2b4fdf 100644--- a/docs/astro/src/content/docs/zh/guides/ui-interaction.mdx+++ b/docs/astro/src/content/docs/zh/guides/ui-interaction.mdx@@ -13,6 +13,7 @@ import { Aside } from '@astrojs/starlight/components';|------|------|--------|------|| `enabled` | boolean | `true` | 是否启用交互 || `blockRaycast` | boolean | `true` | 阻止事件传递到后面的元素 |+| `raycastTarget` | boolean | `true` | 是否参与射线检测 |## UIInteraction@@ -70,6 +71,7 @@ addSystem(defineSystem(| `entity` | Entity | 接收事件的实体 || `type` | string | 事件类型(见上表) || `target` | Entity | 触发事件的原始实体 |+| `currentTarget` | Entity | 当前正在处理事件的实体(冒泡时可能不同于 target) |### 查询事件@@ -111,6 +113,8 @@ const all = events.drain();| `dragThreshold` | number | `5` | 开始拖拽前的像素移动距离 || `lockX` | boolean | `false` | 锁定水平移动 || `lockY` | boolean | `false` | 锁定垂直移动 |+| `constraintMin` | `{x, y}` \| null | `null` | 拖拽范围最小值(世界坐标) |+| `constraintMax` | `{x, y}` \| null | `null` | 拖拽范围最大值(世界坐标) |拖拽激活时,引擎会自动为实体添加 `DragState` 组件:@@ -121,6 +125,7 @@ const all = events.drain();| `currentWorldPos` | `{x, y}` | 当前世界位置 || `deltaWorld` | `{x, y}` | 本帧移动量 || `totalDeltaWorld` | `{x, y}` | 从拖拽开始的总移动量 |+| `pointerStartWorld` | `{x, y}` | 拖拽开始时的指针世界位置 |## 处理管线diff --git a/docs/astro/src/content/docs/zh/guides/ui-masking.mdx b/docs/astro/src/content/docs/zh/guides/ui-masking.mdxindex 4189e490b..7f7db2645 100644--- a/docs/astro/src/content/docs/zh/guides/ui-masking.mdx+++ b/docs/astro/src/content/docs/zh/guides/ui-masking.mdx@@ -40,7 +40,7 @@ import { Aside } from '@astrojs/starlight/components';### 在代码中设置```typescript-import { UIMask, MaskMode } from 'esengine';+import { UIMask } from 'esengine';// 创建遮罩容器const panel = world.spawn();@@ -48,7 +48,7 @@ world.insert(panel, UIRect, {anchorMin: { x: 0.1, y: 0.1 },anchorMax: { x: 0.9, y: 0.9 },});-world.insert(panel, UIMask, { enabled: true, mode: MaskMode.Scissor });+world.insert(panel, UIMask, { enabled: true, mode: 0 /* Scissor */ });// 子内容 — 自动被裁剪const content = world.spawn();diff --git a/docs/astro/src/content/docs/zh/guides/ui-widgets.mdx b/docs/astro/src/content/docs/zh/guides/ui-widgets.mdxindex 71fc18d82..c7fc1af96 100644--- a/docs/astro/src/content/docs/zh/guides/ui-widgets.mdx+++ b/docs/astro/src/content/docs/zh/guides/ui-widgets.mdx@@ -265,6 +265,8 @@ addSystem(defineSystem(| `decelerationRate` | number | `0.135` | 惯性摩擦力 || `elastic` | boolean | `true` | 边缘回弹 || `wheelSensitivity` | number | `0.1` | 鼠标滚轮灵敏度 |+| `contentWidth` | number | `0` | 可滚动内容总宽度(由插件自动计算) |+| `contentHeight` | number | `0` | 可滚动内容总高度(由插件自动计算) |## ListView