Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating types for ammo.js usability functions #11

Open
kaphula opened this issue Jan 27, 2022 · 0 comments
Open

Generating types for ammo.js usability functions #11

kaphula opened this issue Jan 27, 2022 · 0 comments

Comments

@kaphula
Copy link

kaphula commented Jan 27, 2022

As far as I understand, Ammo.js adds some of its own usability functions on top of the idl bindings such as Ammo.wrapPointer and Ammo.addFunction. If you want to use these function with TypeScript you must add definitions to them manually to the ammo.d.ts file. I was able to use these functions successfully by adding these type definitions to the ammo.d.ts manually:

// ...
declare module Ammo { 
    function addFunction(func: Function, d: string): number // <-- add this
    function wrapPointer(object: any, d: any): any          // <-- add this
    // ...

Ideally, ammojs-typed would generate all of the usability functions of ammo.js automatically to the ammo.d.ts files. Could this be possible? I tried adding these functions to the idl file but there seems to be no way to add functions to the "global space", everything must be wrapped using the interface Something { ... }; syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant