You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In another issue I tried manually putting together some typescript definitions (with doc strings) from the old typescript branch, with some updates where i could fit them. Obviously manually generating definitions may not be ideal.
But recently I found the repo for raylib itself keeps a JSON file with type information on its structs, functions and enums. I thought I would try to parse that into a typescript definitions file.
Included in this gist is a script I wrote to pull the JSON definitions from the raylib repo and generate a typescript def file out of them. There are a few things I am unsure of about this process for generating bindings though:
It's not necessarily clear in the file what the intended use for different pointer variables/arguments should be. In JS we don't really care about pointers, but this may be important for properly recognizing which functions take arrays as arguments? This script makes the assumption that char * is a string, not a string[]. It didn't look like any raylib functions needed arrays of strings though. I'm not really a C user, so if someone could double check this logic that would be nice.
I believe this binding itself has a few wrapper functions to help creating data - things like Color(r,g,b,a) => Color. Is there somewhere documented in this repo where those functions could be brought into this generator? Or somewhere I could reference so that I could just manually add them each into this script (I imagine these wrapper functions won't change much, or new ones won't be implemented often)
The latest branch is raylib '4.0' which technically isn't released yet, so this isn't necessarily accurate to whats available to users of this npm package.
It seems like something like this could be used in the build/dist process, or to just create a @types/raylib repo seperately. This may be a better solution (at least at this moment) than relying on the binding library itself to generate definitions.
The text was updated successfully, but these errors were encountered:
In another issue I tried manually putting together some typescript definitions (with doc strings) from the old typescript branch, with some updates where i could fit them. Obviously manually generating definitions may not be ideal.
But recently I found the repo for raylib itself keeps a JSON file with type information on its structs, functions and enums. I thought I would try to parse that into a typescript definitions file.
Included in this gist is a script I wrote to pull the JSON definitions from the raylib repo and generate a typescript def file out of them. There are a few things I am unsure of about this process for generating bindings though:
It seems like something like this could be used in the build/dist process, or to just create a @types/raylib repo seperately. This may be a better solution (at least at this moment) than relying on the binding library itself to generate definitions.
The text was updated successfully, but these errors were encountered: