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
fix: Re-enable EHT and fix TypeScript output path
esenginef986dd4cc791
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 2c06bbcf9..b677781b1 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -84,7 +84,7 @@ set(ESENGINE_HEADERS)set(GENERATED_WEB_BINDINGS "${CMAKE_CURRENT_SOURCE_DIR}/src/esengine/bindings/WebBindings.generated.cpp")-set(GENERATED_TS_DEFINITIONS "${CMAKE_CURRENT_SOURCE_DIR}/bindings/esengine.d.ts")+set(GENERATED_TS_DEFINITIONS "${CMAKE_CURRENT_SOURCE_DIR}/sdk/src/wasm.generated.ts")if(ES_BUILD_WEB OR ES_BUILD_WXGAME)list(APPEND ESENGINE_SOURCES@@ -126,7 +126,7 @@ if(Python3_FOUND)"${CMAKE_CURRENT_SOURCE_DIR}/tools/eht.py"--input "${CMAKE_CURRENT_SOURCE_DIR}/src/esengine/ecs/components"--output "${CMAKE_CURRENT_SOURCE_DIR}/src/esengine/bindings"- --ts-output "${CMAKE_CURRENT_SOURCE_DIR}/bindings"+ --ts-output "${CMAKE_CURRENT_SOURCE_DIR}/sdk/src"DEPENDS ${COMPONENT_HEADERS} "${CMAKE_CURRENT_SOURCE_DIR}/tools/eht.py"WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"COMMENT "Running EHT..."@@ -141,10 +141,9 @@ endif()add_library(esengine STATIC ${ESENGINE_SOURCES} ${ESENGINE_HEADERS})-# EHT disabled - WebBindings.generated.cpp manually maintained-# if(Python3_FOUND)-# add_dependencies(esengine eht)-# endif()+if(Python3_FOUND)+ add_dependencies(esengine eht)+endif()target_include_directories(esenginePUBLIC@@ -190,12 +189,6 @@ if(ES_BUILD_WEB OR ES_BUILD_WXGAME)RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sdk")- add_custom_command(TARGET esengine_sdk POST_BUILD- COMMAND ${CMAKE_COMMAND} -E copy- "${CMAKE_SOURCE_DIR}/bindings/esengine.d.ts"- "${CMAKE_BINARY_DIR}/sdk/esengine.d.ts"- )-# Single-file SDK (WASM inlined as Base64, for playable ads)if(ES_BUILD_SINGLE_FILE)add_executable(esengine_single src/esengine/bindings/WebSDKEntry.cpp)@@ -283,10 +276,6 @@ if(ES_BUILD_TESTS)add_subdirectory(tests)endif()-# Bundler tool (native only)-if(NOT ES_BUILD_WEB AND NOT ES_BUILD_WXGAME)- add_subdirectory(tools/bundler)-endif()install(TARGETS esengineEXPORT ESEngineTargetsdiff --git a/sdk/src/wasm.generated.ts b/sdk/src/wasm.generated.tsnew file mode 100644index 000000000..7ce4acbed--- /dev/null+++ b/sdk/src/wasm.generated.ts@@ -0,0 +1,136 @@+/**+ * @file wasm.generated.ts+ * @brief ESEngine WASM Bindings TypeScript Definitions+ * @details Generated by EHT - DO NOT EDIT+ */++import type { Entity, Vec2, Vec3, Vec4, Quat } from './types';++// Additional Math Types+export interface UVec2 { x: number; y: number; }+export type Mat4 = number[];++// Enums++export enum ProjectionType {+ Perspective = 0,+ Orthographic = 1,+}++export enum CanvasScaleMode {+ FixedWidth = 0,+ FixedHeight = 1,+ Expand = 2,+ Shrink = 3,+ Match = 4,+}++// Components++export interface Camera {+ projectionType: number;+ fov: number;+ orthoSize: number;+ nearPlane: number;+ farPlane: number;+ aspectRatio: number;+ isActive: boolean;+ priority: number;+}++export interface Canvas {+ designResolution: UVec2;+ pixelsPerUnit: number;+ scaleMode: number;+ matchWidthOrHeight: number;+ backgroundColor: Vec4;+}++export interface Parent {+ entity: number;+}++export interface Children {+}++export interface Sprite {+ texture: number;+ color: Vec4;+ size: Vec2;+ uvOffset: Vec2;+ uvScale: Vec2;+ layer: number;+ flipX: boolean;+ flipY: boolean;+}++export interface LocalTransform {+ position: Vec3;+ rotation: Quat;+ scale: Vec3;+}++export interface WorldTransform {+ position: Vec3;+ rotation: Quat;+ scale: Vec3;+}++export interface Velocity {+ linear: Vec3;+ angular: Vec3;+}++// Registry+export interface Registry {+ create(): Entity;+ destroy(entity: Entity): void;+ valid(entity: Entity): boolean;+ entityCount(): number;++ hasCamera(entity: Entity): boolean;+ getCamera(entity: Entity): Camera;+ addCamera(entity: Entity, component: Camera): void;+ removeCamera(entity: Entity): void;+ hasCanvas(entity: Entity): boolean;+ getCanvas(entity: Entity): Canvas;+ addCanvas(entity: Entity, component: Canvas): void;+ removeCanvas(entity: Entity): void;+ hasParent(entity: Entity): boolean;+ getParent(entity: Entity): Parent;+ addParent(entity: Entity, component: Parent): void;+ removeParent(entity: Entity): void;+ hasChildren(entity: Entity): boolean;+ getChildren(entity: Entity): Children;+ addChildren(entity: Entity, component: Children): void;+ removeChildren(entity: Entity): void;+ hasSprite(entity: Entity): boolean;+ getSprite(entity: Entity): Sprite;+ addSprite(entity: Entity, component: Sprite): void;+ removeSprite(entity: Entity): void;+ hasLocalTransform(entity: Entity): boolean;+ getLocalTransform(entity: Entity): LocalTransform;+ addLocalTransform(entity: Entity, component: LocalTransform): void;+ removeLocalTransform(entity: Entity): void;+ hasWorldTransform(entity: Entity): boolean;+ getWorldTransform(entity: Entity): WorldTransform;+ addWorldTransform(entity: Entity, component: WorldTransform): void;+ removeWorldTransform(entity: Entity): void;+ hasVelocity(entity: Entity): boolean;+ getVelocity(entity: Entity): Velocity;+ addVelocity(entity: Entity, component: Velocity): void;+ removeVelocity(entity: Entity): void;+}++// Module+export interface ESEngineModule {+ Registry: new () => Registry;+ Camera: new () => Camera;+ Canvas: new () => Canvas;+ Parent: new () => Parent;+ Children: new () => Children;+ Sprite: new () => Sprite;+ LocalTransform: new () => LocalTransform;+ WorldTransform: new () => WorldTransform;+ Velocity: new () => Velocity;+}diff --git a/tools/eht.py b/tools/eht.pyindex 747830368..350fa7d8c 100644--- a/tools/eht.py+++ b/tools/eht.py@@ -477,22 +477,15 @@ class TypeScriptGenerator:def _gen_header(self) -> List[str]:return ['/**',- ' * @file esengine.d.ts',- ' * @brief ESEngine TypeScript Definitions',+ ' * @file wasm.generated.ts',+ ' * @brief ESEngine WASM Bindings TypeScript Definitions',' * @details Generated by EHT - DO NOT EDIT',- ' *',- ' * @copyright Copyright (c) 2026 ESEngine Team',' */','',- '// Core Types',- 'export type Entity = number;',+ 'import type { Entity, Vec2, Vec3, Vec4, Quat } from \'./types\';','',- '// Math Types',- 'export interface Vec2 { x: number; y: number; }',- 'export interface Vec3 { x: number; y: number; z: number; }',- 'export interface Vec4 { x: number; y: number; z: number; w: number; }',+ '// Additional Math Types','export interface UVec2 { x: number; y: number; }',- 'export interface Quat { w: number; x: number; y: number; z: number; }','export type Mat4 = number[];','',]@@ -554,8 +547,6 @@ class TypeScriptGenerator:lines.append(f' {comp.name}: new () => {comp.name};')lines.extend(['}',- '',- 'export default function createModule(): Promise<ESEngineModule>;',''])return lines@@ -602,7 +593,7 @@ def main():embind_path.write_text(embind_gen.generate(), encoding='utf-8')args.ts_output.mkdir(parents=True, exist_ok=True)- ts_path = args.ts_output / 'esengine.d.ts'+ ts_path = args.ts_output / 'wasm.generated.ts'print(f"Generating: {ts_path}")ts_gen = TypeScriptGenerator(cpp_parser.components, cpp_parser.enums)ts_path.write_text(ts_gen.generate(), encoding='utf-8')