melonJS
    Preparing search index...

    Interface PhysicsAdapterClass<T, O>

    The static side every physics adapter class shares, next to its constructor. load() resolves once the adapter can be constructed, and create() waits for it, then constructs: an adapter whose engine is plain JavaScript (the builtin, matter and planck adapters) resolves load() at once, while one built on WebAssembly downloads and compiles it there. So await X.create(options) is the same line for every adapter, at boot or before World#setAdapter; new X(options) stays available wherever the adapter needs no loading.

    const app = new Application(800, 600, {
    physic: await PlanckAdapter.create({ gravity: { x: 0, y: 320 } }),
    });
    // later, between two screens
    app.world.setAdapter(await MatterAdapter.create());
    interface PhysicsAdapterClass<
        T extends PhysicsAdapter = PhysicsAdapter,
        O = any,
    > {
        new PhysicsAdapterClass(options?: O): T;
        create(options?: O): Promise<T>;
        load(): Promise<void>;
    }

    Type Parameters

    Index