Skip to content

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.

refactor(templates): the new-project templates live engine-side

esengine6e85424be598
diff --git a/build-tools/tasks/check-examples.js b/build-tools/tasks/check-examples.js
index e7f7b6133..929dfa3f7 100644
--- a/build-tools/tasks/check-examples.js
+++ b/build-tools/tasks/check-examples.js
@@ -12,8 +12,8 @@ import { fileURLToPath } from 'url';
import * as logger from '../utils/logger.js';
// Every project directory that ships to users: the examples plus the editor's
-// bundled new-project templates (desktop/templates).
-const PROJECT_ROOTS = ['examples', 'desktop/templates'];
+// bundled new-project templates (templates/).
+const PROJECT_ROOTS = ['examples', 'templates'];
function discoverExamples(rootDir) {
const out = [];
diff --git a/build-tools/tasks/validate-documents.js b/build-tools/tasks/validate-documents.js
index 213ad5135..39170fb51 100644
--- a/build-tools/tasks/validate-documents.js
+++ b/build-tools/tasks/validate-documents.js
@@ -17,7 +17,7 @@ import { pathToFileURL } from 'url';
import * as logger from '../utils/logger.js';
// Every directory tree that ships authored documents to users.
-const DOCUMENT_ROOTS = ['examples', 'sdk/src/ui/widgets/prefabs', 'desktop/templates'];
+const DOCUMENT_ROOTS = ['examples', 'sdk/src/ui/widgets/prefabs', 'templates'];
const SKIP_DIRS = new Set(['node_modules', '.esengine', 'dist', '.git']);
const EXTENSIONS = ['.esprefab', '.esscene'];
diff --git a/desktop/electron-builder.yml b/desktop/electron-builder.yml
index 92181cce1..a77eae725 100644
--- a/desktop/electron-builder.yml
+++ b/desktop/electron-builder.yml
@@ -86,7 +86,7 @@ extraResources:
# exported (dist-playable/, dist-wechat/, dist-game/ … — `dist-<platform>`) sits
# inside the example it came from, and `**/dist/**` never matched those names, so
# local export output rode into the installer.
- - from: templates
+ - from: ../templates
to: templates
filter:
- "**/*"
diff --git a/desktop/electron/launcher.ts b/desktop/electron/launcher.ts
index d3bad63a1..17b9b8dfd 100644
--- a/desktop/electron/launcher.ts
+++ b/desktop/electron/launcher.ts
@@ -115,7 +115,7 @@ const templateRoots = (): Array<{ root: string; kind: TemplateEntry['kind'] }> =
{ root: path.join(process.resourcesPath, 'examples'), kind: 'example' },
]
: [
- { root: path.join(process.env.APP_ROOT ?? '', 'templates'), kind: 'starter' },
+ { root: path.join(process.env.APP_ROOT ?? '', '..', 'templates'), kind: 'starter' },
{ root: path.join(process.env.APP_ROOT ?? '', '..', 'examples'), kind: 'example' },
];
diff --git a/desktop/scripts/editor-checks/starter-3d.mjs b/desktop/scripts/editor-checks/starter-3d.mjs
index 442ce62f5..e5858d69e 100644
--- a/desktop/scripts/editor-checks/starter-3d.mjs
+++ b/desktop/scripts/editor-checks/starter-3d.mjs
@@ -17,7 +17,7 @@
import path from 'node:path';
import { checker, DESKTOP } from '../lib/editorDriver.mjs';
-const TEMPLATE = path.resolve(DESKTOP, 'templates', '3d-starter');
+const TEMPLATE = path.resolve(DESKTOP, '..', 'templates', '3d-starter');
export const name = 'starter-3d';
export const describes = 'the 3D starter template stands up, and its key moves the character';
diff --git a/templates/.gitignore b/templates/.gitignore
deleted file mode 100644
index ac9813a3a..000000000
--- a/templates/.gitignore
+++ /dev/null
@@ -1,19 +0,0 @@
-# Dependencies
-node_modules/
-
-# Build output
-build/
-dist/
-
-# Editor cache
-.esengine/
-
-# IDE
-.vscode/
-.idea/
-*.swp
-*.swo
-
-# OS
-.DS_Store
-Thumbs.db
diff --git a/desktop/templates/2d-platformer/.gitignore b/templates/2d-platformer/.gitignore
similarity index 100%
rename from desktop/templates/2d-platformer/.gitignore
rename to templates/2d-platformer/.gitignore
diff --git a/desktop/templates/2d-platformer/assets/prefabs/Coin.esprefab b/templates/2d-platformer/assets/prefabs/Coin.esprefab
similarity index 100%
rename from desktop/templates/2d-platformer/assets/prefabs/Coin.esprefab
rename to templates/2d-platformer/assets/prefabs/Coin.esprefab
diff --git a/desktop/templates/2d-platformer/assets/prefabs/Coin.esprefab.meta b/templates/2d-platformer/assets/prefabs/Coin.esprefab.meta
similarity index 100%
rename from desktop/templates/2d-platformer/assets/prefabs/Coin.esprefab.meta
rename to templates/2d-platformer/assets/prefabs/Coin.esprefab.meta
diff --git a/desktop/templates/2d-platformer/assets/scenes/main.esscene b/templates/2d-platformer/assets/scenes/main.esscene
similarity index 100%
rename from desktop/templates/2d-platformer/assets/scenes/main.esscene
rename to templates/2d-platformer/assets/scenes/main.esscene
diff --git a/desktop/templates/2d-platformer/assets/scenes/main.esscene.meta b/templates/2d-platformer/assets/scenes/main.esscene.meta
similarity index 100%
rename from desktop/templates/2d-platformer/assets/scenes/main.esscene.meta
rename to templates/2d-platformer/assets/scenes/main.esscene.meta
diff --git a/desktop/templates/2d-platformer/assets/textures/block-guard.ktx2 b/templates/2d-platformer/assets/textures/block-guard.ktx2
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/block-guard.ktx2
rename to templates/2d-platformer/assets/textures/block-guard.ktx2
diff --git a/desktop/templates/2d-platformer/assets/textures/block-guard.ktx2.meta b/templates/2d-platformer/assets/textures/block-guard.ktx2.meta
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/block-guard.ktx2.meta
rename to templates/2d-platformer/assets/textures/block-guard.ktx2.meta
diff --git a/desktop/templates/2d-platformer/assets/textures/coin.png b/templates/2d-platformer/assets/textures/coin.png
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/coin.png
rename to templates/2d-platformer/assets/textures/coin.png
diff --git a/desktop/templates/2d-platformer/assets/textures/coin.png.meta b/templates/2d-platformer/assets/textures/coin.png.meta
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/coin.png.meta
rename to templates/2d-platformer/assets/textures/coin.png.meta
diff --git a/desktop/templates/2d-platformer/assets/textures/ground.png b/templates/2d-platformer/assets/textures/ground.png
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/ground.png
rename to templates/2d-platformer/assets/textures/ground.png
diff --git a/desktop/templates/2d-platformer/assets/textures/ground.png.meta b/templates/2d-platformer/assets/textures/ground.png.meta
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/ground.png.meta
rename to templates/2d-platformer/assets/textures/ground.png.meta
diff --git a/desktop/templates/2d-platformer/assets/textures/platform.png b/templates/2d-platformer/assets/textures/platform.png
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/platform.png
rename to templates/2d-platformer/assets/textures/platform.png
diff --git a/desktop/templates/2d-platformer/assets/textures/platform.png.meta b/templates/2d-platformer/assets/textures/platform.png.meta
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/platform.png.meta
rename to templates/2d-platformer/assets/textures/platform.png.meta
diff --git a/desktop/templates/2d-platformer/assets/textures/player.png b/templates/2d-platformer/assets/textures/player.png
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/player.png
rename to templates/2d-platformer/assets/textures/player.png
diff --git a/desktop/templates/2d-platformer/assets/textures/player.png.meta b/templates/2d-platformer/assets/textures/player.png.meta
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/player.png.meta
rename to templates/2d-platformer/assets/textures/player.png.meta
diff --git a/desktop/templates/2d-platformer/assets/textures/sky.png b/templates/2d-platformer/assets/textures/sky.png
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/sky.png
rename to templates/2d-platformer/assets/textures/sky.png
diff --git a/desktop/templates/2d-platformer/assets/textures/sky.png.meta b/templates/2d-platformer/assets/textures/sky.png.meta
similarity index 100%
rename from desktop/templates/2d-platformer/assets/textures/sky.png.meta
rename to templates/2d-platformer/assets/textures/sky.png.meta
diff --git a/desktop/templates/2d-platformer/project.esproject b/templates/2d-platformer/project.esproject
similarity index 100%
rename from desktop/templates/2d-platformer/project.esproject
rename to templates/2d-platformer/project.esproject
diff --git a/desktop/templates/2d-platformer/src/components.ts b/templates/2d-platformer/src/components.ts
similarity index 100%
rename from desktop/templates/2d-platformer/src/components.ts
rename to templates/2d-platformer/src/components.ts
diff --git a/desktop/templates/2d-platformer/src/main.ts b/templates/2d-platformer/src/main.ts
similarity index 100%
rename from desktop/templates/2d-platformer/src/main.ts
rename to templates/2d-platformer/src/main.ts
diff --git a/desktop/templates/2d-platformer/src/systems/coin.ts b/templates/2d-platformer/src/systems/coin.ts
similarity index 100%
rename from desktop/templates/2d-platformer/src/systems/coin.ts
rename to templates/2d-platformer/src/systems/coin.ts
diff --git a/desktop/templates/2d-platformer/src/systems/player.ts b/templates/2d-platformer/src/systems/player.ts
similarity index 100%
rename from desktop/templates/2d-platformer/src/systems/player.ts
rename to templates/2d-platformer/src/systems/player.ts
diff --git a/desktop/templates/2d-platformer/src/systems/score.ts b/templates/2d-platformer/src/systems/score.ts
similarity index 100%
rename from desktop/templates/2d-platformer/src/systems/score.ts
rename to templates/2d-platformer/src/systems/score.ts
diff --git a/desktop/templates/2d-platformer/tsconfig.json b/templates/2d-platformer/tsconfig.json
similarity index 100%
rename from desktop/templates/2d-platformer/tsconfig.json
rename to templates/2d-platformer/tsconfig.json
diff --git a/desktop/templates/3d-starter/assets/scenes/main.esscene b/templates/3d-starter/assets/scenes/main.esscene
similarity index 100%
rename from desktop/templates/3d-starter/assets/scenes/main.esscene
rename to templates/3d-starter/assets/scenes/main.esscene
diff --git a/desktop/templates/3d-starter/assets/scenes/main.esscene.meta b/templates/3d-starter/assets/scenes/main.esscene.meta
similarity index 100%
rename from desktop/templates/3d-starter/assets/scenes/main.esscene.meta
rename to templates/3d-starter/assets/scenes/main.esscene.meta
diff --git a/desktop/templates/3d-starter/project.esproject b/templates/3d-starter/project.esproject
similarity index 100%
rename from desktop/templates/3d-starter/project.esproject
rename to templates/3d-starter/project.esproject
diff --git a/desktop/templates/3d-starter/src/components.ts b/templates/3d-starter/src/components.ts
similarity index 100%
rename from desktop/templates/3d-starter/src/components.ts
rename to templates/3d-starter/src/components.ts
diff --git a/desktop/templates/3d-starter/src/main.ts b/templates/3d-starter/src/main.ts
similarity index 100%
rename from desktop/templates/3d-starter/src/main.ts
rename to templates/3d-starter/src/main.ts
diff --git a/desktop/templates/3d-starter/src/systems/camera.ts b/templates/3d-starter/src/systems/camera.ts
similarity index 100%
rename from desktop/templates/3d-starter/src/systems/camera.ts
rename to templates/3d-starter/src/systems/camera.ts
diff --git a/desktop/templates/3d-starter/src/systems/walk.ts b/templates/3d-starter/src/systems/walk.ts
similarity index 100%
rename from desktop/templates/3d-starter/src/systems/walk.ts
rename to templates/3d-starter/src/systems/walk.ts
diff --git a/desktop/templates/3d-starter/tsconfig.json b/templates/3d-starter/tsconfig.json
similarity index 100%
rename from desktop/templates/3d-starter/tsconfig.json
rename to templates/3d-starter/tsconfig.json
diff --git a/desktop/templates/blank/assets/scenes/main.esscene b/templates/blank/assets/scenes/main.esscene
similarity index 100%
rename from desktop/templates/blank/assets/scenes/main.esscene
rename to templates/blank/assets/scenes/main.esscene
diff --git a/desktop/templates/blank/assets/scenes/main.esscene.meta b/templates/blank/assets/scenes/main.esscene.meta
similarity index 100%
rename from desktop/templates/blank/assets/scenes/main.esscene.meta
rename to templates/blank/assets/scenes/main.esscene.meta
diff --git a/desktop/templates/blank/project.esproject b/templates/blank/project.esproject
similarity index 100%
rename from desktop/templates/blank/project.esproject
rename to templates/blank/project.esproject
diff --git a/desktop/templates/blank/src/components.ts b/templates/blank/src/components.ts
similarity index 100%
rename from desktop/templates/blank/src/components.ts
rename to templates/blank/src/components.ts
diff --git a/desktop/templates/blank/src/main.ts b/templates/blank/src/main.ts
similarity index 100%
rename from desktop/templates/blank/src/main.ts
rename to templates/blank/src/main.ts
diff --git a/desktop/templates/blank/tsconfig.json b/templates/blank/tsconfig.json
similarity index 100%
rename from desktop/templates/blank/tsconfig.json
rename to templates/blank/tsconfig.json
diff --git a/templates/package.json b/templates/package.json
deleted file mode 100644
index df3d4d2da..000000000
--- a/templates/package.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "{{PROJECT_NAME}}",
- "version": "1.0.0",
- "type": "module",
- "scripts": {
- "build": "npx esbuild src/main.ts --bundle --format=esm --outfile=build/js/main.js --sourcemap",
- "dev": "npx esbuild src/main.ts --bundle --format=esm --outfile=build/js/main.js --sourcemap --watch",
- "typecheck": "npx tsc --noEmit"
- },
- "dependencies": {
- "esengine": "file:{{SDK_PATH}}"
- },
- "devDependencies": {
- "esbuild": "^0.20.0",
- "typescript": "^5.0.0"
- }
-}
diff --git a/desktop/templates/pixel-rpg/assets/animations/walk-down.esanim b/templates/pixel-rpg/assets/animations/walk-down.esanim
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/animations/walk-down.esanim
rename to templates/pixel-rpg/assets/animations/walk-down.esanim
diff --git a/desktop/templates/pixel-rpg/assets/animations/walk-down.esanim.meta b/templates/pixel-rpg/assets/animations/walk-down.esanim.meta
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/animations/walk-down.esanim.meta
rename to templates/pixel-rpg/assets/animations/walk-down.esanim.meta
diff --git a/desktop/templates/pixel-rpg/assets/animations/walk-left.esanim b/templates/pixel-rpg/assets/animations/walk-left.esanim
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/animations/walk-left.esanim
rename to templates/pixel-rpg/assets/animations/walk-left.esanim
diff --git a/desktop/templates/pixel-rpg/assets/animations/walk-left.esanim.meta b/templates/pixel-rpg/assets/animations/walk-left.esanim.meta
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/animations/walk-left.esanim.meta
rename to templates/pixel-rpg/assets/animations/walk-left.esanim.meta
diff --git a/desktop/templates/pixel-rpg/assets/animations/walk-right.esanim b/templates/pixel-rpg/assets/animations/walk-right.esanim
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/animations/walk-right.esanim
rename to templates/pixel-rpg/assets/animations/walk-right.esanim
diff --git a/desktop/templates/pixel-rpg/assets/animations/walk-right.esanim.meta b/templates/pixel-rpg/assets/animations/walk-right.esanim.meta
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/animations/walk-right.esanim.meta
rename to templates/pixel-rpg/assets/animations/walk-right.esanim.meta
diff --git a/desktop/templates/pixel-rpg/assets/animations/walk-up.esanim b/templates/pixel-rpg/assets/animations/walk-up.esanim
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/animations/walk-up.esanim
rename to templates/pixel-rpg/assets/animations/walk-up.esanim
diff --git a/desktop/templates/pixel-rpg/assets/animations/walk-up.esanim.meta b/templates/pixel-rpg/assets/animations/walk-up.esanim.meta
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/animations/walk-up.esanim.meta
rename to templates/pixel-rpg/assets/animations/walk-up.esanim.meta
diff --git a/desktop/templates/pixel-rpg/assets/scenes/main.esscene b/templates/pixel-rpg/assets/scenes/main.esscene
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/scenes/main.esscene
rename to templates/pixel-rpg/assets/scenes/main.esscene
diff --git a/desktop/templates/pixel-rpg/assets/scenes/main.esscene.meta b/templates/pixel-rpg/assets/scenes/main.esscene.meta
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/scenes/main.esscene.meta
rename to templates/pixel-rpg/assets/scenes/main.esscene.meta
diff --git a/desktop/templates/pixel-rpg/assets/textures/hero.png b/templates/pixel-rpg/assets/textures/hero.png
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/textures/hero.png
rename to templates/pixel-rpg/assets/textures/hero.png
diff --git a/desktop/templates/pixel-rpg/assets/textures/hero.png.meta b/templates/pixel-rpg/assets/textures/hero.png.meta
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/textures/hero.png.meta
rename to templates/pixel-rpg/assets/textures/hero.png.meta
diff --git a/desktop/templates/pixel-rpg/assets/textures/tiles.png b/templates/pixel-rpg/assets/textures/tiles.png
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/textures/tiles.png
rename to templates/pixel-rpg/assets/textures/tiles.png
diff --git a/desktop/templates/pixel-rpg/assets/textures/tiles.png.meta b/templates/pixel-rpg/assets/textures/tiles.png.meta
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/textures/tiles.png.meta
rename to templates/pixel-rpg/assets/textures/tiles.png.meta
diff --git a/desktop/templates/pixel-rpg/assets/tilesets/world.estileset b/templates/pixel-rpg/assets/tilesets/world.estileset
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/tilesets/world.estileset
rename to templates/pixel-rpg/assets/tilesets/world.estileset
diff --git a/desktop/templates/pixel-rpg/assets/tilesets/world.estileset.meta b/templates/pixel-rpg/assets/tilesets/world.estileset.meta
similarity index 100%
rename from desktop/templates/pixel-rpg/assets/tilesets/world.estileset.meta
rename to templates/pixel-rpg/assets/tilesets/world.estileset.meta
diff --git a/desktop/templates/pixel-rpg/project.esproject b/templates/pixel-rpg/project.esproject
similarity index 100%
rename from desktop/templates/pixel-rpg/project.esproject
rename to templates/pixel-rpg/project.esproject
diff --git a/desktop/templates/pixel-rpg/src/components.ts b/templates/pixel-rpg/src/components.ts
similarity index 100%
rename from desktop/templates/pixel-rpg/src/components.ts
rename to templates/pixel-rpg/src/components.ts
diff --git a/desktop/templates/pixel-rpg/src/main.ts b/templates/pixel-rpg/src/main.ts
similarity index 100%
rename from desktop/templates/pixel-rpg/src/main.ts
rename to templates/pixel-rpg/src/main.ts
diff --git a/desktop/templates/pixel-rpg/src/systems/follow.ts b/templates/pixel-rpg/src/systems/follow.ts
similarity index 100%
rename from desktop/templates/pixel-rpg/src/systems/follow.ts
rename to templates/pixel-rpg/src/systems/follow.ts
diff --git a/desktop/templates/pixel-rpg/src/systems/move.ts b/templates/pixel-rpg/src/systems/move.ts
similarity index 100%
rename from desktop/templates/pixel-rpg/src/systems/move.ts
rename to templates/pixel-rpg/src/systems/move.ts
diff --git a/desktop/templates/pixel-rpg/src/systems/talk.ts b/templates/pixel-rpg/src/systems/talk.ts
similarity index 100%
rename from desktop/templates/pixel-rpg/src/systems/talk.ts
rename to templates/pixel-rpg/src/systems/talk.ts
diff --git a/desktop/templates/pixel-rpg/tsconfig.json b/templates/pixel-rpg/tsconfig.json
similarity index 100%
rename from desktop/templates/pixel-rpg/tsconfig.json
rename to templates/pixel-rpg/tsconfig.json
diff --git a/desktop/templates/playable-ad/assets/scenes/main.esscene b/templates/playable-ad/assets/scenes/main.esscene
similarity index 100%
rename from desktop/templates/playable-ad/assets/scenes/main.esscene
rename to templates/playable-ad/assets/scenes/main.esscene
diff --git a/desktop/templates/playable-ad/assets/scenes/main.esscene.meta b/templates/playable-ad/assets/scenes/main.esscene.meta
similarity index 100%
rename from desktop/templates/playable-ad/assets/scenes/main.esscene.meta
rename to templates/playable-ad/assets/scenes/main.esscene.meta
diff --git a/desktop/templates/playable-ad/project.esproject b/templates/playable-ad/project.esproject
similarity index 100%
rename from desktop/templates/playable-ad/project.esproject
rename to templates/playable-ad/project.esproject
diff --git a/desktop/templates/playable-ad/src/components.ts b/templates/playable-ad/src/components.ts
similarity index 100%
rename from desktop/templates/playable-ad/src/components.ts
rename to templates/playable-ad/src/components.ts
diff --git a/desktop/templates/playable-ad/src/main.ts b/templates/playable-ad/src/main.ts
similarity index 100%
rename from desktop/templates/playable-ad/src/main.ts
rename to templates/playable-ad/src/main.ts
diff --git a/desktop/templates/playable-ad/tsconfig.json b/templates/playable-ad/tsconfig.json
similarity index 100%
rename from desktop/templates/playable-ad/tsconfig.json
rename to templates/playable-ad/tsconfig.json
diff --git a/templates/src/main.ts b/templates/src/main.ts
deleted file mode 100644
index bdaa513d1..000000000
--- a/templates/src/main.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * ESEngine Project Entry Point
- *
- * This file is the main entry point for your game logic.
- * Press F5 in the editor to run, or use Web Preview for browser testing.
- */
-import {
- type ESEngineModule,
- App,
- createWebApp,
- defineSystem,
- Schedule,
- Commands,
- Transform,
- Sprite,
- Camera,
- Canvas,
- Res,
- Time,
- Query,
- Mut,
- type Entity
-} from 'esengine';
-
-// =============================================================================
-// Main Entry Point
-// =============================================================================
-
-export async function main(Module: ESEngineModule): Promise<void> {
- console.log('ESEngine starting...');
-
- // Create the app with WASM module (handles renderer init + render loop)
- const app = createWebApp(Module);
-
- // Add startup system - runs once at beginning
- app.addSystemToSchedule(Schedule.Startup, defineSystem(
- [Commands()],
- (cmds) => {
- console.log('Startup: Creating entities...');
-
- // Create camera
- const camera = cmds.spawn()
- .insert(Camera, {
- projectionType: 1, // Orthographic
- fov: 60,
- orthoSize: 400,
- nearPlane: 0.1,
- farPlane: 1000,
- aspectRatio: 1,
- isActive: true,
- priority: 0
- })
- .insert(Transform, {
- position: { x: 0, y: 0, z: 10 },
- rotation: { w: 1, x: 0, y: 0, z: 0 },
- scale: { x: 1, y: 1, z: 1 }
- })
- .id();
-
- // Create a test sprite
- const sprite = cmds.spawn()
- .insert(Sprite, {
- texture: 0,
- color: { r: 1, g: 0.5, b: 0.2, a: 1 },
- size: { x: 100, y: 100 },
- uvOffset: { x: 0, y: 0 },
- uvScale: { x: 1, y: 1 },
- layer: 0,
- flipX: false,
- flipY: false
- })
- .insert(Transform, {
- position: { x: 0, y: 0, z: 0 },
- rotation: { w: 1, x: 0, y: 0, z: 0 },
- scale: { x: 1, y: 1, z: 1 }
- })
- .id();
-
- console.log(`Created camera: ${camera}, sprite: ${sprite}`);
- }
- ));
-
- // Add update system - runs every frame
- app.addSystemToSchedule(Schedule.Update, defineSystem(
- [Res(Time), Query(Transform, Sprite)],
- (time, query) => {
- for (const [entity, transform, sprite] of query) {
- // Move the sprite in a circle
- transform.position.x = Math.sin(time.elapsed) * 100;
- transform.position.y = Math.cos(time.elapsed) * 100;
- }
- }
- ));
-
- // Start the game loop
- console.log('Starting game loop...');
- app.run();
-}
diff --git a/desktop/templates/top-down/assets/scenes/main.esscene b/templates/top-down/assets/scenes/main.esscene
similarity index 100%
rename from desktop/templates/top-down/assets/scenes/main.esscene
rename to templates/top-down/assets/scenes/main.esscene
diff --git a/desktop/templates/top-down/assets/scenes/main.esscene.meta b/templates/top-down/assets/scenes/main.esscene.meta
similarity index 100%
rename from desktop/templates/top-down/assets/scenes/main.esscene.meta
rename to templates/top-down/assets/scenes/main.esscene.meta
diff --git a/desktop/templates/top-down/assets/textures/player.png b/templates/top-down/assets/textures/player.png
similarity index 100%
rename from desktop/templates/top-down/assets/textures/player.png
rename to templates/top-down/assets/textures/player.png
diff --git a/desktop/templates/top-down/assets/textures/player.png.meta b/templates/top-down/assets/textures/player.png.meta
similarity index 100%
rename from desktop/templates/top-down/assets/textures/player.png.meta
rename to templates/top-down/assets/textures/player.png.meta
diff --git a/desktop/templates/top-down/project.esproject b/templates/top-down/project.esproject
similarity index 100%
rename from desktop/templates/top-down/project.esproject
rename to templates/top-down/project.esproject
diff --git a/desktop/templates/top-down/src/components.ts b/templates/top-down/src/components.ts
similarity index 100%
rename from desktop/templates/top-down/src/components.ts
rename to templates/top-down/src/components.ts
diff --git a/desktop/templates/top-down/src/main.ts b/templates/top-down/src/main.ts
similarity index 100%
rename from desktop/templates/top-down/src/main.ts
rename to templates/top-down/src/main.ts
diff --git a/desktop/templates/top-down/src/systems/follow.ts b/templates/top-down/src/systems/follow.ts
similarity index 100%
rename from desktop/templates/top-down/src/systems/follow.ts
rename to templates/top-down/src/systems/follow.ts
diff --git a/desktop/templates/top-down/src/systems/move.ts b/templates/top-down/src/systems/move.ts
similarity index 100%
rename from desktop/templates/top-down/src/systems/move.ts
rename to templates/top-down/src/systems/move.ts
diff --git a/desktop/templates/top-down/tsconfig.json b/templates/top-down/tsconfig.json
similarity index 100%
rename from desktop/templates/top-down/tsconfig.json
rename to templates/top-down/tsconfig.json
diff --git a/templates/tsconfig.json b/templates/tsconfig.json
deleted file mode 100644
index 84d188ba9..000000000
--- a/templates/tsconfig.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES2020",
- "module": "ESNext",
- "lib": ["ES2020", "DOM"],
- "moduleResolution": "node",
- "strict": true,
- "esModuleInterop": true,
- "skipLibCheck": true,
- "forceConsistentCasingInFileNames": true,
- "noEmit": true
- },
- "include": ["src/**/*.ts"],
- "exclude": ["node_modules", "build"]
-}
diff --git a/desktop/templates/ui-game/assets/scenes/main.esscene b/templates/ui-game/assets/scenes/main.esscene
similarity index 100%
rename from desktop/templates/ui-game/assets/scenes/main.esscene
rename to templates/ui-game/assets/scenes/main.esscene
diff --git a/desktop/templates/ui-game/assets/scenes/main.esscene.meta b/templates/ui-game/assets/scenes/main.esscene.meta
similarity index 100%
rename from desktop/templates/ui-game/assets/scenes/main.esscene.meta
rename to templates/ui-game/assets/scenes/main.esscene.meta
diff --git a/desktop/templates/ui-game/project.esproject b/templates/ui-game/project.esproject
similarity index 100%
rename from desktop/templates/ui-game/project.esproject
rename to templates/ui-game/project.esproject
diff --git a/desktop/templates/ui-game/src/components.ts b/templates/ui-game/src/components.ts
similarity index 100%
rename from desktop/templates/ui-game/src/components.ts
rename to templates/ui-game/src/components.ts
diff --git a/desktop/templates/ui-game/src/main.ts b/templates/ui-game/src/main.ts
similarity index 100%
rename from desktop/templates/ui-game/src/main.ts
rename to templates/ui-game/src/main.ts
diff --git a/desktop/templates/ui-game/src/systems/hud.ts b/templates/ui-game/src/systems/hud.ts
similarity index 100%
rename from desktop/templates/ui-game/src/systems/hud.ts
rename to templates/ui-game/src/systems/hud.ts
diff --git a/desktop/templates/ui-game/src/systems/round.ts b/templates/ui-game/src/systems/round.ts
similarity index 100%
rename from desktop/templates/ui-game/src/systems/round.ts
rename to templates/ui-game/src/systems/round.ts
diff --git a/desktop/templates/ui-game/tsconfig.json b/templates/ui-game/tsconfig.json
similarity index 100%
rename from desktop/templates/ui-game/tsconfig.json
rename to templates/ui-game/tsconfig.json
diff --git a/templates/web/index.html b/templates/web/index.html
deleted file mode 100644
index 636164a6e..000000000
--- a/templates/web/index.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
- <title>{{PROJECT_NAME}}</title>
- <style>
- * { margin: 0; padding: 0; box-sizing: border-box; }
- html, body {
- width: 100%;
- height: 100%;
- overflow: hidden;
- background-color: #1a1a1a;
- }
- #canvas {
- display: block;
- width: 100%;
- height: 100%;
- touch-action: none;
- }
- #loading {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- color: #fff;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
- font-size: 16px;
- text-align: center;
- }
- #loading.hidden { display: none; }
- .spinner {
- width: 40px;
- height: 40px;
- margin: 0 auto 16px;
- border: 3px solid #333;
- border-top-color: #3b82f6;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- }
- @keyframes spin { to { transform: rotate(360deg); } }
- </style>
-</head>
-<body>
- <div id="loading">
- <div class="spinner"></div>
- <div>Loading...</div>
- </div>
- <canvas id="canvas"></canvas>
-
- <script type="module">
- const v = Date.now();
- const { default: ESEngineModule } = await import(`./esengine.js?v=${v}`);
- const { main } = await import(`./scripts/main.js?v=${v}`);
-
- function resizeCanvas() {
- const canvas = document.getElementById('canvas');
- const dpr = window.devicePixelRatio || 1;
- canvas.width = window.innerWidth * dpr;
- canvas.height = window.innerHeight * dpr;
- }
- window.addEventListener('resize', resizeCanvas);
- resizeCanvas();
-
- ESEngineModule({
- canvas: document.getElementById('canvas'),
- print: (text) => console.log(text),
- printErr: (text) => console.error(text)
- }).then(async (Module) => {
- console.log('ESEngine loaded');
- document.getElementById('loading').classList.add('hidden');
- await main(Module);
- }).catch((err) => {
- if (err === 'unwind' || (err.message && err.message.includes('unwind'))) {
- console.log('App running');
- return;
- }
- console.error('Failed:', err);
- document.getElementById('loading').innerHTML = '<div style="color:#f87171">Error: ' + err.message + '</div>';
- });
- </script>
-</body>
-</html>
diff --git a/desktop/templates/wechat-minigame/assets/scenes/main.esscene b/templates/wechat-minigame/assets/scenes/main.esscene
similarity index 100%
rename from desktop/templates/wechat-minigame/assets/scenes/main.esscene
rename to templates/wechat-minigame/assets/scenes/main.esscene
diff --git a/desktop/templates/wechat-minigame/assets/scenes/main.esscene.meta b/templates/wechat-minigame/assets/scenes/main.esscene.meta
similarity index 100%
rename from desktop/templates/wechat-minigame/assets/scenes/main.esscene.meta
rename to templates/wechat-minigame/assets/scenes/main.esscene.meta
diff --git a/desktop/templates/wechat-minigame/project.esproject b/templates/wechat-minigame/project.esproject
similarity index 100%
rename from desktop/templates/wechat-minigame/project.esproject
rename to templates/wechat-minigame/project.esproject
diff --git a/desktop/templates/wechat-minigame/src/components.ts b/templates/wechat-minigame/src/components.ts
similarity index 100%
rename from desktop/templates/wechat-minigame/src/components.ts
rename to templates/wechat-minigame/src/components.ts
diff --git a/desktop/templates/wechat-minigame/src/main.ts b/templates/wechat-minigame/src/main.ts
similarity index 100%
rename from desktop/templates/wechat-minigame/src/main.ts
rename to templates/wechat-minigame/src/main.ts
diff --git a/desktop/templates/wechat-minigame/tsconfig.json b/templates/wechat-minigame/tsconfig.json
similarity index 100%
rename from desktop/templates/wechat-minigame/tsconfig.json
rename to templates/wechat-minigame/tsconfig.json