Files
cocos4/cocos/physics-2d/framework/physics-selector.ts
T
ChiaNing 90d94fead6 api module change (#8272)
(cherry picked from commit 314ede133cd6b1873b6f71876f16947733de2c46)
2021-02-25 17:31:08 +08:00

39 lines
834 B
TypeScript

/**
* @packageDocumentation
* @hidden
*/
import { legacyCC } from '../../core/global-exports';
interface IPhysicsWrapperObject {
PhysicsWorld: any,
RigidBody?: any,
BoxShape: any,
CircleShape: any,
PolygonShape?: any,
DistanceJoint: any,
FixedJoint: any,
MouseJoint: any,
SpringJoint: any,
RelativeJoint: any,
SliderJoint: any,
WheelJoint: any,
HingeJoint: any,
}
type IPhysicsEngineId = 'builtin' | 'box2d' | string | undefined;
export let WRAPPER: IPhysicsWrapperObject;
export let physicsEngineId: IPhysicsEngineId;
export function select (id: IPhysicsEngineId, wrapper: IPhysicsWrapperObject) {
physicsEngineId = id;
legacyCC._global.CC_PHYSICS_2D_BUILTIN = id == 'builtin';
legacyCC._global.CC_PHYSICS_2D_BOX2D = id == 'box2d';
WRAPPER = wrapper;
}