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
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
* @file Physics2DRuntime.ts
* @brief Resource holding the physics wasm module + its load promise
*
* Decoupling this from App as a resource (instead of dynamic
* properties) lets Physics2DPlugin own the lifetime of the module
* without mutating App, and lets other systems read readiness
* state in the same way they read any other resource.
*/
import { defineResource } from '../ecs/resource';
import type { PhysicsWasmModule } from './PhysicsModuleLoader';
export interface Physics2DRuntimeData {
/** Loaded physics wasm module, null until the plugin's init promise resolves. */
module: PhysicsWasmModule | null;
/** Promise that resolves once the module is loaded; null before plugin install. */
initPromise: Promise<void> | null;
}
export const Physics2DRuntime = defineResource<Physics2DRuntimeData>(
{ module: null, initPromise: null },
'Physics2DRuntime',
);